Using Coding Agents

Step-by-step setup for Kilo Code, Cline, Cursor, opencode, Claude Code, Continue, and Aider.

On this page

Using Coding Agents#

Clean APIs is OpenAI-compatible and supports streaming, tool calling, and vision — everything an autonomous coding agent needs. Any tool that lets you point at a custom OpenAI endpoint will work.

The three values every tool needs

Setting Value
Provider type OpenAI Compatible
Base URL https://cleanapis.com/v1
API Key your cc_… key
Model ID any ID from GET /v1/models

Pick a model with the Tools capability, otherwise the agent can read but not edit files. Check the Models page — capabilities are listed on every card.


Kilo Code#

VS Code extension.

  1. Open the Kilo Code panel and click the settings gear
  2. API Provider → OpenAI Compatible
  3. Base URL → https://cleanapis.com/v1
  4. API Key → your cc_… key
  5. Model → e.g. claude-opus-4.8
  6. Save, then start a new task

Kilo Code calls GET /v1/models before its first message, so your key needs the models:read scope (enabled by default). It reads architecture.input_modalities from that response to decide whether it may attach screenshots — vision-capable models are detected automatically.

If a model appears but images are refused, the model does not advertise the vision capability. Switch models rather than changing settings.


Cline#

VS Code extension, same family as Kilo Code.

  1. Click the Cline icon, then the settings gear
  2. API Provider → OpenAI Compatible
  3. Base URL → https://cleanapis.com/v1
  4. API Key → your cc_… key
  5. Model ID → e.g. claude-opus-4.8

Cline streams aggressively and cancels requests when you interrupt it. That is handled correctly — usage is still billed for tokens the provider actually generated, and never for a request that failed before reaching the model.


Cursor#

  1. Settings → Models
  2. Scroll to OpenAI API Key and enable Override OpenAI Base URL
  3. Base URL → https://cleanapis.com/v1
  4. Paste your cc_… key
  5. Click Verify, then add a custom model name matching an ID from /v1/models

Cursor expects the model name you type to exist upstream, so copy the exact model_id — for example claude-opus-4.8.


opencode#

Terminal-based agent. Add a provider block to your config (~/.config/opencode/opencode.json):

{
  "provider": {
    "cleanapis": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Clean APIs",
      "options": {
        "baseURL": "https://cleanapis.com/v1",
        "apiKey": "cc_your_key_here"
      },
      "models": {
        "claude-opus-4.8": {
          "name": "claude-opus-4.8"
        }
      }
    }
  }
}

Then select the model inside opencode with /models.

Prefer an environment variable over committing the key:

"apiKey": "{env:CODECRAFT_API_KEY}"

Claude Code#

Claude Code speaks the Anthropic protocol, so point it at our Anthropic-compatible surface using its standard environment variables:

export ANTHROPIC_BASE_URL=https://cleanapis.com/v1
export ANTHROPIC_AUTH_TOKEN=cc_your_key_here
export ANTHROPIC_MODEL=claude-opus-4.8

claude

Our API accepts the key as either Authorization: Bearer … or x-api-key: …, which is what Anthropic-style clients send — no proxy needed.

Add the exports to your ~/.bashrc, ~/.zshrc, or PowerShell profile to make them permanent.


OpenClaw#

OpenClaw runs in the browser, so its requests are subject to CORS. Cross-origin requests are allowed on /v1/*, so it connects directly:

  1. Open settings → Model provider
  2. Choose Custom / OpenAI compatible
  3. API base → https://cleanapis.com/v1
  4. API key → your cc_… key
  5. Model → an ID from /v1/models

Because a browser-side key is visible to anyone using that browser profile, create a dedicated key for it and revoke it if the machine is shared.


Continue#

Add to ~/.continue/config.json:

{
  "models": [
    {
      "title": "Clean APIs",
      "provider": "openai",
      "model": "claude-opus-4.8",
      "apiBase": "https://cleanapis.com/v1",
      "apiKey": "cc_your_key_here"
    }
  ]
}

Aider#

export OPENAI_API_BASE=https://cleanapis.com/v1
export OPENAI_API_KEY=cc_your_key_here

aider --model openai/claude-opus-4.8

The openai/ prefix tells Aider to route through the OpenAI-compatible path.


Any other tool#

If a tool accepts a custom OpenAI endpoint, it works. Three things to check:

  1. Base URL ends in /v1 — not /v1/chat/completions
  2. The key is sent as Authorization: Bearer cc_… (or x-api-key)
  3. The model ID exactly matches one from GET /v1/models

Verify your setup from a terminal before blaming the tool:

curl https://cleanapis.com/v1/models \
  -H "Authorization: Bearer cc_your_key_here"

A JSON list of models means your URL and key are correct.


Choosing a model for agent work#

What you need Look for capability
Editing files, running commands tools
Reading screenshots, mockups, diagrams vision
Debugging, architecture, algorithms reasoning
Live token-by-token output streaming

Context window matters as much as capability: agents send whole files, so prefer a large context model for real codebases. Both are shown on every card in the Models catalog.


Long sessions#

Streaming connections stay open for up to one hour, with a keep-alive comment every 15 seconds so proxies do not drop an idle connection. Extended refactors and multi-step tasks will not be cut off mid-flight.

If you self-host behind Apache or nginx, raise the server timeout to match — otherwise the web server, not us, ends the connection:

# Apache
Timeout 3700
ProxyTimeout 3700
# nginx
proxy_read_timeout 3700s;
proxy_buffering off;

proxy_buffering off matters for nginx: with buffering on, streamed chunks are held back and the agent appears to hang.


Troubleshooting#

"Response ended unexpectedly" / stream stops instantly The tool expects streaming but something between you and us is buffering. Check X-Accel-Buffering is not stripped and, on nginx, that proxy_buffering is off.

Empty responses from a reasoning model Reasoning tokens count toward the completion budget. We raise anything under 2048 and default to 8192, but a hard task may need more — set max_tokens to 16000+ in the tool's settings.

HTTP 401 The key is missing, malformed, or revoked. Keys start with cc_ and are shown only once; if you lost it, rotate the key from Dashboard → API Keys.

HTTP 403 insufficient_scope The key lacks a scope the tool needs. Most agents call /v1/models first, so keep models:read enabled.

HTTP 404 model_not_found The model ID is wrong, or the model is not available to you. List valid IDs with GET /v1/models.

HTTP 402 Out of plan allowance and balance. Top up or upgrade — nothing is charged for the rejected request.

HTTP 429 You hit your plan's per-minute request or token limit. The Retry-After header says how long to wait; Dashboard → Usage → Rate Limits shows live consumption.

"Cannot read image" / image refused The selected model has no vision capability. Pick one that does.

Still stuck?

Open a support ticket from your dashboard and we'll take a look.

Get help