Anthropic compatible setup
Port's anthropic-compatible provider type connects to an HTTP endpoint that implements the Anthropic Messages API. You supply a base URL (the prefix before /messages), authentication via a Port secret, optional custom headers, and a catalog of model names your server exposes. Use this provider when you route Claude or other Anthropic-format models through a corporate gateway, proxy, or vendor that is not the first-party Anthropic API, Azure Anthropic, or Vertex Anthropic integrations.
For Claude models hosted on Google Vertex AI, use the Vertex Anthropic setup guide instead.
Prerequisites
Your Anthropic-compatible base URL must be reachable from Port, and you must know which model strings your endpoint accepts. Follow store API keys in secrets in the main setup guide, then return here for the request body you send to the Create or connect an LLM provider API.
Example values
Use names that match your own deployment.
| What | Example |
|---|---|
| Base URL | https://anthropic-gateway.corp.example.com (prefix before /messages. Port appends /messages when calling the API) |
| API key in Port (secret name) | ANTHROPIC_GATEWAY_API_KEY (sent as the x-api-key header) |
| Bearer token in Port (secret name) | ANTHROPIC_GATEWAY_BEARER (sent as Authorization: Bearer. Use this or an API key secret, not both) |
Model name in Port | claude-sonnet-4-20250514 (the model id your gateway expects) |
The name in Port must match the model string you pass as model in general-purpose AI interactions or invoke a specific agent when you set provider to anthropic-compatible.
Register with the Port API
Call Create or connect an LLM provider with validate_connection=true in the query string while testing. The body uses provider: "anthropic-compatible" and a config that matches your server.
Below is a minimal example you can copy and edit. The models array must list at least one object with a name of at least three characters. Optional fields such as displayName, contextWindow, and supportedFeatures help the Port UI and routing.
{
"provider": "anthropic-compatible",
"enabled": true,
"config": {
"baseUrl": "https://anthropic-gateway.corp.example.com",
"apiKeySecretName": "ANTHROPIC_GATEWAY_API_KEY",
"models": [
{
"name": "claude-sonnet-4-20250514",
"displayName": "Claude Sonnet 4",
"contextWindow": 200000,
"supportedFeatures": {
"temperature": true,
"caching": true,
"extendedThinking": true,
"nativeStructuredOutput": true
}
}
]
}
}
Provide either apiKeySecretName or authTokenSecretName, not both. If your gateway expects a bearer token instead of x-api-key, replace apiKeySecretName with authTokenSecretName.
If you need static routing or extra auth headers, add a customHeaders map. Keys and values are sent on every request to the base URL. See the API reference for the full schema.
Structured output
For models in your catalog, set supportedFeatures.nativeStructuredOutput when the endpoint behind a Claude-like model id supports Anthropic's native output_format for structured output. Leave it unset to let Port infer support from the model identifier. Set it to false when the identifier resembles a Claude model but the endpoint does not implement output_format.
After registration
- Set organization defaults by clicking on your profile picture
, selecting Settings -> AI or with Change default LLM provider and model.
- Or keep your existing default and pass
provider: "anthropic-compatible"and the registerednameon individual calls.
For validation flow, default selection, and common failures, use Setup & configuration alongside your gateway access logs and metrics.