Skip to main content
Claude Code is Anthropic’s official CLI and connects to Anthropic’s own gateway by default. Two environment variables route it through DimiLinks. The fastest method is CC Switch:
  1. Install CC Switch and sign in.
  2. On the API Keys page in the DimiLinks console, click “Import to CC Switch” for a key restricted to Claude models.
  3. CC Switch automatically adds a provider named Claude with the base URL set to https://api-direct.dimilinks.com/.
  4. Before starting Claude Code, run cc-switch use <provider> to switch to DimiLinks.
See One-click import into CC Switch / Cherry Studio for the deep-link structure.

Configure environment variables manually

If you do not use CC Switch, set the environment variables directly:
export ANTHROPIC_BASE_URL="https://api-direct.dimilinks.com/"
export ANTHROPIC_AUTH_TOKEN="sk-..."
Then start Claude Code:
claude
Add the variables to your shell configuration (~/.zshrc or ~/.bashrc) to persist them. To maintain multiple configurations for different keys, use a tool such as direnv or mise to inject them by directory.
Claude Code does not read the OpenAI-compatible endpoint. You must use https://api-direct.dimilinks.com/, not dimilinks.com/v1.
Use caseModel ID
General coding / refactoringclaude-sonnet-5
Deep reasoning / complex tasksclaude-opus-4-8
Large-context long documentsclaude-opus-4-8
Low-cost batch callsclaude-haiku-4-5
Use the /model command after startup to switch models. Model IDs match the List models response.

Troubleshooting

  • 401 Invalid token: The environment variable is not active or the key is incorrect. Run echo $ANTHROPIC_AUTH_TOKEN to check it.
  • 403 model_not_allowed: The key’s model restrictions do not allow the Claude model you selected. Update the key in the console.
  • Requests keep timing out: Start with the minimal curl example under Authentication. If curl succeeds but Claude Code does not, a local proxy or corporate VPN is probably blocking the request.
  • Keep an official Anthropic account available as well: Maintain multiple providers in CC Switch and run cc-switch use anthropic before startup to switch back.