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
| Format | Base URL | Endpoint | Authentication |
|---|---|---|---|
| OpenAI Chat Completions | https://api.anycap.io/v1 | POST /v1/chat/completions | Authorization: Bearer <key> |
| Anthropic Messages | https://api.anycap.io | POST /v1/messages | x-api-key: <key> and anthropic-version |
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.
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.
{ "$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"}# 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# 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 anycapClaude 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.
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=1claudeTrae, 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 ID | Name |
|---|---|
deepseek-flash | DeepSeek 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.