Coding agents

Introduction

Coding agents can use Anycap as their model endpoint. Anycap exposes an OpenAI-compatible Chat Completions API and an Anthropic-compatible Messages API. Both use the same connection key, preserve streaming and tool calls, and bill the same account per token.

Endpoints

FormatBase URLEndpointAuthentication
OpenAI Chat Completionshttps://api.anycap.io/v1POST /v1/chat/completionsAuthorization: Bearer <key>
Anthropic Messageshttps://api.anycap.ioPOST /v1/messagesx-api-key: <key> and anthropic-version
Use the base URL exactly as shown. OpenAI clients receive /chat/completions appended; Anthropic clients receive /v1/messages appended. The origin-root aliases /chat/completions and /models also work for clients that do not add /v1.

Choose a model

GET /v1/models returns only the models this connection key can call. Use the exact id in the request model field. The list is dynamic: a model appears when its source is available and the key is authorized, so a new model such as V4 Pro needs no client change.

BASH
curl -sS https://api.anycap.io/v1/models \  -H "Authorization: Bearer $ANYCAP_API_KEY"

OpenCode

Save this as opencode.json at the project root (this project only), or to the global config: ~/.config/opencode/opencode.json on macOS/Linux, %USERPROFILE%\.config\opencode\opencode.json on Windows (opencode debug paths prints the resolved locations). The file only declares the provider (endpoint and models) and carries no secret; Anycap is not in the built-in catalog, so it is required once.

JSON
{  "$schema": "https://opencode.ai/config.json",  "provider": {    "anycap": {      "npm": "@ai-sdk/openai-compatible",      "name": "Anycap",      "env": ["ANYCAP_API_KEY"],      "options": {        "baseURL": "https://api.anycap.io/v1"      },      "models": {        "deepseek-flash": { "name": "DeepSeek Flash" }      }    }  },  "model": "anycap/deepseek-flash"}
BASH
# macOS / Linux: ./opencode.json for one project, ~/.config/opencode/opencode.json for allmkdir -p ~/.config/opencodevi ~/.config/opencode/opencode.json    # paste the JSON above # connect the key (TUI: /connect → Anycap)opencode auth login anycap # confirm the model is visibleopencode models | grep anycap
POWERSHELL
# Windows: .\opencode.json for one project, %USERPROFILE%\.config\opencode\opencode.json for allNew-Item -ItemType Directory -Force "$env:USERPROFILE\.config\opencode" | Out-Nullnotepad "$env:USERPROFILE\.config\opencode\opencode.json"   # paste the JSON above # connect the key (TUI: /connect → Anycap)opencode auth login anycap # confirm the model is visibleopencode models | Select-String anycap

Claude Code

Claude Code uses the Anthropic Messages format. Set the base URL without /v1; Claude Code appends /v1/messages. Keep the main and background model variables on the same Anycap model so background tasks do not request an unavailable model.

BASH
export ANYCAP_API_KEY="ac_..."  # your connection keyexport ANTHROPIC_BASE_URL="https://api.anycap.io"export ANTHROPIC_AUTH_TOKEN="$ANYCAP_API_KEY"export ANTHROPIC_MODEL="deepseek-flash"export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-flash"export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-flash"export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-flash"export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1claude

Trae, WorkBuddy and other clients

  • Provider type: OpenAI compatible.
  • Base URL: https://api.anycap.io/v1.
  • API key: the connection key.
  • Model: see the table below.
Model IDName
deepseek-flashDeepSeek Flash

Any OpenAI Chat Completions or Anthropic Messages client works with these values. For an Anthropic client, use https://api.anycap.io as the base URL and the x-api-key header.

Text generation reference →