OpenResponses.Adapters.Anthropic (OpenResponses v0.1.1)

View Source

Adapter for the Anthropic Messages API (Claude models).

Translates between the Open Responses spec and Anthropic's native format. This adapter also works with any Anthropic-compatible endpoint, including z.ai — set base_url in your provider config to point at the compatible endpoint.

API key

Callers supply their API key per-request in the "api_key" field:

{
  "model": "claude-opus-4-5",
  "api_key": "sk-ant-...",
  "input": [{"role": "user", "content": "Hello!"}]
}

Requests without api_key are rejected before the adapter is invoked.

Server configuration (optional)

Use server config only for non-secret options like a custom base_url (e.g. to point at a z.ai-compatible endpoint):

config :open_responses, :provider_config, %{
  anthropic: [
    base_url: "https://my-anthropic-proxy.example.com/v1"
  ]
}

Routing

Selected automatically for model names matching ~r/^claude-/:

config :open_responses, :routing, %{
  ~r/^claude-/ => OpenResponses.Adapters.Anthropic
}

Translation notes

Open ResponsesAnthropic
system role messageTop-level system field
tool.parameterstool.input_schema
reasoning itemthinking content block
response.completedmessage_delta with stop_reason: end_turn
response.incompletemessage_delta with stop_reason: max_tokens