Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions api-reference/inference-api/anthropic-transform.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
- `stop` → mapped to `stop_sequences`
- `max_completion_tokens` → mapped to `max_tokens`

## Anthropic Sampling + Token Rules
- For Anthropic models (across providers), `temperature` and `top_p` are direct mappings when sent individually.
- If both `temperature` and `top_p` are sent together, Portkey keeps `temperature` and drops `top_p`.
- If `max_tokens` is explicitly sent as `null`, Portkey falls back to `max_completion_tokens` (if present) or a safe default.

## Complex Transformations

### Messages Transformation
Expand Down
6 changes: 5 additions & 1 deletion product/ai-gateway/messages-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ curl https://api.portkey.ai/v1/messages \
| `stop_sequences` | array | Stop strings. Translated to `stop` for adapter providers |
| `stream` | boolean | Enable streaming responses |

<Note>
For Anthropic models (across all providers/routes), `temperature` and `top_p` are direct mappings when provided individually. If both are sent together, Portkey keeps `temperature` and drops `top_p` to match Anthropic constraints.
</Note>

## Tool Use

Define tools with `name`, `description`, and `input_schema`:
Expand Down Expand Up @@ -698,7 +702,7 @@ Parameters translated for adapter providers:
| `tool_choice: {type: "any"}` | `"required"` | |
| `tool_choice: {type: "tool", name: X}` | `{type: "function", function: {name: X}}` | |
| `metadata.user_id` | `user` | |
| `temperature`, `top_p`, `stream` | Direct pass-through | |
| `temperature`, `top_p`, `stream` | Direct pass-through | For Anthropic models: if both `temperature` and `top_p` are present, Portkey drops `top_p`. |
| `output_config.format` (`json_schema`) | `response_format` | Portkey extension; `json_object` not supported |
| `output_config.effort` | `reasoning_effort` | Portkey extension for cross-provider reasoning |

Expand Down