API guides

Use DreamTo Models in Cursor, Cline, Codex and OpenCode

Set up Cursor, Cline, Codex CLI and OpenCode with a DreamTo API key: the base URL, the model IDs, the config files from the docs and each tool's limits.

A mechanical keyboard and a cup of coffee on a dark desk, with coloured light rising from the keys
On this page

Cursor, Cline, Codex and OpenCode connect to DreamTo after you change three values: the API address, the key and the model ID. This guide gives the settings for each tool, three model IDs to put in them, and the limits each tool has.

The settings come from the integrations section of the DreamTo docs. Setting names move between tool releases, so if a field has been renamed, check the tool's own documentation.

Create a key and test it first#

Create a key on the API Keys page of the DreamTo console. It looks like sk-xxxx. The docs recommend a separate key per tool, so you can track usage and disable each one independently.

Check the key before you open any editor. List the models it can use:

bash
export DREAMTO_API_KEY="sk-xxxx"curl https://api.dreamto.ai/v1/models \  -H "Authorization: Bearer $DREAMTO_API_KEY"

A 401 means the key is missing, wrong or deleted. Then send one chat request through the endpoint the editors will call:

bash
curl "https://api.dreamto.ai/v1/chat/completions" \  -H "Authorization: Bearer $DREAMTO_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "deepseek-v4.1-flash-1017",    "messages": [{"role": "user", "content": "Reply with the single word: ready"}]  }'

If both calls work, a later failure points to the tool's settings.

Two protocols, one base URL#

The four tools in this guide use two of the protocols DreamTo serves:

ProtocolModelsBase URL to enterWhat the tool calls
OpenAI Chat CompletionsGPT, DeepSeek, Kimi, Grok, Qwen and othershttps://api.dreamto.ai/v1POST /v1/chat/completions
OpenAI ResponsesGPT familyhttps://api.dreamto.ai/v1POST /v1/responses

The base URL is the same for both and includes /v1. The tool appends /chat/completions or /responses itself. The Chat Completions and Responses pages list the models for each protocol.

Three model IDs for coding tools#

Tools ask for the model ID, not the display name. Copy it from the model marketplace or from GET /v1/models. This guide uses three:

Model IDCatalog descriptionInput / output per 1M tokens
gpt-6.2-solThe lower-cost, everyday model of GPT-6.2. Text and image input, 1.05M-token context, 128K output, function calling. Reasoning cannot be set to none.$0.5 / $2.5
kimi-k3.1-pro1M-token context, image input, tool calls and agentic work in thinking mode at low, high or max effort.$1.4 / $7
deepseek-v4.1-flash-1017Open weights, image input, 1M-token context, 384K output, switchable thinking, JSON output and tool choice.$0.105 / $0.42

These are DreamTo's prices as of December 2026. They change, so check /prices before you budget. The gpt-6.2-sol figures apply to requests of up to 272,000 input tokens. Above that the catalog lists $1 input and $3.75 output per 1M tokens, which matters when an agent loads a whole repository into context.

The model pages have the full parameter lists: GPT-6.2 Sol, Kimi K3.1 Pro and DeepSeek V4.1 Flash. Each has a playground, such as the one for DeepSeek V4.1 Flash.

Use deepseek-v4.1-flash-1017 for the first run of a new setup, because a failed test costs the least there. The catalog does not rank the three models against each other, so run the same task on each.

Cursor: override the OpenAI base URL#

Cursor lets you enter your own OpenAI key and override the OpenAI base URL, so chat requests go to DreamTo's Chat Completions endpoint. Whether your own keys and custom models are available depends on your Cursor plan and version.

  1. Open Cursor Settings → Models.
  2. Click Add model (or + Add Custom Model) and enter a model ID such as deepseek-v4.1-flash-1017. It must match the marketplace exactly.
  3. Turn off models you are not using, so Cursor does not route requests to them.
  4. In the API Keys section, fill in these fields:
FieldValue
OpenAI API KeyYour DreamTo key (sk-xxxx)
Override OpenAI Base URLOn, with https://api.dreamto.ai/v1
  1. Click Verify or Save, open Chat with Ctrl/Cmd + L, pick the model you added and send a message.

The docs list five limits of this setup:

  • Only chat features use your key. Tab completion and similar features always use Cursor's own models.
  • Cursor calls your base URL from its own servers, so the address must be publicly reachable. A local proxy address will not work.
  • Cursor sends requests in OpenAI Chat Completions format. The Responses protocol is not used, even for GPT models.
  • Agent mode relies on tool calling, and some models behave differently in third-party mode. If calls fail, try another model.
  • While the override is on, Cursor's built-in OpenAI models are also sent to the DreamTo address. Turn it off when you are not using it.

