Claude Code

Claude Code integrates with Stravia through the Anthropic Messages protocol. Desktop can write configuration to your local Claude Code directory; configure Stravia as the ANTHROPIC_BASE_URL with the required model mappings.

Prerequisites

Before configuring Claude Code, connect an upstream Model Service, create an enabled Stravia Model ID with an enabled destination, and create an enabled API Key authorized for that model. The key used by Claude Code is the Stravia key, not the upstream provider credential.

Configuration

Protocol: Anthropic Messages
Configuration location: ~/.claude/settings.json (Desktop Apply) or manual
Required environment variables:

  • ANTHROPIC_AUTH_TOKEN: Your Stravia API Key
  • ANTHROPIC_BASE_URL: Server address (e.g., http://127.0.0.1:23471)
  • ANTHROPIC_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL: Model IDs from Stravia, one per role

Map models to roles

When configuring Claude Code via Stravia Connect, select at least one enabled model for each of these roles:

  • Default model used by Claude Code for general requests
  • Haiku model selected when Claude Code requires a faster, lighter model
  • Sonnet model selected when Claude Code requires balanced performance
  • Opus model selected when Claude Code requires maximum capability

All four mappings must be models authorized for your API Key. You may use the same model ID for multiple roles. These mappings are how Claude Code selects which Stravia model to use for different purposes; they are not related to extended thinking levels.

Apply configuration (Desktop only)

From Connect clients, select Claude Code, choose your API Key and models, then click Apply to Client. Desktop merges the settings into your Claude Code settings.json without removing other configured fields.

Manual configuration

Edit ~/.claude/settings.json and ensure an env object with the required keys:

{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "<your-api-key>",
    "ANTHROPIC_BASE_URL": "http://127.0.0.1:23471",
    "ANTHROPIC_MODEL": "my-model",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "my-model",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "my-model",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "my-model"
  }
}
json

Verify the connection

After configuration, use Claude Code to make a request. Check Request history in Stravia to confirm the request arrived and the model responded.

Troubleshoot a failed request

Confirm ANTHROPIC_BASE_URL points to the Stravia Server, ANTHROPIC_AUTH_TOKEN is a valid Stravia API Key, and each configured role maps to an enabled Model ID allowed by that key. If no interaction appears in Request history, check the address and network path from the client. If a row appears, inspect its target and error details. A Desktop Apply success only confirms the file write, not a successful Claude Code request.

Next steps

For other clients see Other clients . For general client configuration see Connect clients .