Point Continue at a custom OpenAI-compatible endpoint.
Updated 2026-07-16
Continue configures models declaratively in config.yaml. Set provider to openai, point apiBase at https://api.apisrouter.com/v1, and every model block you add becomes selectable in the extension, with chat, edit, and apply roles assignable per model under one key.
Quick answer: a model block with provider openai and apiBase.
Continue's openai provider accepts an apiBase override, which is the documented path for any OpenAI-compatible server. Add a model block to config.yaml with provider set to openai, apiBase set to https://api.apisrouter.com/v1, the exact model id, and your key. The model appears in Continue's model selector, and every request it makes goes to the gateway over standard /v1/chat/completions. The same mechanism covers as many models as you want: one block per id, all sharing the same apiBase and key. Because Continue treats the model field as a plain string, ids from different vendors, Claude next to GPT next to DeepSeek, sit side by side in one config file.
models:
- name: Claude Sonnet 4.6
provider: openai
model: claude-sonnet-4-6
apiBase: https://api.apisrouter.com/v1
apiKey: sk-APIsRouter-...
roles:
- chat
- edit
- applyHow Continue assigns work to models: roles.
Continue (continuedev on GitHub, roughly 34K stars) is an IDE agent for VS Code and JetBrains, and its defining config idea is roles. Every model block carries a roles list, and Continue routes each kind of work to a model holding that role: chat for the conversation panel and agent work, edit for inline code transformations, apply for merging proposed changes into files, plus autocomplete, embed, and rerank for their respective subsystems. This is the lever that makes a multi-vendor endpoint interesting in Continue specifically. Chat wants the strongest model you can justify; edit and apply are shorter, more mechanical calls where a fast mid-tier id does the job. With one apiBase serving every vendor, that split is pure YAML: a Claude id holding chat, a fast id holding edit and apply, one key across all of them. One honest boundary: autocomplete is a fill-in-the-middle workload, and Continue's autocomplete role is built around models trained for that completion format rather than chat. A chat-completions gateway is the right home for chat, edit, and apply traffic; keep autocomplete on whatever FIM-capable setup you use today rather than assigning that role to a chat model and expecting good suggestions.
Full setup: several models, split roles, declared context.
The config file lives at ~/.continue/config.yaml. Each block's name is the label shown in the selector; model is the exact id the gateway serves. defaultCompletionOptions.contextLength declares the model's context window, and Continue uses it to decide how much conversation and file context to pack into a request, so leaving it at a conservative default on a long-context model truncates earlier than it should. Capabilities are usually auto-detected, but for ids Continue does not recognize you can state them explicitly: capabilities: [tool_use] tells the agent mode it may drive tools with that model. On keys: the YAML accepts a literal apiKey, which is fine for a local file that never leaves your machine. Continue also supports a secrets template syntax of the form ${{ secrets.APISROUTER_API_KEY }} for configs managed through its hub, which keeps the literal value out of shared files. Use the form that matches where your config lives.
models:
- name: Claude Sonnet 4.6
provider: openai
model: claude-sonnet-4-6
apiBase: https://api.apisrouter.com/v1
apiKey: ${{ secrets.APISROUTER_API_KEY }}
roles: [chat, edit]
capabilities: [tool_use]
defaultCompletionOptions:
contextLength: 200000
- name: Claude Haiku 4.5
provider: openai
model: claude-haiku-4-5-20251001
apiBase: https://api.apisrouter.com/v1
apiKey: ${{ secrets.APISROUTER_API_KEY }}
roles: [edit, apply]
- name: GPT-5.5
provider: openai
model: gpt-5.5
apiBase: https://api.apisrouter.com/v1
apiKey: ${{ secrets.APISROUTER_API_KEY }}
roles: [chat]Choosing models per role.
Role assignment is also the comparison mechanism. Hold edit and apply fixed, swap the chat block between two candidate ids for a week each, and let the per-key usage view price the difference on your real workload. Every candidate is three lines of YAML against the same endpoint.
- chat carries the agent loop and the long conversations: reading files, planning edits, answering questions over real context. A frontier model (claude-sonnet-4-6, gpt-5.5) belongs here, and it is where most of your tokens go.
- edit handles highlighted-code transformations. Calls are shorter and more mechanical than chat, so a fast id like claude-haiku-4-5-20251001 or gpt-5.4-mini keeps the edit loop tight without degrading results.
- apply merges proposed changes into files. It is the most mechanical role of the three and the clearest candidate for the least expensive capable model, deepseek-v4-flash included.
- embed and rerank power codebase retrieval and are separate subsystems with their own model shapes; moving chat traffic to a gateway does not require touching them.
Pay-as-you-go · transparent per-model pricing
Selected models are priced below official list prices. Exact input, output, cache, and per-request prices are shown for each model.
| Model | Official Price | Our Price |
|---|---|---|
| Claude Sonnet 4.6 | $3.00 / $15.00 per M | $2.40 / $12.00 per M |
| Claude Haiku 4.5 20251001 | $1.00 / $5.00 per M | $0.80 / $4.00 per M |
| GPT-5.5 | $5.00 / $30.00 per M | $4.00 / $24.00 per M |
| GPT-5.4 Mini | $0.75 / $4.50 per M | $0.60 / $3.60 per M |
| DeepSeek V4 Flash | $0.14 / $0.28 per M | $0.13 / $0.25 per M |
The failure modes specific to Continue.
apiBase without /v1. Continue appends route paths like /chat/completions to the base you give it, so https://api.apisrouter.com/v1 is correct and the bare host is not. A 404-shaped error on first use is almost always this. YAML indentation silently reshapes config. models is a list of blocks, and a mis-indented apiBase attaches to the wrong entry or to nothing. When one model works and its neighbor cannot authenticate, diff their indentation before suspecting the gateway. The legacy completions toggle. The openai provider defaults to /chat/completions, which is what the gateway serves. useLegacyCompletionsEndpoint: true redirects a block to the legacy /completions route; if a block has it set, chat-shaped requests stop working for that model. Responses-API expectations on GPT-series ids. Some Continue paths can try OpenAI's newer responses protocol for certain OpenAI model names. A chat-completions gateway does not serve that protocol; if a GPT-series block errors in a route-shaped way, set useResponsesApi: false on that block so it stays on /chat/completions. Stale contextLength. Continue packs context according to defaultCompletionOptions.contextLength, not according to what the model could accept. Declaring 32k on a 200k model does not break anything visibly; it just quietly discards context you paid for. Declare what the model actually supports.
Who routes Continue through a gateway.
- IDE-first developers who want Claude, GPT, and DeepSeek selectable inside VS Code or JetBrains without maintaining one credential set per vendor.
- Teams splitting roles by cost profile: frontier chat, fast edit and apply, each role holding the id that fits it, all billed on one surface.
- Engineers comparing chat models on real work. Each candidate is one YAML block against the same apiBase, not a new provider integration.
- Team leads standardizing onboarding: one config.yaml template plus one APISROUTER_API_KEY replaces a per-vendor key checklist, and per-key usage shows what each seat spends.
- Developers without access to a given vendor's billing. Top-up based access with no card requirement removes the sign-up dependency per provider.
Verify the endpoint and debug the first request.
List what the gateway serves before editing YAML; the ids returned by /v1/models are exactly the strings your model fields must match. First-request failures follow a pattern. A 401 means the key in that specific block is wrong, or a secrets reference did not resolve; check the block that failed rather than the file in general, because per-block keys mean per-block failures. A model-not-found error is an id typo, version suffix included. A route-shaped error on a GPT-series id points at the responses-API toggle covered above. And if the extension shows no custom models at all, the YAML did not parse; validate the file structure first. Once requests flow, the APIsRouter console shows per-request model, token counts, and spend. Because Continue splits work across roles, the usage view is also the first place you see the chat-to-edit traffic ratio on your real workload, which is the number that tells you where model choice actually matters.
curl -s https://api.apisrouter.com/v1/models \
-H "Authorization: Bearer $APISROUTER_API_KEY" | head -50FAQ
Can Continue use Claude and DeepSeek models through the openai provider?
Yes. The openai provider with apiBase set is the documented path for any OpenAI-compatible server, and Continue forwards the model field as a plain string. Any id the endpoint serves works, Claude and DeepSeek ids included, one model block per id.
Do all my model blocks share one apiBase and key?
Each block declares its own apiBase and apiKey, so they can share values or not. Pointing several blocks at the same endpoint with the same key is normal, and YAML anchors let you declare the pair once and reference it per block.
Which roles should route through the gateway?
chat, edit, and apply, which all speak /v1/chat/completions. Autocomplete is a fill-in-the-middle workload built around completion-format models, so keep that role on your existing FIM setup. embed and rerank are separate subsystems and need no changes.
Why does one model block work while another returns 401?
Keys are per block in Continue, so a working neighbor proves nothing about the failing block. Check the failing block's apiKey value or secrets reference, and check its indentation: a mis-indented key attaches to the wrong list entry.
What does useLegacyCompletionsEndpoint do and do I need it?
It redirects a model block from /chat/completions to the legacy /completions route. For a chat-completions gateway you do not want it; leave it unset. It exists for older completion-only servers.
Does contextLength actually change behavior?
Yes. Continue packs conversation and file context according to defaultCompletionOptions.contextLength. Understating it on a long-context model silently discards context; set it to what the model genuinely supports.