Configure Claude Code
Claude Code connects to InOneAPI through the Anthropic Messages-compatible protocol. InOneAPI handles authentication, protocol processing, metering and routing; Claude Code's file access, command execution and approvals remain under the control of the local client.
Before you start
Create a project key dedicated to Claude Code, then copy a model ID from the model detail page that supports Anthropic Messages, streaming and tool calling. Capabilities differ across protocols, so verify them on the model detail page instead of inferring them from a model name.
Write the configuration
On Windows the path is %USERPROFILE%\.claude\settings.json; when CLAUDE_CONFIG_DIR is set, use that directory. Create or open ~/.claude/settings.json and merge the env field into the existing JSON:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.inoneapi.com",
"ANTHROPIC_AUTH_TOKEN": "ioa_sk_...",
"ANTHROPIC_MODEL": "YOUR_MODEL_ID",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "YOUR_MODEL_ID",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "YOUR_MODEL_ID",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "YOUR_MODEL_ID"
}
}
Do not append /v1 to ANTHROPIC_BASE_URL; Claude Code requests the Messages path itself. Using the same ID in all four model variables keeps Claude Code from falling back to an unconfigured default model at different stages of a task.
If you do not want to store the key in JSON, set ANTHROPIC_AUTH_TOKEN in your shell and remove that field from settings.json:
export ANTHROPIC_AUTH_TOKEN="ioa_sk_..."
Start and verify
claude
Run a read-only task first, then check the trace in the console. Confirm that the requested model matches your configuration, the interface is Anthropic Messages, streaming works, and tool calls produce no protocol conversion errors.
Common issues
- Repeated login prompts: confirm that
ANTHROPIC_AUTH_TOKENis what you set, then fully quit and restart Claude Code. 401: check the key, the project status, and whether an environment variable is still overriding it with an old value.404: usually a wrong base URL or a model ID that does not exist; the base URL here has no/v1.- Tool call failures: switch to a model that the model detail page lists as supporting tool calling and Anthropic Messages.
- Unexpected cost: Claude Code may read files in parallel or retry, so set a budget and alerts on the dedicated key.
Do not sync a settings.json containing a real key to a team repository. Each team member should use a traceable personal or team sub-key.
Optional: import into CC Switch
On the model detail page, select this tool and an API key, then click “Open CC Switch and import”. Use the official CC Switch release; the import link already contains the current model ID, so you do not need to enter it again. After confirming the import, finish the connection by enabling the provider and setting the default model for this tool. If it reports that this app is unsupported, update CC Switch or follow the manual steps in this document.
The import link only adds a provider. It does not mean the model is already the default or that a request succeeded. The link contains an API key, so do not share it. Use either the manual setup or the CC Switch import, not both.
The CC Switch link also passes model, haikuModel, sonnetModel and opusModel, all set to the current model ID, which matches the manual configuration.
Official reference: Claude Code LLM Gateway.