Claude Code Integration
This guide shows how to configure Claude Code to use R9S as its API provider.
Prerequisites
Section titled “Prerequisites”Before you start, make sure you have:
-
Claude Code installed
Follow the official Claude Code quickstart to install and set up Claude Code locally.
-
An R9S API key
Sign up on the R9S platform and create an API key.
Configure Claude Code
Section titled “Configure Claude Code”Edit your Claude Code settings file:
vim ~/.claude/settings.jsonAdd the following configuration:
{ "env": { "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1", "ANTHROPIC_BASE_URL": "https://api.r9s.ai", "ANTHROPIC_AUTH_TOKEN": "R9S API KEY" }}Replace "R9S API KEY" with your actual API key from R9S.
Select a Model
Section titled “Select a Model”Claude Code can select a model through its model setting:
{ "model": "sonnet", "env": { "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1", "ANTHROPIC_BASE_URL": "https://api.r9s.ai", "ANTHROPIC_AUTH_TOKEN": "R9S API KEY" }}You can also select a model when starting Claude Code:
claude --model sonnetOr switch models inside an active Claude Code session:
/model sonnetCustom R9S Models
Section titled “Custom R9S Models”To expose a custom model option in Claude Code, set ANTHROPIC_CUSTOM_MODEL_OPTION and ANTHROPIC_CUSTOM_MODEL_OPTION_NAME in the env object.
For DeepSeek:
{ "model": "deepseek-v4-pro", "env": { "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1", "ANTHROPIC_BASE_URL": "https://api.r9s.ai", "ANTHROPIC_AUTH_TOKEN": "R9S API KEY", "ANTHROPIC_CUSTOM_MODEL_OPTION": "deepseek-v4-pro", "ANTHROPIC_CUSTOM_MODEL_OPTION_NAME": "DeepSeek via R9S" }}For GLM:
{ "model": "glm-5.1", "env": { "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1", "ANTHROPIC_BASE_URL": "https://api.r9s.ai", "ANTHROPIC_AUTH_TOKEN": "R9S API KEY", "ANTHROPIC_CUSTOM_MODEL_OPTION": "glm-5.1", "ANTHROPIC_CUSTOM_MODEL_OPTION_NAME": "GLM 5.1 via R9S" }}Configuration Notes
Section titled “Configuration Notes”CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS
Section titled “CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS”Claude Code is maintained by Anthropic, and some beta features are only supported by Anthropic’s official service.
R9S currently uses Claude models through AWS Bedrock. Because Bedrock does not fully support certain beta flags, leaving experimental features enabled may cause intermittent 400 errors.
For example:
{ "error": { "message": "ValidationException: invalid beta flag" }, "type": "error"}Set the following environment variable to avoid sending unsupported beta parameters:
"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"VS Code Integration
Section titled “VS Code Integration”To use R9S with Claude Code in VS Code:
- Install the Claude Code for VS Code extension from the VS Code Marketplace.
- Open the extension and start using Claude Code.
- The extension reads your local Claude Code configuration, so after
~/.claude/settings.jsonis configured, requests are routed through the R9S API automatically.