From 8964ac533400e6ce39473f0ac5a993eded4efe8a Mon Sep 17 00:00:00 2001 From: whysumedh Date: Thu, 21 May 2026 19:23:34 +0530 Subject: [PATCH] docs changes against feats --- api-reference/inference-api/config-object.mdx | 2 +- .../libraries/claude-code-bedrock.mdx | 52 ++++--------------- integrations/libraries/claude-code-vertex.mdx | 52 ++++--------------- product/ai-gateway/configs.mdx | 19 +++++-- 4 files changed, 35 insertions(+), 90 deletions(-) diff --git a/api-reference/inference-api/config-object.mdx b/api-reference/inference-api/config-object.mdx index f91ebc8c..4bedd0fe 100644 --- a/api-reference/inference-api/config-object.mdx +++ b/api-reference/inference-api/config-object.mdx @@ -650,7 +650,7 @@ You can find more examples of schemas [below](/api-reference/inference-api/confi | `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) | | `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 | | `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) | -| `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) | +| `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) | ### Strategy Object Details diff --git a/integrations/libraries/claude-code-bedrock.mdx b/integrations/libraries/claude-code-bedrock.mdx index f64e3b9a..d68ad015 100644 --- a/integrations/libraries/claude-code-bedrock.mdx +++ b/integrations/libraries/claude-code-bedrock.mdx @@ -72,40 +72,11 @@ Replace: That's it! All Claude Code requests now route through Bedrock via Portkey. Monitor usage in the [Portkey Dashboard](https://app.portkey.ai/logs). -## Forward Headers (Required for Some Features) - -Some Claude Code features require the `anthropic-beta` header to reach Bedrock. Configure this in a [Portkey Config](/product/ai-gateway/configs): - - - - -Go to [Configs](https://app.portkey.ai/configs) → **Create Config**: - -```json -{ - "provider": "@bedrock-prod", - "forward_headers": ["anthropic-beta"] -} -``` - -Save and copy the Config ID. - - - - -Add the config to your settings: + +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. -```json -{ - "env": { - "ANTHROPIC_BASE_URL": "https://api.portkey.ai", - "ANTHROPIC_AUTH_TOKEN": "YOUR_PORTKEY_API_KEY", - "ANTHROPIC_CUSTOM_HEADERS": "x-portkey-api-key: YOUR_PORTKEY_API_KEY\nx-portkey-config: YOUR_CONFIG_ID" - } -} -``` - - +To bypass this filtering and pass `anthropic-beta` through unchanged, add `"forward_headers": ["anthropic-beta"]` to your [Portkey Config](/product/ai-gateway/configs). + ## Trace Requests @@ -139,8 +110,7 @@ Route to backup providers when Bedrock fails. Create a config with fallback targ { "provider": "@bedrock-prod" }, { "provider": "@anthropic-prod" }, { "provider": "@vertex-prod" } - ], - "forward_headers": ["anthropic-beta"] + ] } ``` @@ -154,8 +124,7 @@ Distribute requests across multiple providers or regions: "targets": [ { "provider": "@bedrock-us-east", "weight": 0.5 }, { "provider": "@bedrock-us-west", "weight": 0.5 } - ], - "forward_headers": ["anthropic-beta"] + ] } ``` @@ -166,8 +135,7 @@ Reduce costs and latency for repeated queries: ```json { "provider": "@bedrock-prod", - "cache": { "mode": "simple" }, - "forward_headers": ["anthropic-beta"] + "cache": { "mode": "simple" } } ``` @@ -178,8 +146,7 @@ Automatically retry failed requests: ```json { "provider": "@bedrock-prod", - "retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] }, - "forward_headers": ["anthropic-beta"] + "retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] } } ``` @@ -284,8 +251,7 @@ With Portkey Config: { "provider": "@anthropic-prod" } ], "cache": { "mode": "simple" }, - "retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] }, - "forward_headers": ["anthropic-beta"] + "retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] } } ``` diff --git a/integrations/libraries/claude-code-vertex.mdx b/integrations/libraries/claude-code-vertex.mdx index 9168806d..c054ee1d 100644 --- a/integrations/libraries/claude-code-vertex.mdx +++ b/integrations/libraries/claude-code-vertex.mdx @@ -68,40 +68,11 @@ Replace: 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). -## Forward Headers (Required for Some Features) + +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. -Some Claude Code features require the `anthropic-beta` header to reach Vertex AI. Configure this in a [Portkey Config](/product/ai-gateway/configs): - - - - -Go to [Configs](https://app.portkey.ai/configs) → **Create Config**: - -```json -{ - "provider": "@vertex-prod", - "forward_headers": ["anthropic-beta"] -} -``` - -Save and copy the Config ID. - - - - -Add the config to your settings: - -```json -{ - "env": { - "ANTHROPIC_BASE_URL": "https://api.portkey.ai", - "ANTHROPIC_AUTH_TOKEN": "YOUR_PORTKEY_API_KEY", - "ANTHROPIC_CUSTOM_HEADERS": "x-portkey-api-key: YOUR_PORTKEY_API_KEY\nx-portkey-config: YOUR_CONFIG_ID" - } -} -``` - - +To bypass this filtering and pass `anthropic-beta` through unchanged, add `"forward_headers": ["anthropic-beta"]` to your [Portkey Config](/product/ai-gateway/configs). + ## Trace Requests @@ -135,8 +106,7 @@ Route to backup providers when Vertex AI fails. Create a config with fallback ta { "provider": "@vertex-prod" }, { "provider": "@anthropic-prod" }, { "provider": "@bedrock-prod" } - ], - "forward_headers": ["anthropic-beta"] + ] } ``` @@ -150,8 +120,7 @@ Distribute requests across multiple regions: "targets": [ { "provider": "@vertex-us-central", "weight": 0.5 }, { "provider": "@vertex-us-east", "weight": 0.5 } - ], - "forward_headers": ["anthropic-beta"] + ] } ``` @@ -162,8 +131,7 @@ Reduce costs and latency for repeated queries: ```json { "provider": "@vertex-prod", - "cache": { "mode": "simple" }, - "forward_headers": ["anthropic-beta"] + "cache": { "mode": "simple" } } ``` @@ -174,8 +142,7 @@ Automatically retry failed requests: ```json { "provider": "@vertex-prod", - "retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] }, - "forward_headers": ["anthropic-beta"] + "retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] } } ``` @@ -280,8 +247,7 @@ With Portkey Config: { "provider": "@anthropic-prod" } ], "cache": { "mode": "simple" }, - "retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] }, - "forward_headers": ["anthropic-beta"] + "retry": { "attempts": 3, "on_status_codes": [429, 500, 502, 503] } } ``` diff --git a/product/ai-gateway/configs.mdx b/product/ai-gateway/configs.mdx index 357e8a61..51b9cef6 100644 --- a/product/ai-gateway/configs.mdx +++ b/product/ai-gateway/configs.mdx @@ -172,10 +172,21 @@ Each config target can shape the request body before it reaches the upstream pro |---|---| | `default_params` | Injects parameters into the request body **only when not already present**. Unlike `override_params`, this respects values set by the client. | | `override_params` | Always overwrites the matching field on the request body. | -| `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`). | +| `drop_params` | Removes fields from the final request body using bracket-notation paths (see below). | 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. +### `drop_params` paths + +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. + +| Path style | Example | What it removes | +| --- | --- | --- | +| Top-level key | `"logprobs"`, `"metadata"` | A field on the root object | +| Nested object | `"response_format.json_schema"` | A field at any depth (dot-separated segments) | +| Array index | `"tools[0].function.strict"`, `"messages[2]"` | One element in an array and anything nested under it | +| Wildcard array | `"tools[*].function.strict"`, `"messages[*].content[*].cache_control.scope"` | The same nested field on **every** array element (and nested arrays when using multiple `[*]`) | + ### Example ```json @@ -186,7 +197,7 @@ Execution order: `default_params` → `override_params` → `drop_params`. All t "provider": "@openai-prod", "default_params": { "temperature": 0.7, "max_tokens": 1024 }, "override_params": { "model": "gpt-4o" }, - "drop_params": ["logprobs", "tools.0.function.strict"] + "drop_params": ["logprobs", "tools[0].function.strict", "tools[*].function.name"] }, { "provider": "@anthropic-backup", @@ -199,7 +210,9 @@ Execution order: `default_params` → `override_params` → `drop_params`. All t In this example: - 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. - `model` is always rewritten to `gpt-4o` regardless of what the client sends. -- `logprobs` and the nested `tools[0].function.strict` field are stripped before the request is forwarded. +- `logprobs` is removed from the root body. +- `tools[0].function.strict` is removed only from the first tool entry. +- `function.name` is removed from **every** tool entry via the `tools[*]` wildcard. ## Passthrough targets