Skip to content

Commit f32fd07

Browse files
authored
Merge pull request #949 from Portkey-AI/feat/changes
chore: docs changes against feats
2 parents 707ffd9 + 8964ac5 commit f32fd07

4 files changed

Lines changed: 35 additions & 90 deletions

File tree

api-reference/inference-api/config-object.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ You can find more examples of schemas [below](/api-reference/inference-api/confi
650650
| `passthrough` | Defer provider resolution to the incoming request | boolean | No | - | When `true`, the target does not require `provider`. See [Passthrough targets](/product/ai-gateway/configs#passthrough-targets) |
651651
| `override_params` | Pass model name and other hyper parameters | object | No | "model", "temperature", "frequency\_penalty", "logit\_bias", "logprobs", "top\_logprobs", "max\_tokens", "n", "presence\_penalty", "response\_format", "seed", "stop", "top_p", etc. | Pass everything that's typically part of the payload |
652652
| `default_params` | Inject parameters into the request body only when not already present (respects client-sent values) | object | No | Any payload field | See [Default and drop params](/product/ai-gateway/configs#default-and-drop-params) |
653-
| `drop_params` | Remove parameters from the final request body using dot-notation paths (supports nested keys and array indices) | array of strings | No | Any payload field path | See [Default and drop params](/product/ai-gateway/configs#default-and-drop-params) |
653+
| `drop_params` | Remove parameters from the final request body using bracket-notation paths (nested keys, array indices, and `[*]` wildcards) | array of strings | No | Any payload field path | See [Default and drop params](/product/ai-gateway/configs#default-and-drop-params) |
654654

655655
### Strategy Object Details
656656

integrations/libraries/claude-code-bedrock.mdx

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -72,40 +72,11 @@ Replace:
7272

7373
That's it! All Claude Code requests now route through Bedrock via Portkey. Monitor usage in the [Portkey Dashboard](https://app.portkey.ai/logs).
7474

75-
## Forward Headers (Required for Some Features)
76-
77-
Some Claude Code features require the `anthropic-beta` header to reach Bedrock. Configure this in a [Portkey Config](/product/ai-gateway/configs):
78-
79-
<Steps>
80-
<Step title="Create a Config">
81-
82-
Go to [Configs](https://app.portkey.ai/configs)**Create Config**:
83-
84-
```json
85-
{
86-
"provider": "@bedrock-prod",
87-
"forward_headers": ["anthropic-beta"]
88-
}
89-
```
90-
91-
Save and copy the Config ID.
92-
</Step>
93-
94-
<Step title="Update Claude Code Settings">
95-
96-
Add the config to your settings:
75+
<Info>
76+
Portkey automatically handles `anthropic-beta` headers for Bedrock: unsupported beta flags are filtered, provider-specific values are remapped, and supported flags are forwarded upstream. You do not need `forward_headers` in your config for Claude Code to work.
9777

98-
```json
99-
{
100-
"env": {
101-
"ANTHROPIC_BASE_URL": "https://api.portkey.ai",
102-
"ANTHROPIC_AUTH_TOKEN": "YOUR_PORTKEY_API_KEY",
103-
"ANTHROPIC_CUSTOM_HEADERS": "x-portkey-api-key: YOUR_PORTKEY_API_KEY\nx-portkey-config: YOUR_CONFIG_ID"
104-
}
105-
}
106-
```
107-
</Step>
108-
</Steps>
78+
To bypass this filtering and pass `anthropic-beta` through unchanged, add `"forward_headers": ["anthropic-beta"]` to your [Portkey Config](/product/ai-gateway/configs).
79+
</Info>
10980

11081
## Trace Requests
11182

@@ -139,8 +110,7 @@ Route to backup providers when Bedrock fails. Create a config with fallback targ
139110
{ "provider": "@bedrock-prod" },
140111
{ "provider": "@anthropic-prod" },
141112
{ "provider": "@vertex-prod" }
142-
],
143-
"forward_headers": ["anthropic-beta"]
113+
]
144114
}
145115
```
146116

@@ -154,8 +124,7 @@ Distribute requests across multiple providers or regions:
154124
"targets": [
155125
{ "provider": "@bedrock-us-east", "weight": 0.5 },
156126
{ "provider": "@bedrock-us-west", "weight": 0.5 }
157-
],
158-
"forward_headers": ["anthropic-beta"]
127+
]
159128
}
160129
```
161130

@@ -166,8 +135,7 @@ Reduce costs and latency for repeated queries:
166135
```json
167136
{
168137
"provider": "@bedrock-prod",
169-
"cache": { "mode": "simple" },
170-
"forward_headers": ["anthropic-beta"]
138+
"cache": { "mode": "simple" }
171139
}
172140
```
173141

@@ -178,8 +146,7 @@ Automatically retry failed requests:
178146
```json
179147
{
180148
"provider": "@bedrock-prod",
181-
"retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] },
182-
"forward_headers": ["anthropic-beta"]
149+
"retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] }
183150
}
184151
```
185152

@@ -284,8 +251,7 @@ With Portkey Config:
284251
{ "provider": "@anthropic-prod" }
285252
],
286253
"cache": { "mode": "simple" },
287-
"retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] },
288-
"forward_headers": ["anthropic-beta"]
254+
"retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] }
289255
}
290256
```
291257

integrations/libraries/claude-code-vertex.mdx

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -68,40 +68,11 @@ Replace:
6868

6969
That's it! All Claude Code requests now route through Vertex AI via Portkey. Monitor usage in the [Portkey Dashboard](https://app.portkey.ai/logs).
7070

71-
## Forward Headers (Required for Some Features)
71+
<Info>
72+
Portkey automatically handles `anthropic-beta` headers for Vertex AI: unsupported beta flags are filtered, provider-specific values are remapped, and supported flags are forwarded upstream. You do not need `forward_headers` in your config for Claude Code to work.
7273

73-
Some Claude Code features require the `anthropic-beta` header to reach Vertex AI. Configure this in a [Portkey Config](/product/ai-gateway/configs):
74-
75-
<Steps>
76-
<Step title="Create a Config">
77-
78-
Go to [Configs](https://app.portkey.ai/configs)**Create Config**:
79-
80-
```json
81-
{
82-
"provider": "@vertex-prod",
83-
"forward_headers": ["anthropic-beta"]
84-
}
85-
```
86-
87-
Save and copy the Config ID.
88-
</Step>
89-
90-
<Step title="Update Claude Code Settings">
91-
92-
Add the config to your settings:
93-
94-
```json
95-
{
96-
"env": {
97-
"ANTHROPIC_BASE_URL": "https://api.portkey.ai",
98-
"ANTHROPIC_AUTH_TOKEN": "YOUR_PORTKEY_API_KEY",
99-
"ANTHROPIC_CUSTOM_HEADERS": "x-portkey-api-key: YOUR_PORTKEY_API_KEY\nx-portkey-config: YOUR_CONFIG_ID"
100-
}
101-
}
102-
```
103-
</Step>
104-
</Steps>
74+
To bypass this filtering and pass `anthropic-beta` through unchanged, add `"forward_headers": ["anthropic-beta"]` to your [Portkey Config](/product/ai-gateway/configs).
75+
</Info>
10576

10677
## Trace Requests
10778

@@ -135,8 +106,7 @@ Route to backup providers when Vertex AI fails. Create a config with fallback ta
135106
{ "provider": "@vertex-prod" },
136107
{ "provider": "@anthropic-prod" },
137108
{ "provider": "@bedrock-prod" }
138-
],
139-
"forward_headers": ["anthropic-beta"]
109+
]
140110
}
141111
```
142112

@@ -150,8 +120,7 @@ Distribute requests across multiple regions:
150120
"targets": [
151121
{ "provider": "@vertex-us-central", "weight": 0.5 },
152122
{ "provider": "@vertex-us-east", "weight": 0.5 }
153-
],
154-
"forward_headers": ["anthropic-beta"]
123+
]
155124
}
156125
```
157126

@@ -162,8 +131,7 @@ Reduce costs and latency for repeated queries:
162131
```json
163132
{
164133
"provider": "@vertex-prod",
165-
"cache": { "mode": "simple" },
166-
"forward_headers": ["anthropic-beta"]
134+
"cache": { "mode": "simple" }
167135
}
168136
```
169137

@@ -174,8 +142,7 @@ Automatically retry failed requests:
174142
```json
175143
{
176144
"provider": "@vertex-prod",
177-
"retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] },
178-
"forward_headers": ["anthropic-beta"]
145+
"retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] }
179146
}
180147
```
181148

@@ -280,8 +247,7 @@ With Portkey Config:
280247
{ "provider": "@anthropic-prod" }
281248
],
282249
"cache": { "mode": "simple" },
283-
"retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] },
284-
"forward_headers": ["anthropic-beta"]
250+
"retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] }
285251
}
286252
```
287253

product/ai-gateway/configs.mdx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,21 @@ Each config target can shape the request body before it reaches the upstream pro
172172
|---|---|
173173
| `default_params` | Injects parameters into the request body **only when not already present**. Unlike `override_params`, this respects values set by the client. |
174174
| `override_params` | Always overwrites the matching field on the request body. |
175-
| `drop_params` | Removes parameters from the final request body using dot-notation paths. Supports nested keys and array indices (e.g., `tools.0.function.name`). |
175+
| `drop_params` | Removes fields from the final request body using bracket-notation paths (see below). |
176176
177177
Execution order: `default_params` → `override_params` → `drop_params`. All three fields inherit through nested target configs the same way `override_params` does — values defined on a parent target apply to its children unless overridden.
178178
179+
### `drop_params` paths
180+
181+
Each entry in `drop_params` is a path into the request body. The gateway deletes the matching property before forwarding the request. Paths that do not exist on the request are silently ignored.
182+
183+
| Path style | Example | What it removes |
184+
| --- | --- | --- |
185+
| Top-level key | `"logprobs"`, `"metadata"` | A field on the root object |
186+
| Nested object | `"response_format.json_schema"` | A field at any depth (dot-separated segments) |
187+
| Array index | `"tools[0].function.strict"`, `"messages[2]"` | One element in an array and anything nested under it |
188+
| Wildcard array | `"tools[*].function.strict"`, `"messages[*].content[*].cache_control.scope"` | The same nested field on **every** array element (and nested arrays when using multiple `[*]`) |
189+
179190
### Example
180191
181192
```json
@@ -186,7 +197,7 @@ Execution order: `default_params` → `override_params` → `drop_params`. All t
186197
"provider": "@openai-prod",
187198
"default_params": { "temperature": 0.7, "max_tokens": 1024 },
188199
"override_params": { "model": "gpt-4o" },
189-
"drop_params": ["logprobs", "tools.0.function.strict"]
200+
"drop_params": ["logprobs", "tools[0].function.strict", "tools[*].function.name"]
190201
},
191202
{
192203
"provider": "@anthropic-backup",
@@ -199,7 +210,9 @@ Execution order: `default_params` → `override_params` → `drop_params`. All t
199210
In this example:
200211
- If the client does not send `temperature` or `max_tokens`, the gateway injects the defaults; if the client does send them, the client's values win.
201212
- `model` is always rewritten to `gpt-4o` regardless of what the client sends.
202-
- `logprobs` and the nested `tools[0].function.strict` field are stripped before the request is forwarded.
213+
- `logprobs` is removed from the root body.
214+
- `tools[0].function.strict` is removed only from the first tool entry.
215+
- `function.name` is removed from **every** tool entry via the `tools[*]` wildcard.
203216
204217
## Passthrough targets
205218

0 commit comments

Comments
 (0)