If your Cursor version has no Override OpenAI Base URL field, it cannot be connected this way. If Verify fails with a 401, turn the override off, paste the base URL and key again, then turn it back on.

Cline and Roo Code: the OpenAI Compatible provider#

Cline and its fork Roo Code are VS Code agent extensions that read and write files and run commands. Both have an OpenAI Compatible provider.

Click the extension icon in the sidebar, open the settings with the gear button, and fill in:

FieldValue
API ProviderOpenAI Compatible
Base URLhttps://api.dreamto.ai/v1
API KeyYour DreamTo key (sk-xxxx)
Modeldeepseek-v4.1-flash-1017

Under Model Configuration, set Context Window size and Max Output Tokens to the model's real figures, and enable image support if the model takes images, as all three models above do. These agents rely on tool calling and long context, and a context window set too low gets the context truncated. The catalog gives a 1.05M-token context and 128K output for GPT-6.2 Sol, and a 1M-token context and 384K output for DeepSeek V4.1 Flash. For Kimi K3.1 Pro it gives a 1M-token context and does not state a maximum output.

Save, then send a small task such as "Explain the currently open file". A normal answer means the setup works.

If tool calls fail or retry in a loop, try a model with stronger tool calling and recheck the context window. If streaming cuts off, check VS Code's http.proxy setting and any corporate gateway that buffers server-sent events.

Codex CLI: a custom provider in config.toml#

Codex calls models over the Responses protocol. The catalog lists /v1/responses for gpt-6.2-sol and not for the DeepSeek or Kimi models, so use gpt-6.2-sol here.

Put the key in an environment variable. Codex reads it by name, so the config file never holds the key:

bash
# Add to ~/.zshrc or ~/.bashrc, then reopen your terminalexport DREAMTO_API_KEY="sk-xxxx"

In Windows PowerShell, setx DREAMTO_API_KEY "sk-xxxx" saves it for new terminals. The Codex desktop app and IDE extensions cannot see a variable you exported in one terminal only, so make it persistent for those.

Then add the provider to ~/.codex/config.toml (%USERPROFILE%\.codex\config.toml on Windows):

toml
model = "gpt-6.2-sol"model_provider = "dreamto"model_reasoning_effort = "medium"[model_providers.dreamto]name = "DreamTo"base_url = "https://api.dreamto.ai/v1"env_key = "DREAMTO_API_KEY"wire_api = "responses"request_max_retries = 3stream_max_retries = 3

Keep the top-level keys above the first [...] table. TOML otherwise assigns them to the table before them. model_provider must name your own [model_providers.<id>] table, and built-in ids such as openai and ollama are reserved. base_url includes /v1 and Codex adds /responses, so writing /v1/responses yourself produces /v1/responses/responses.

Run Codex from a project directory:

bash
codex "List the files in the current directory and explain what this project does"

Type /status in the interactive UI to see the active provider and model.

The catalog says reasoning cannot be set to none on gpt-6.2-sol. Start at medium as the docs do, and try low on a fixed set of tasks to compare quality, time and usage.

A second profile for a cheaper model#

To keep a cheaper setup next to the default, use a profile. In Codex 0.134.0 and later a profile is its own file containing only top-level keys. Create ~/.codex/dreamto-fast.config.toml:

toml
model = "gpt-6.1-terra"model_provider = "dreamto"model_reasoning_effort = "low"

Launch it with codex --profile dreamto-fast. Earlier versions define [profiles.<name>] tables inside config.toml instead. From 0.134.0 those tables and the top-level profile = "..." key are no longer read.

GPT-6.1 Terra is on the docs' list of Responses models. The catalog describes it as tuned for speed and cost. As of December 2026 it lists at $0.25 input and $1.25 output per 1M tokens for requests of up to 272,000 input tokens (see /prices).

A project-level .codex/config.toml ignores model_provider, model_providers and openai_base_url, so set those in the file in your home directory. If streaming hangs, raise stream_max_retries or set stream_idle_timeout_ms on the provider.

OpenCode: a provider in opencode.json#

OpenCode is an open-source terminal coding assistant configured through opencode.json. The file lives at ~/.config/opencode/opencode.json for all projects, or as opencode.json in a project root. If it already exists, merge the provider fields and keep your other settings.

Export DREAMTO_API_KEY in the terminal that starts OpenCode. The config format changed in OpenCode V2, so the docs give two versions. The legacy format has a top-level provider, with npm selecting the AI SDK package and options holding the address and key:

