diff --git a/integrations/llms/anthropic.mdx b/integrations/llms/anthropic.mdx index a428f235..4347b266 100644 --- a/integrations/llms/anthropic.mdx +++ b/integrations/llms/anthropic.mdx @@ -716,6 +716,66 @@ response = portkey.chat.completions.create( The Files API is in beta and requires the `files-api-2025-04-14` beta header. Portkey sets this automatically for file endpoints. The Files API is not supported on Bedrock or Vertex AI. +### Service Tier + +When routing Chat Completions requests to Anthropic, Portkey automatically translates OpenAI's `service_tier` parameter to Anthropic's native `speed` parameter: + +| `service_tier` | Anthropic `speed` | +|---|---| +| `auto` | `fast` | +| `standard_only` | `standard` | +| `default` | `standard` | +| `fast` | `fast` | +| `standard` | `standard` | +| unknown value | omitted | + + +```python Python icon="python" +from portkey_ai import Portkey + +portkey = Portkey( + api_key="PORTKEY_API_KEY", + provider="@anthropic" +) + +response = portkey.chat.completions.create( + model="claude-sonnet-4-5", + max_tokens=1024, + messages=[{"role": "user", "content": "Hello!"}], + service_tier="auto" # maps to speed: "fast" on Anthropic +) +``` + +```js JavaScript icon="square-js" +import Portkey from 'portkey-ai' + +const portkey = new Portkey({ + apiKey: "PORTKEY_API_KEY", + provider: "@anthropic" +}) + +const response = await portkey.chat.completions.create({ + model: "claude-sonnet-4-5", + max_tokens: 1024, + messages: [{ role: "user", content: "Hello!" }], + service_tier: "auto" // maps to speed: "fast" on Anthropic +}) +``` + +```sh cURL icon="square-terminal" +curl -X POST https://api.portkey.ai/v1/chat/completions \ + -H "x-portkey-api-key: $PORTKEY_API_KEY" \ + -H "x-portkey-provider: @anthropic" \ + -H "Content-Type: application/json" \ + -d '{ + "model": "claude-sonnet-4-5", + "max_tokens": 1024, + "messages": [{"role": "user", "content": "Hello!"}], + "service_tier": "auto" + }' +``` + + ### Beta Features Portkey supports Anthropic's beta features through headers. Pass the beta feature name as the value: