Skip to main content

Overview

Claude Code is Anthropic’s official command-line tool that brings Claude’s intelligence directly into your terminal. It can understand your codebase, edit files, run commands, and help you build software faster. By connecting Claude Code CLI to FoxAPI, you can access Claude’s full capabilities through FoxAPI’s reliable API infrastructure.
FoxAPI provides a dedicated endpoint optimized for Claude Code CLI traffic. Use https://aicode.cookai.cc as the base URL for the best experience.

Prerequisites

FoxAPI API Key

You need an active FoxAPI API key with access to Claude models.

Node.js 18+

Required for installing Claude Code CLI via npm. Alternatively, you can use the curl-based installer.

Installation & Configuration

1

Install Claude Code CLI

Choose your preferred installation method:Verify the installation:
claude --version
2

Configure FoxAPI API

You need to configure Claude Code to route requests through FoxAPI. Create or edit the Claude Code settings file:
Edit ~/.claude/settings.json:
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "sk-your-foxapi-api-key",
    "ANTHROPIC_BASE_URL": "https://aicode.cookai.cc",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}
The CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC setting is required. It prevents Claude Code from sending telemetry and other non-essential requests directly to Anthropic’s servers, which would fail without a direct Anthropic API key.
3

Start Using Claude Code

Launch Claude Code in your project directory:
cd /path/to/your/project
claude
This opens an interactive session where you can chat with Claude about your codebase.You can also run one-off commands:
claude "Explain the architecture of this project"

Verify the Connection

Run the following command to confirm Claude Code is correctly routing through FoxAPI:
claude "Who are you? Please confirm you are working."
If configured correctly, Claude will respond with information about itself. If you see an error, check the Troubleshooting section below.

Usage Examples

claude "Give me an overview of this project's architecture"
claude "There's a bug in the login flow where users get redirected to a 404 page after authentication. Find and fix it."
claude "Write unit tests for the UserService class"
claude "Refactor the database queries in src/repositories to use parameterized queries"

Troubleshooting

  • Double-check your ANTHROPIC_AUTH_TOKEN value. It should be your FoxAPI API key (starts with sk-).
  • Ensure your API key has not expired and has sufficient balance.
  • Verify the key has access to Claude models on your FoxAPI account.
  • Verify ANTHROPIC_BASE_URL is set to https://aicode.cookai.cc (no trailing slash).
  • Check your network connection and ensure you can reach aicode.cookai.cc.
  • If you are behind a corporate proxy, ensure the proxy allows HTTPS traffic to aicode.cookai.cc.
  • Make sure CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC is set to 1.
  • If using settings.json, ensure the JSON syntax is valid (no trailing commas, proper quoting).
  • Restart your terminal after making changes to environment variables or settings.
  • Confirm the file is located at ~/.claude/settings.json (not inside your project directory).
  • Validate the JSON format using a tool like jq:
    cat ~/.claude/settings.json | jq .
    
  • Ensure there are no conflicting environment variables set in your shell profile that might override the settings file.

Security Best Practices

  • Never commit your API key to version control. If using environment variables, add them to your shell profile rather than project files.
  • Use project-scoped keys when possible. FoxAPI allows you to create multiple API keys — use a dedicated key for Claude Code so you can revoke it independently if needed.
  • Monitor usage on your FoxAPI dashboard to detect any unexpected consumption.