json
{  "$schema": "https://opencode.ai/config.json",  "model": "dreamto/deepseek-v4.1-flash-1017",  "provider": {    "dreamto": {      "npm": "@ai-sdk/openai-compatible",      "name": "DreamTo",      "options": {        "baseURL": "https://api.dreamto.ai/v1",        "apiKey": "{env:DREAMTO_API_KEY}"      },      "models": {        "deepseek-v4.1-flash-1017": { "name": "DeepSeek V4.1 Flash" },        "gpt-6.2-sol": { "name": "GPT-6.2 Sol" },        "kimi-k3.1-pro": { "name": "Kimi K3.1 Pro" }      }    }  }}

The V2 format has a top-level providers, with package selecting the protocol, settings.baseURL the address, and env the environment variable that holds the key:

jsonc
{  "$schema": "https://opencode.ai/config.json",  "model": "dreamto/deepseek-v4.1-flash-1017",  "providers": {    "dreamto": {      "name": "DreamTo",      "env": ["DREAMTO_API_KEY"],      "package": "@opencode/ai/providers/openai-compatible",      "settings": { "baseURL": "https://api.dreamto.ai/v1" },      "models": {        "deepseek-v4.1-flash-1017": { "name": "DeepSeek V4.1 Flash" },        "gpt-6.2-sol": { "name": "GPT-6.2 Sol" },        "kimi-k3.1-pro": { "name": "Kimi K3.1 Pro" }      }    }  }}

The keys under models are the IDs sent to DreamTo and must match the marketplace. name is only the label in the interface. A model entry can also take a limit object with context and output token counts, which helps OpenCode manage context. To call GPT over Responses instead of Chat Completions, change package to @opencode/ai/providers/openai-compatible/responses in V2, or use the @ai-sdk/openai package in the legacy format.

To test, run opencode in your project, type /models, choose a dreamto/... entry and send a message. Models are referenced as provider/model ID. If you once saved credentials for a provider of the same name with /connect, they may take precedence over the environment variable and cause a 401.

Continue and TRAE#

Continue (VS Code and JetBrains) reads ~/.continue/config.yaml. Add a model with provider: openai, model: deepseek-v4.1-flash-1017, apiBase: https://api.dreamto.ai/v1 and your key in apiKey. For GPT reasoning models Continue may switch to /responses by default. DreamTo supports that, and useResponsesApi: false on the model keeps everything on Chat Completions. See the Continue page.

TRAE needs version 3.5.51 or later, which adds a custom request URL. Under Settings → Models → Add Model → Custom Configuration, choose OpenAI Chat Completions, leave Full URL off, and enter https://api.dreamto.ai/v1, your key and the model ID. Turn Auto Mode off, or TRAE may switch to another model while you test. See the TRAE page.

Troubleshooting by status code#

StatusUsual causeFix
401 UnauthorizedKey missing, wrong or deleted, or an old OPENAI_API_KEY in the environment overriding yoursCopy the key again without spaces or quotes and check for stale variables
404 or "model not found"A missing or doubled /v1, or a display name or misspelling used as the model IDUse https://api.dreamto.ai/v1 and copy the ID from the marketplace
400 invalid requestA parameter the chosen model does not supportRead the message field and fix the request
402 insufficient balanceInsufficient balanceTop up and retry

The error reference covers the other status codes. Every response carries an X-Request-Id header. When you contact support, send that value, the request time and the model ID, and never the key.

To use the same key from code, see One API key for every model. For two of the models used here, read DeepSeek V4.1 Flash API and GPT-6.2 API: Sol and Astra.

FAQ#

What base URL do I use for Cursor, Cline and OpenCode?#

Use https://api.dreamto.ai/v1 in all three. The tools append /chat/completions themselves, so do not add it. Codex uses the same base URL and appends /responses.

Which model should I start with in a coding tool?#

Start with deepseek-v4.1-flash-1017. As of December 2026 it costs $0.105 per 1M input tokens and $0.42 per 1M output tokens, the lowest of the three models in this guide. Current rates are on the prices page.

Can Codex use DeepSeek or Kimi through DreamTo?#

Not with the documented setup. The docs configure Codex with wire_api = "responses" and a GPT model ID. DeepSeek and Kimi are listed under Chat Completions, so use them in Cursor, Cline, OpenCode, Continue or TRAE.

Does Cursor use my DreamTo key for tab completion?#

No. Only chat features use your key. Tab completion and similar features always run on Cursor's own models.

Why do I get a 404 when the key is correct?#

Usually the base URL or the model ID is wrong. A missing or doubled /v1 sends the request to a path that does not exist, and a display name or a misspelling is not a valid model ID. Copy the ID from the model marketplace.

  • Coding Tools
  • Cursor
  • Codex
  • LLM API