Skip to content
RunAPI Developer Docs
Developer Resources
Developer Resources

Claude Code

Install Claude Code, connect it to RunAPI, choose a model, and verify the configuration.

Overview

Claude Code is an agentic coding tool for the terminal. This guide installs the CLI, points its Anthropic-compatible requests at RunAPI, selects a RunAPI model, and verifies the connection.

Before you begin

Install

Use the official native installer on macOS, Linux, or WSL, then confirm the command is available:

SHELL
curl -fsSL https://claude.ai/install.sh | bash
claude --version

For Homebrew, WinGet, and platform-specific requirements, use the official installation guide.

Configure RunAPI

For a first test, export the Base URL, API key, and model in the current shell:

SHELL
export ANTHROPIC_BASE_URL=https://runapi.ai
export ANTHROPIC_API_KEY=YOUR_RUNAPI_API_KEY
export ANTHROPIC_MODEL=YOUR_RUNAPI_MODEL_ID

To apply the values to every Claude Code session for your user, put them in the env object in ~/.claude/settings.json:

JSON
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://runapi.ai",
    "ANTHROPIC_API_KEY": "YOUR_RUNAPI_API_KEY",
    "ANTHROPIC_MODEL": "YOUR_RUNAPI_MODEL_ID"
  }
}

Keep the real key out of .claude/settings.json, which is intended for project settings that may be committed. For configuration scopes and precedence, use the Claude Code settings reference.

Choose a model

Replace YOUR_RUNAPI_MODEL_ID with the exact identifier from the Model Catalog. ANTHROPIC_BASE_URL changes where requests are sent; it does not choose a model. You can also start one session with claude --model YOUR_RUNAPI_MODEL_ID or run /model during a session.

Verify

Run the installation and configuration checks, then send one short prompt:

SHELL
claude --version
claude doctor
claude

Inside Claude Code, run /status to confirm the loaded settings and active model. A normal response to Describe this repository in one sentence. confirms that the RunAPI connection works.

Troubleshoot

  • claude is not found: reopen the terminal and follow the official install troubleshooting.
  • Settings do not load: validate ~/.claude/settings.json with claude doctor, then use /status to inspect the loaded sources.
  • Authentication fails: confirm ANTHROPIC_API_KEY contains an active RunAPI key. Create or rotate keys through the Authentication Guide.
  • The model is unavailable: copy the exact identifier from the Model Catalog, then start a new session. Resumed sessions may retain their previous model.
  • Requests use another endpoint: start a fresh terminal after changing environment variables and check for a higher-precedence Claude Code setting.

Next steps

Use the LLM API quickstart for protocol behavior and the Anthropic Messages API Reference for request fields. To add RunAPI tools to Claude Code, continue with the MCP Overview.