Continue.dev API Setup Guide (2026): Connect Claude, GPT & Gemini for Less
To connect Continue.dev to Claude, GPT, or Gemini, edit ~/.continue/config.yaml and add a model block with provider: openai, your apiBase URL, and an apiKey — this lets Continue.dev talk to any OpenAI-compatible endpoint, including third-party relays that are cheaper and don't require a US credit card. The rest of this guide walks through the exact syntax, model IDs, and common errors.
Why Configure a Custom API for Continue.dev?
Continue.dev is one of the most popular open-source AI coding assistants for VS Code and JetBrains, competing directly with Copilot and Cline. Out of the box it ships with quick-start options for Anthropic, OpenAI, and a handful of hosted providers, but those official endpoints come with three recurring pain points for developers outside the US: a mandatory credit card on file, per-provider billing dashboards that are hard to reconcile, and inconsistent latency for anyone routing through a VPN. Pointing Continue.dev at an OpenAI-compatible relay instead solves all three — one API key, one bill, and no card requirement — while keeping full access to the latest Claude, GPT, and Gemini models.
Step-by-Step: Editing config.yaml
Continue.dev's current configuration format is config.yaml, stored at ~/.continue/config.yaml on macOS/Linux or %USERPROFILE%\.continue\config.yaml on Windows. Open it (or create it if it doesn't exist) and add a models block:
name: my-continue-config
version: 1.0.0
schema: v1
models:
- name: Claude Sonnet 5
provider: openai
model: claude-sonnet-5
apiBase: https://aisafa.xyz/v1
apiKey: sk-your-key-here
roles:
- chat
- edit
- name: GPT-5.5
provider: openai
model: gpt-5.5
apiBase: https://aisafa.xyz/v1
apiKey: sk-your-key-here
roles:
- chat
- name: Gemini 3 Pro
provider: openai
model: gemini-3-pro
apiBase: https://aisafa.xyz/v1
apiKey: sk-your-key-here
roles:
- chat
Save the file, then reload Continue.dev from the extension's command palette ("Continue: Reload Config") or simply restart the editor. If you're still on the legacy config.json format, the equivalent block uses "title" instead of "name" and a flat array under "models" — both formats accept the same three fields: provider, apiBase, and apiKey.
Model IDs and Provider Settings
Because provider: openai just means "talk OpenAI-compatible HTTP," the actual model routed depends entirely on the model string your relay recognizes. A relay that proxies all three vendors typically exposes model names close to the originals so you don't have to remember custom aliases:
| Use case | Model field | Best Continue.dev role |
|---|---|---|
| Heavy coding / agentic edits | claude-sonnet-5 / claude-opus-4-8 | chat, edit |
| General reasoning | gpt-5.5 | chat |
| Long-context / multimodal | gemini-3-pro | chat |
| Fast autocomplete | claude-fable-5 or a smaller tier | autocomplete |
Set autocomplete to a fast, cheap model separately from your main chat model — Continue.dev calls autocomplete constantly as you type, so using a full-price flagship model there burns tokens fast for no real benefit.
Prompt Caching and Cost Control
If your relay supports Anthropic's prompt caching, Continue.dev benefits automatically: large repeated context (system prompts, pasted files, long conversation history) gets cached server-side and billed at a fraction of normal input-token price on subsequent calls. This matters a lot for coding assistants specifically, because Continue.dev re-sends your open files and recent chat history with almost every request. Combined with routing autocomplete to a cheaper model, prompt caching is typically the single biggest lever for cutting a daily-driver coding-assistant bill.
Common Errors and Fixes
"401 Unauthorized" — the API key wasn't picked up; confirm there's no trailing whitespace and that you reloaded the config after saving. "404 model not found" — the model string doesn't match what your relay exposes; check the provider's model list endpoint or docs rather than guessing. Requests hang or time out — usually a network/proxy issue between your machine and the API host; try the same URL with curl first to isolate whether it's Continue.dev or the connection. Autocomplete feels slow — swap the autocomplete role to a smaller, faster model as shown above; it shouldn't share a model with your main chat role.
If you'd rather skip the trial-and-error of comparing providers, Safa API is built specifically for this workflow: one endpoint and one API key route to Claude, GPT, and Gemini, pricing runs below official rates, prompt caching is fully supported so Continue.dev's repeated context stays cheap, and signup only needs an email — no US credit card, with Alipay accepted for top-ups. Drop https://aisafa.xyz/v1 into the apiBase field above and Continue.dev is ready to go in under five minutes.
Frequently Asked Questions
Does Continue.dev work with any OpenAI-compatible API?
Yes. As long as the endpoint implements the standard /v1/chat/completions (or /v1/messages for native Anthropic format) interface and returns valid streaming responses, Continue.dev will work with it — just set provider: openai and point apiBase at the relay's URL.
Can I use different models for chat, edit, and autocomplete at the same time?
Yes, each model entry in config.yaml can declare one or more roles (chat, edit, autocomplete, embed), and Continue.dev lets you pick which configured model handles each role from the in-editor model selector.
Is it possible to use Continue.dev without a credit card on file?
Yes, if you use a relay provider that accepts alternative payment methods (like Alipay) instead of requiring a card tied to a US billing address — the official Anthropic and OpenAI consumer APIs generally require a card, but OpenAI-compatible relays are not bound by that restriction.
官方直连 · 一个接口接入 Claude / GPT / Gemini · 7×24 稳定
免费注册试用 →