Skip to main content

Model Providers

Anthropic

Call Anthropic models through your Verdictan gateway. Your Anthropic key stays on the gateway, and your application calls the gateway with its application token.

Your application can use the OpenAI Chat Completions or Responses format, or the Anthropic Messages format. The gateway sends every request to the Anthropic Messages API.

Before you start​

  • A working gateway from the quickstart.
  • An Anthropic API key, and one model ID that the key can use.
  • The gateway startup command, and a separate application token for test requests.

Configure the provider​

policy-config.yaml
pack:
  name: anthropic-integration
  version: 1.0.0
  enabled: true
policies:
  chain:
    - prompt-injection
providers:
  targets:
    - id: anthropic-primary
      provider: anthropic
      provider_type: anthropic
      format: anthropic
      model: "replace-with-anthropic-model-id"
      base_url: https://api.anthropic.com
      secret_key_ref:
        env: VERDICTAN_ANTHROPIC_API_KEY

Use the exact value provider: anthropic. The gateway rejects aliases such as claude. Keep provider_type and format: without them, verdictan policy lint reports an error for an anthropic.com base URL.

base_url is required and must start with https://. The gateway sends each request to /v1/messages on that host. It sends the key from VERDICTAN_ANTHROPIC_API_KEY in the x-api-key header, and the anthropic-version header with the value 2023-06-01. To send another version, set anthropic_version on the target.

Start and verify​

To deploy the Anthropic configuration from your terminal, use CLI 0.1.14 or later. Keep the provider key in the gateway environment. Check In sync, then send the Chat Completions request below.

With the quickstart in Docker, follow the container steps instead of steps 1 to 3.

  1. In the gateway terminal, set the key, then check the file. policy lint checks the policy pack, and config validate checks the provider target fields.

    export VERDICTAN_ANTHROPIC_API_KEY="<provider-api-key>"
    verdictan policy lint --file policy-config.yaml
    verdictan config validate --file policy-config.yaml
  2. Restart the test gateway with the key in its environment.

  3. Open Configurations in the Console. Create a configuration, or edit the test agent's configuration. Import the file and select Next. Under Deploy to agent, select the test agent. Select Deploy, then confirm the gateway count. Wait about 30 seconds, and send the request below to check the change.

  4. In a second terminal, send a Chat Completions request:

    export VERDICTAN_CLIENT_TOKEN="<application-token>"
    curl --fail-with-body http://127.0.0.1:41002/v1/chat/completions \
      -H "Authorization: Bearer ${VERDICTAN_CLIENT_TOKEN}" \
      -H "Content-Type: application/json" \
      -d '{"model":"replace-with-anthropic-model-id","max_tokens":128,"messages":[{"role":"user","content":"Reply with Hello."}]}'
  5. If your application uses the Messages format, send a Messages request:

    curl --fail-with-body http://127.0.0.1:41002/v1/messages \
      -H "Authorization: Bearer ${VERDICTAN_CLIENT_TOKEN}" \
      -H "Content-Type: application/json" \
      -d '{"model":"replace-with-anthropic-model-id","max_tokens":128,"messages":[{"role":"user","content":"Reply with Hello."}]}'

The Chat Completions reply is in choices[0].message.content. The Messages reply keeps the Anthropic shape, with the text in the content array. A reply proves the whole path: application token, Anthropic key, and model access. The request appears in History when capture is on, or in the delivered events.

Supported requests​

RequestSupport
Chat CompletionsYes. Translated to Messages. Streaming and tools work.
ResponsesYes. Translated to Messages. Send input as a string, or as messages with text content.
MessagesYes. Streams come back in the Anthropic event format.
Image and PDF inputYes, as Chat Completions image_url parts or PDF document blocks
response_format with json_object or json_schema, parallel_tool_calls: true, strict toolsNo. The gateway rejects the request with HTTP 422 before it calls Anthropic.
Embeddings, audioNo

All three supported request families go through your policy chain.

When the gateway translates a request, it maps model, messages, max_tokens or max_completion_tokens, temperature, top_p, stream, tools, and tool_choice. System messages become the Anthropic system field, and tool messages become tool_result blocks. If the request has no max_tokens, the gateway sends 4096. It drops n and stop, and copies other top-level fields into the Anthropic metadata object.

The gateway rebuilds /v1/messages bodies the same way. Fields such as stop_sequences, top_k, or thinking go into metadata, and Anthropic image blocks are dropped. A /v1/messages body that contains an anthropic_version field is the exception: the gateway removes that field and forwards the rest unchanged.

The gateway forwards an anthropic-beta request header only with the values interleaved-thinking-2025-05-14 or fine-grained-tool-streaming-2025-05-14. Format Translation describes the translation in general.

Failure behavior​

ProblemResult or cause
Lint reports provider 'claude' must use exact provider id 'anthropic'provider is an alias. Set it to anthropic.
Lint reports base_url looks like Anthropic API but 'format' and 'provider_type' are not setAdd provider_type: anthropic and format: anthropic.
config validate reports base_url is requiredAdd base_url.
config validate reports anthropic runtime requires an https:// base_url unless it targets a loopback test endpointbase_url uses http:// on a host that is not 127.0.0.1, localhost, or ::1.
The gateway reports Provider target 'anthropic-primary' is inactive: environment variable 'VERDICTAN_ANTHROPIC_API_KEY' is not setSet the key in the gateway process and restart it. With required: true on the target, the gateway does not start without the key.
401 from the gatewayThe application token is not active.
422 with runtime.structured_output.unsupported_featureThe request has response_format with json_object or json_schema.
422 with runtime.tooling.unsupported_feature or runtime.beta_header.unsupportedThe request sets parallel_tool_calls: true or sends an anthropic-beta value that the gateway does not forward.
Anthropic returns an error statusThe client gets the same status with code upstream_provider_error and the message Upstream provider returned HTTP <status>. The Anthropic error body is not returned. On /v1/messages, the gateway error has the Anthropic error format. Check the key, the model, and your Anthropic limits. If another target is eligible, some errors move the request to that target first.

Limits​

  • Model IDs, prices, rate limits, and request fields are in the Anthropic API documentation.
  • One target serves one model. Add a target for each model your application uses.
  • Assistant tool_calls in the message history of a Chat Completions request are not translated. Test multi-turn tool use with your client.
  • If the Anthropic call fails with a rate limit, a server error, an authentication error, or a transport error, the gateway tries the next eligible target. Provider attempts and fallback has the rules.
  • A listener on a non-loopback address needs TLS and network controls.

Next steps​