Claude Code setup usually depends on matching the correct API key, Base URL, authentication variable and model name. For RutaAPI, first verify your key with /v1/models before using it in Claude Code. Do not paste the website URL, dashboard URL or full chat completions endpoint as Base URL.
Before you start
You need a RutaAPI account, a prepaid credit pack, and an API key. Make sure your account has credits before making requests — requests without sufficient credits will return a 401 or 403 error.
What Claude Code is Claude Code is an agentic coding tool that can read a codebase, edit files, run commands and integrate with developer tools. It is a third-party tool from Anthropic. RutaAPI is an OpenAI-compatible API gateway — it is not an official Anthropic or Claude Code service.
What the Base URL is The Base URL is the root address of the API gateway. For Claude/Anthropic-style clients, RutaAPI supports <strong>https://api.rutaapi.com</strong>. For OpenAI-compatible clients, use <strong>https://api.rutaapi.com/v1</strong>. Claude Code and Anthropic-style tools may expect a different format than OpenAI-compatible tools. Follow the field name expected by your tool.
What the API key is The API key is a secret token that identifies your account. Generate one from the RutaAPI dashboard at app.rutaapi.com. Never paste it into screenshots or shared scripts. Rotate it immediately if exposed.
What the model name is The model name identifies the AI model that handles your request. It must match one of the models returned by GET /v1/models for your account. Do not guess — identifiers differ between providers.
Claude Code version caveat Claude Code UI, CLI behaviour, provider settings, environment variables and authentication flows can change over time. Users should verify current Claude Code documentation and their installed version before relying on a specific configuration.
RutaAPI disclaimer RutaAPI is an OpenAI-compatible API gateway. It is not an official Anthropic, Claude Code, OpenAI, Google or Microsoft service. Model availability and rates depend on your account configuration and upstream providers.
How to start with RutaAPI
Step 1 — Create a RutaAPI account
Register at app.rutaapi.com. No credit card is required to sign up.
Step 2 — Add prepaid credits
Purchase a credit pack from the billing section. Credits are added immediately after payment. Requests without sufficient credits return 401 or 403.
Step 3 — Create an API key
Go to the Tokens section and create a new key. Copy it right away — it is shown only once at creation.
Security: Never paste your full API key into screenshots or shared scripts. If exposed, rotate it immediately from the dashboard.
Step 4 — Verify /v1/models
Before configuring Claude Code, confirm the key works by calling /v1/models:
A 200 response with a model list means the key is valid. A 401 response means the key is wrong or revoked.
curl https://api.rutaapi.com/v1/models \
-H "Authorization: Bearer YOUR_RUTAAPI_KEY"Step 5 — Copy a returned model name
Use one of the model id values from the /v1/models response as MODEL_NAME. Do not guess — identifiers differ between providers.
Run /v1/models and copy the exact id string. The model name in Claude Code must match one of the returned model identifiers.
Step 6 — Configure Claude Code
Set the following environment variables in your shell configuration file:
After saving, reload your shell configuration: source ~/.zshrc or source ~/.bashrc. Claude Code will use these variables to route requests through RutaAPI.
export ANTHROPIC_BASE_URL="https://api.rutaapi.com"
export ANTHROPIC_AUTH_TOKEN="YOUR_RUTAAPI_KEY"
export ANTHROPIC_MODEL="MODEL_NAME"Step 7 — Send a small test request
Before running any coding tasks, send a simple request to confirm end-to-end connectivity:
A successful response confirms the key, Base URL, model name and credits are all working correctly.
curl https://api.rutaapi.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_RUTAAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_NAME",
"messages": [
{"role": "user", "content": "Hello from RutaAPI"}
]
}'Who this guide is for
This guide is for Claude Code users who want to connect Claude Code to an OpenAI-compatible API gateway provided by RutaAPI.
It helps if you are familiar with environment variables, API keys and making HTTP requests from a terminal.
Who should not use this setup
- Users whose Claude Code version does not support custom Base URL configuration.
- Users who require official Anthropic or Claude Code-only features.
- Users whose tool does not support custom API endpoints.
Testing before you start coding
Before running any Claude Code coding tasks, send a simple request from the terminal to confirm your key, Base URL and model name all work together. This rules out configuration issues before you start a real session.
If the first request succeeds, the Claude Code configuration should also work. If it fails, fix the terminal request first — that gives you clearer error messages than the Claude Code CLI.
How to pick a model name
Model names are returned by the GET /v1/models endpoint. Copy one of the model id values from the response and use it as the model name in your Claude Code environment configuration.
Model availability is per-account. If a model name is not in your /v1/models response, it is not active in your account — add more credits or contact support.
Common mistakes
- Using https://rutaapi.com as the Base URL instead of https://api.rutaapi.com.
- Using https://app.rutaapi.com as the Base URL.
- Using https://api.rutaapi.com/v1/chat/completions as the Base URL — that is an endpoint, not the root.
- Mixing a RutaAPI key with another provider's Base URL.
- Guessing the model name instead of copying from /v1/models.
- Using an expired or disabled key.
- Not having enough credits.
- Selecting a model that is not available in your account.
- Not sourcing the shell configuration after editing it.
- Setting variables in the wrong shell init file.
Common errors
401 Unauthorized / invalid API key
The API key is missing, incorrect, or sent to the wrong Base URL. Verify the key and Base URL both come from RutaAPI. Run /v1/models to confirm the key is valid.
403 Forbidden
The key exists but lacks permission. Check credits and model access in your RutaAPI account.
404 Model not found
The model name is not in your account. Run GET /v1/models and copy a returned model id.
429 Too Many Requests
Rate or concurrency limit. Lower the number of concurrent requests and retry.
503 Service Unavailable
The provider route is temporarily unavailable. Try a short request, check model availability, contact support if persistent.
524 Gateway Timeout
Proxy or gateway timeout — the upstream model did not respond in time. This is usually a timeout at the proxy or gateway layer, not an Anthropic error. Check request size, upstream availability and proxy settings.
When RutaAPI may be a good fit
- You need an OpenAI-compatible Base URL for Claude Code
- You want dashboard-generated API keys
- You want prepaid credits
- You want to verify available models with /v1/models
- You need docs for Claude Code, Codex CLI, Cursor, Cline and Continue.dev
- You want usage visibility before scaling
When RutaAPI may not be the right fit
- Your Claude Code version does not support the needed provider mode
- The selected model is unavailable upstream
- Your API key belongs to another provider
- You require official Anthropic or Claude Code-only features
- You need official Anthropic or Claude Code-only features instead of an API gateway
Related setup and troubleshooting guides
- API Key and Base URL explained
- Unified Base URL for AI coding tools
- Claude Code 524 / 503 timeout troubleshooting
- Codex CLI invalid_api_key troubleshooting
- Codex CLI setup with RutaAPI
- Cursor custom API setup guide
- Cline OpenAI-compatible API setup
- Continue.dev OpenAI-compatible API setup
- Available models
- Pricing and credit packs
FAQ
What Base URL should I use for Claude Code?
For Claude/Anthropic-style clients, use https://api.rutaapi.com. For OpenAI-compatible clients, use https://api.rutaapi.com/v1. Follow the field name expected by your tool. Do not use https://rutaapi.com, https://app.rutaapi.com, or any path ending in /chat/completions.
Should the Base URL include /v1?
For Claude/Anthropic-style clients, use https://api.rutaapi.com (without /v1). For OpenAI-compatible clients, use https://api.rutaapi.com/v1. Follow the field name expected by your tool.
Can I use https://rutaapi.com as the Base URL?
No. https://rutaapi.com is the marketing site, not the API root. Using it as the Base URL will result in errors. Use https://api.rutaapi.com or https://api.rutaapi.com/v1 depending on your tool.
Can I use https://app.rutaapi.com as the Base URL?
No. https://app.rutaapi.com is for account management, not the API. Using it as the Base URL will result in errors. Use https://api.rutaapi.com or https://api.rutaapi.com/v1 depending on your tool.
How do I verify my RutaAPI API key?
Call GET /v1/models with the Authorization Bearer header. A 200 response with a model list means the key is valid. A 401 response means the key is missing, wrong or revoked.
How do I choose a model name?
Run GET /v1/models and use one of the model id values from the response as the model name. Do not guess — identifiers differ between providers.
Why does Claude Code return 401?
A 401 means the API key is missing or invalid. Verify that ANTHROPIC_AUTH_TOKEN uses your current RutaAPI key and that ANTHROPIC_BASE_URL points to https://api.rutaapi.com. Run /v1/models to confirm the key is valid.
What does 403 mean?
HTTP 403 means the key exists but lacks permission. Check that your account has enough prepaid credits and that the model is enabled in your account.
What does 404 model not found mean?
HTTP 404 means the model name is not recognised at that endpoint. Run /v1/models and use one of the returned model id values as the model name. Do not guess.
What does 429 mean?
HTTP 429 means you have hit a rate or concurrency limit. Lower the number of concurrent requests, pause parallel tasks and retry after a short pause.
What does 503 mean?
HTTP 503 means the provider route is temporarily unavailable. Try a short request, check model availability, and contact support if the issue persists.
What does 524 mean?
HTTP 524 is a proxy or gateway timeout — the upstream model did not respond in time. This is usually a proxy-layer symptom, not an Anthropic or Claude Code error. Check request size, upstream availability and proxy settings.
Is Claude Code down, or is it a timeout?
A 'down' feeling can come from official upstream outage, overloaded model route, local network, proxy timeout, long context, streaming interruption, wrong Base URL, insufficient credits or model permission issues. Do not assume Anthropic is down without checking. Verify your Base URL, API key, /v1/models and credits first.
Is RutaAPI an official Anthropic or Claude Code service?
No. RutaAPI is an OpenAI-compatible API gateway operated by BDR FIDUCIARY LLC. It is not an official service of Anthropic, Claude Code, OpenAI, Google or Microsoft.
Should I share my API key in screenshots?
No. Never share your full API key in screenshots, forum posts or any public or shared channel. If exposed, rotate it immediately from the dashboard.
What should I send to support?
Include: request time (UTC), model name, error code, Base URL, any request ID from response headers, and approximate request size. Do not share your full API key. Describe the key prefix if needed.