You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/sandbox/guides/proxy-requests.mdx
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -189,6 +189,19 @@ response = requests.post(
189
189
190
190
The real `MY_API_KEY` is never present in the sandbox. The Worker substitutes it transparently.
191
191
192
+
:::note[Pointing SDKs at the proxy URL]
193
+
Many API clients and SDKs default to the official API base URL. After setting up the proxy, you need to tell the library to send requests to your Worker instead. Most SDKs support an environment variable or constructor option to override the base URL.
194
+
195
+
For example, the Anthropic SDK reads `ANTHROPIC_BASE_URL`. Pass your proxy URL as that value and the JWT token as the API key:
The SDK then sends all requests to your Worker proxy, which validates the token and forwards them to `api.anthropic.com` with the real key injected. Check the documentation for your API client to find the equivalent base URL setting.
203
+
:::
204
+
192
205
## Adding more services
193
206
194
207
To proxy additional APIs, define another `ServiceConfig` and add it to `createProxyHandler`:
0 commit comments