LowRouter

Anthropic SDK

The gateway accepts Anthropic-shaped requests on a separate path so the official anthropic SDK works without a custom adapter. Use this when your codebase is already standardised on Anthropic’s messages.create() style.

Python

pip install anthropic

TypeScript

npm install @anthropic-ai/sdk

Notes

  • The model string is the LowRouter ID (anthropic/claude-sonnet-4-5), not Anthropic’s bare model name.
  • api_key is your LowRouter key, not an Anthropic API key.
  • The anthropic-version header is set automatically by the SDK; the gateway accepts what the SDK sends.
  • Streaming works as in the official SDK (client.messages.stream(...)).
  • Eco metadata is appended to the response in a lowrouter field at the top level, the same shape as in the OpenAI-compatible path.

When to prefer this over the OpenAI path

  • Your codebase already uses Anthropic types end-to-end and you don’t want to rewrite call-sites.
  • You depend on Anthropic-specific request features (system prompt caching, citations, computer-use tool blocks) that aren’t in the OpenAI schema.
  • You want to keep tool definitions in Anthropic’s tools shape.

If neither of these applies, the OpenAI-compatible path is simpler: one set of types, one base URL, every model on the same endpoint.