Agent Integrations

Configure coding agents and LiteLLM-style tools to use R9S as their model gateway.

R9S can serve as the model gateway for coding agents that support OpenAI-compatible, Anthropic-compatible, or LiteLLM-style configuration.

Common base URL:

https://gw.r9s.ai/

Use your R9S API key for authentication.

Verify access

Before configuring an agent, confirm that the key can list models:

export R9S_API_KEY="<R9S_API_KEY>"

curl https://gw.r9s.ai/v1/models \
  -H "Authorization: Bearer $R9S_API_KEY"

Supported patterns

Agent or tool Compatibility style Base URL
Codex OpenAI-compatible https://gw.r9s.ai/
Claude Code Anthropic-compatible https://gw.r9s.ai/
OpenClaw LiteLLM-style custom base URL https://gw.r9s.ai/
OpenCode OpenAI-compatible provider https://gw.r9s.ai/

Codex

Configure Codex with an OpenAI-compatible base URL:

export R9S_API_KEY="<R9S_API_KEY>"
export OPENAI_BASE_URL="https://gw.r9s.ai/"
export OPENAI_API_KEY="$R9S_API_KEY"

Run with an R9S model:

codex --model gpt-5-codex

Troubleshooting:

Symptom Check
Authentication error Confirm OPENAI_API_KEY contains the R9S API key
Model not found Confirm the model is available in /v1/models
Requests use the default endpoint Confirm OPENAI_BASE_URL is exported before starting Codex

Claude Code

Configure Claude Code with an Anthropic-compatible base URL:

export R9S_API_KEY="<R9S_API_KEY>"
export ANTHROPIC_BASE_URL="https://gw.r9s.ai/"
export ANTHROPIC_AUTH_TOKEN="$R9S_API_KEY"

If your setup expects an API key variable, also set:

export ANTHROPIC_API_KEY="$R9S_API_KEY"

Run with an R9S Claude-compatible model:

claude --model claude-sonnet-4.5

OpenClaw

OpenClaw can use a LiteLLM-style custom base URL:

export R9S_API_KEY="<R9S_API_KEY>"
export LITELLM_API_KEY="$R9S_API_KEY"

Onboard with R9S:

openclaw onboard \
  --non-interactive \
  --accept-risk \
  --auth-choice litellm-api-key \
  --litellm-api-key "$R9S_API_KEY" \
  --custom-base-url "https://gw.r9s.ai/" \
  --install-daemon \
  --skip-channels \
  --skip-skills

Select a model routed through R9S:

openclaw models set litellm/claude-sonnet-4.5

OpenCode

Add an R9S provider to OpenCode configuration:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "r9s": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "R9S",
      "options": {
        "baseURL": "https://gw.r9s.ai/"
      },
      "models": {
        "gpt-5-codex": {
          "name": "GPT-5 Codex"
        },
        "claude-sonnet-4.5": {
          "name": "Claude Sonnet 4.5"
        }
      }
    }
  }
}

Launch OpenCode, run /connect, choose R9S, and paste the R9S API key. Then use /models to select an R9S-backed model.

Operational notes

  • Prefer model names that have been verified through /v1/models.
  • Keep agent keys scoped and rotated separately from application keys.
  • Use separate API keys per agent team when you need usage attribution.
  • Watch cost and retry behavior before giving agents high autonomy.