Skip to content

Coding agents

Any tool that speaks the OpenAI API works here: paste the base URL, an API key and a model ID and you are running. What most tools cannot discover on their own is each model’s real limits — this page gives you a config that fills them in, plus the three settings that prevent the most confusing failures we see in real logs.

The two-minute setup

Every tool asks for the same three things: base URL https://api.clfaigateway.dev/v1, an API key from your dashboard (starts with sk-gw-, sent as a standard Authorization: Bearer header), and a model ID from the table below. All nine models support tool calling and reasoning.

Model IDContext windowReads images
glm-5.31,048,576No
glm-5.3-flash1,048,576Yes
glm-5.2262,144No
glm-4.7-flash131,072No
deepseek-v4-pro1,048,576No
deepseek-v4-flash1,048,576No
kimi-k2.7-code262,144Yes
kimi-k2.6262,144Yes
qwen3.8-27b262,144Yes

Valid reasoning_effort values differ per model — send one the model does not accept and the error message lists the right set. Live pricing for all nine is on the models page.

opencode: fill in what the form cannot

The Custom provider form in opencode only stores model IDs and display names, so every model shows Context limit 0 and no reasoning support — which breaks auto-compaction and hides thinking. Paste this into ~/.config/opencode/opencode.jsonc instead (or merge the provider block into your existing file), then restart opencode:

~/.config/opencode/opencode.jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "clf-gateway": {
      "name": "CLF AI Gateway",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://api.clfaigateway.dev/v1"
      },
      "models": {
        "glm-5.3": {
          "name": "GLM 5.3",
          "attachment": false,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "limit": { "context": 1048576, "output": 32768 }
        },
        "glm-5.3-flash": {
          "name": "GLM 5.3 Flash",
          "attachment": true,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "limit": { "context": 1048576, "output": 32768 }
        },
        "glm-5.2": {
          "name": "GLM 5.2",
          "attachment": false,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "limit": { "context": 262144, "output": 32768 }
        },
        "glm-4.7-flash": {
          "name": "GLM 4.7 Flash",
          "attachment": false,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "limit": { "context": 131072, "output": 32768 }
        },
        "deepseek-v4-pro": {
          "name": "DeepSeek V4 Pro",
          "attachment": false,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "limit": { "context": 1048576, "output": 32768 }
        },
        "deepseek-v4-flash": {
          "name": "DeepSeek V4 Flash",
          "attachment": false,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "limit": { "context": 1048576, "output": 32768 }
        },
        "kimi-k2.7-code": {
          "name": "Kimi K2.7 Code",
          "attachment": true,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "limit": { "context": 262144, "output": 32768 }
        },
        "kimi-k2.6": {
          "name": "Kimi K2.6",
          "attachment": true,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "limit": { "context": 262144, "output": 32768 }
        },
        "qwen3.8-27b": {
          "name": "Qwen 3.8 27B",
          "attachment": true,
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "limit": { "context": 262144, "output": 32768 }
        }
      }
    }
  }
}

Add your key through the API-key field of the provider form or opencode auth — it lives in opencode’s own auth store, not in this file. Hover a model in the picker to confirm: it should now show the real context limit and reasoning support.

Cline, Cursor, aider and friends

The same three values work everywhere; the only extra step worth taking is telling the tool the model’s context size and output budget wherever it lets you:

  • Cline / Roo Code: choose the "OpenAI Compatible" provider, paste base URL + key + model ID, and fill the context-window and max-output fields from the table above.
  • Cursor: Settings → Models → override the OpenAI base URL with the gateway’s, paste your key, and add the model IDs as custom models.
  • aider: pass the base URL and key on the command line:
aider
aider --openai-api-base https://api.clfaigateway.dev/v1 \
      --openai-api-key sk-gw-... \
      --model openai/glm-5.3

Three settings that prevent confusing failures

  • Give the model room to answer after it thinks. Reasoning is spent from the same max_tokens budget as the answer, and on 100K+ prompts these models can think for thousands of tokens first. If your tool sets max_tokens itself, make it 8,000 or more for agentic work; if it sends nothing, the gateway defaults to 32,768 and you are fine. Details on the streaming page.
  • A long first-token wait is not a hang. A 250K-token prompt spends ~20 seconds in prefill before anything streams, then the model may think for minutes before visible text. Keep client read timeouts at 60 s or more and turn on reasoning display if your tool has it — in our logs the most common "hang" is a client giving up mid-think.
  • Only four models read images. Attach images only on the models marked Yes above — the others return a named 400 vision_not_available before you are charged anything. The full comparison is on the vision page.

Cost shown inside your tool is an estimate

Coding agents compute cost from whatever price table they were given, which drifts when promos change. The billed number for every request — down to the token — is in your dashboard under Logs, and live per-model pricing is on the models page.