- AI Gateway
- next
- Gateway Artifacts
- LLM Provider
- Supported Providers
Anthropic¶
Connect the AI Gateway to the Anthropic API. You end up with an LLM Provider that holds your Anthropic credentials, exposes the Messages endpoint through the gateway, and can be consumed by any LLM proxy.
This page is for platform administrators, who hold the upstream credentials.
Connection details¶
The anthropic template and these connection settings apply to every Anthropic provider you create:
| Setting | Value |
|---|---|
| Template ID | anthropic |
| Upstream URL | https://api.anthropic.com |
| Auth type | api-key |
| Auth header | x-api-key |
Anthropic reads the key from a dedicated x-api-key header, so the value is the key on its own with no prefix.
Configure the provider¶
Replace <anthropic-api-key> with your Anthropic API key and deploy the provider:
curl -X POST http://localhost:9090/api/management/v1/llm-providers \
-H "Content-Type: application/yaml" \
-u "$ADMIN_USERNAME:$ADMIN_PASSWORD" \
--data-binary @- <<'EOF'
apiVersion: gateway.api-platform.wso2.com/v1
kind: LlmProvider
metadata:
name: anthropic-provider
spec:
displayName: Anthropic Provider
version: v1.0
template: anthropic
context: /providers/anthropic
upstream:
url: https://api.anthropic.com
auth:
type: api-key
header: x-api-key
value: <anthropic-api-key>
accessControl:
mode: deny_all
exceptions:
- path: /v1/messages
methods: [POST]
EOF
The accessControl block restricts which upstream paths the provider exposes. This provider denies everything except POST /v1/messages.
The context value sets the URL prefix the provider answers on, so this provider serves the Messages endpoint under /providers/anthropic.
Test the provider¶
Anthropic providers are exercised through an LLM proxy rather than called directly, because the proxy translates between the OpenAI request format your application sends and the Anthropic Messages format the upstream expects.
To build that proxy and send it a request, see Multi-provider routing, which deploys this provider alongside an OpenAI one and selects between them with a request header.
Supported models¶
Anthropic publishes its model list in the Anthropic models reference. Any model Anthropic exposes on the endpoint above works through the gateway; set it in the model field of your request.
Provider-specific notes¶
Two settings differ from a provider that follows the OpenAI wire format. Both are properties of the Anthropic API, not gateway options:
- The auth header is
x-api-key, notAuthorization. Sending the key inAuthorizationfails at the upstream. - The upstream URL carries no version segment. Anthropic puts the version in the request path, so
https://api.anthropic.comcombines with the/v1/messagespath fromaccessControl. Adding/v1to the URL produces a doubled/v1/v1/messagespath.
When an LLM proxy routes to this provider, the proxy applies a transformer and may add its own authentication between the two. Those settings belong to the proxy, not to the provider shown here.
Related pages¶
- Provider templates — the token and model metadata the
anthropictemplate extracts. - Multi-provider routing — the proxy that consumes this provider.
- OpenAI — the same setup for a provider that uses
Authorizationand the OpenAI wire format.