Skip to main content

1. What should I enter for the API base URL?

Depending on the protocol, there are several options: Note: If you encounter a 404 error, check whether there is an extra /v1 at the end of the URL. Different tools have different path concatenation logic.

2. What should I do if I get a 401 “invalid token” error?

  1. Confirm the API Key has been correctly created: https://myrouter.ai/settings/key-management
  2. Confirm the Authorization header format is: Bearer sk_xxxxxx
  3. If using Claude Code, the environment variable should be set as ANTHROPIC_AUTH_TOKEN=sk_xxxxx (no need to add the Bearer prefix; the tool adds it automatically)

3. How do I troubleshoot a 404 “page not found” error?

Common causes:
  • Incorrect URL: e.g., typo in /v3/glm-asr
  • Model routing error: e.g., Codex models need to use /v1/responses instead of /v1/chat/completions
  • Tool auto-concatenation issue: Some tools (e.g., cc-switch) automatically append /chat/completions, in which case the Base URL should not include that path

4. How do I configure Myrouter in Claude Code?

Set the environment variables as follows: Windows cmd:
set ANTHROPIC_BASE_URL=https://api.myrouter.ai/anthropic
set ANTHROPIC_AUTH_TOKEN=sk_your_api_key
set ANTHROPIC_MODEL=claude-opus-4-1-20250805
set ANTHROPIC_SMALL_FAST_MODEL=claude-sonnet-4-20250514
Mac/Linux bash:
export ANTHROPIC_BASE_URL=https://api.myrouter.ai/anthropic
export ANTHROPIC_AUTH_TOKEN=sk_your_api_key
export ANTHROPIC_MODEL=claude-opus-4-1-20250805
export ANTHROPIC_SMALL_FAST_MODEL=claude-sonnet-4-20250514
Reference documentation: https://docs.myrouter.ai/docs/integration/claudecode

5. How do I resolve Claude Code forcing login/requiring verification?

The latest version of Claude Code may require mandatory login. Solutions:
  • Use the Cline plugin as an alternative (search in the VSCode plugin marketplace)
  • Or use forwarding tools like cc-switch

6. How do I call GPT-5.1 / Codex models? Why am I getting a 400 error?

The GPT-5.1 series (including Codex) requires the OpenAI Responses API, not Chat Completions:
curl "https://api.myrouter.ai/openai/v1/responses" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API Key>" \
-d '{
    "model": "gpt-5.1-codex",
    "input": [...],
    "max_output_tokens": 64000
  }'

7. What should I do about “thinking block” errors with Claude 4.5?

The error typically says: Expected ‘thinking’ or ‘redacted_thinking’, but found ‘text’. This is because after enabling the Thinking feature for Claude 4.5, the context must include a specific thinking block format. Suggestions:
  • Clear conversation history and start over
  • Or disable the Thinking feature (if not needed)
  • Use the native Anthropic protocol instead of the OpenAI compatible protocol (the latter may have incomplete Thinking support)

8. Getting an “input too long” error when calling the Claude API?

Claude models have input length limits (typically max_tokens supports up to 64000). Please check:
  • Input text length
  • Base64 image size (compress large images first)
  • Accumulated conversation history context length

Contact Support If the above FAQ does not resolve your issue, please contact technical support through the following channels:
  • Email: support@myrouter.ai
  • Please provide the following information:
    • Problem description + screenshots
    • Account ID (UUID)
    • Trace ID (if available, usually found in the error message)
    • Request parameters (with sensitive data redacted)