OpenAI-Compatible API: One Key for GPT, Gemini and DeepSeek
How DreamTo's OpenAI-compatible LLM API works: base URL, auth, Chat Completions, Responses, Gemini generateContent, streaming, model IDs and errors.

On this page
If your code already uses the OpenAI SDK, pointing it at DreamTo takes two changes: the base URL and the API key. After that, the model string decides which model answers. One key reaches GPT, DeepSeek, Kimi, Grok and Qwen models through Chat Completions, GPT models through Responses, and Gemini models through their native protocol.
The sections below give a working call for each protocol, then cover streaming, model IDs, prices, errors and what the DreamTo API docs mark as not available.
Three protocols on one host#
DreamTo serves language models from https://api.dreamto.ai over three protocols. Pick the one your client already speaks.
| Protocol | Endpoint | Auth header | Use it for |
|---|---|---|---|
| Chat Completions | POST /v1/chat/completions | Authorization: Bearer | GPT, DeepSeek, Kimi, Grok and Qwen models; any OpenAI SDK client |
| Responses | POST /v1/responses | Authorization: Bearer | GPT models, reasoning models, typed streaming events |
| Gemini generateContent | POST /v1beta/models/{model}:generateContent | x-goog-api-key | Gemini models with multimodal input and thinking settings |
The base URL depends on the SDK. The OpenAI SDKs take https://api.dreamto.ai/v1, and the Google GenAI SDKs take the bare host, https://api.dreamto.ai. The SDK quickstart shows the parameter name for each.
Gemini models can also be called through Chat Completions, with the common chat, sampling and tool parameters only. For Gemini 4 Argon the catalog lists reasoning_effort (low, medium, high) on that path, mapped to Gemini's thinking level. For everything else, use the native endpoint, which the catalog marks as the recommended protocol for Argon.
API keys and auth headers#
Create an API key on the API Key page of the DreamTo console. One account can hold several keys, for example one per service or environment. Keep keys on your servers, out of frontend code, mobile app packages and public repositories. If you suspect a leak, delete the key in the console and create a new one.
Send the key in the Authorization header:
Authorization: Bearer {YOUR_API_KEY}The Gemini endpoint also accepts what the Google SDKs send: the x-goog-api-key header or the ?key= query parameter. Both are equivalent to the Bearer header, so send one of the three.
When you read the key from an environment variable or a config file, strip surrounding whitespace and stray quotes. Otherwise the key is treated as invalid, and an invalid key returns HTTP 401. See Authentication.
To see which models a key can use, call GET /v1/models:
curl https://api.dreamto.ai/v1/models \ -H "Authorization: Bearer $DREAMTO_API_KEY"Chat Completions: one request shape across model families#
A Chat Completions request is a list of messages, and the response is the model's reply. This example calls GPT-6.2 Sol, which the docs describe as the flagship workhorse of the GPT-6 family:
curl "https://api.dreamto.ai/v1/chat/completions" \ -H "Authorization: Bearer $DREAMTO_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-6.2-sol", "messages": [{"role": "user", "content": "Explain quantum computing in three sentences."}] }'The same call with the OpenAI Python SDK, with a system prompt added:
import osfrom openai import OpenAIclient = OpenAI( base_url="https://api.dreamto.ai/v1", api_key=os.environ["DREAMTO_API_KEY"],)completion = client.chat.completions.create( model="gpt-6.2-sol", messages=[ {"role": "system", "content": "You answer in plain language."}, {"role": "user", "content": "Explain quantum computing in three sentences."}, ],)print(completion.choices[0].message.content)And with the Node.js SDK:
import OpenAI from "openai";const client = new OpenAI({ baseURL: "https://api.dreamto.ai/v1", apiKey: process.env.DREAMTO_API_KEY,});const completion = await client.chat.completions.create({ model: "gpt-6.2-sol", messages: [{ role: "user", content: "Explain quantum computing in three sentences." }],});console.log(completion.choices[0].message.content);The docs note that the system role works with every model.
Switch models by changing the model string#
The endpoint is shared, so calling another model means changing model. This reuses the Python client from above for the 1017 checkpoint of DeepSeek V4.1 Flash:
resp = client.chat.completions.create( model="deepseek-v4.1-flash-1017", messages=[{"role": "user", "content": "Hi, introduce yourself."}],)print(resp.choices[0].message.content)The model ID is deepseek-v4.1-flash-1017, with a dot in v4.1. The model page slug on the site, deepseek-v4-1-flash-1017, uses hyphens. The API takes the ID, and a model value that does not exist is answered with 404 not_found.
Parameters differ by model, and nothing is stored#
Models do not all accept the same parameters. The docs give two examples: reasoning models reject temperature, and only some models take image input. An unsupported parameter is answered with a 400, so when a request fails after you switch models, check the parameters first.
Conversations are not stored. store and the endpoints that list or delete stored completions are not available, so your application keeps the history and sends it with each request. See the Chat Completions reference.
Responses: typed output items for GPT models#
Responses is OpenAI's newer interface for the GPT family. The input is a string or a list of messages, images and tool results, and the output is a list of typed items: messages, reasoning and function calls. The docs say reasoning models work best here.
curl "https://api.dreamto.ai/v1/responses" \ -H "Authorization: Bearer $DREAMTO_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-6.2-sol", "input": "Explain quantum computing in three sentences." }'With the same Python client:
response = client.responses.create( model="gpt-6.2-sol", input="Explain quantum computing in three sentences.",)print(response.output_text)Reasoning effort is reasoning.effort in Responses and reasoning_effort in Chat Completions. The catalog warns that Sol rejects none as an effort level, so check the request defaults of any client you migrate.
Only the create endpoint, POST /v1/responses, is available. Retrieving, deleting or cancelling a response is not provided, and neither are the input_tokens and compact endpoints. In practice:
- Send the whole conversation in
inputwith every request. Do not rely onprevious_response_id,conversationorbackground. - For multi-turn reasoning, pass the items of the previous
output, includingreasoning, back in the nextinputunchanged. - Use function calling (
type: function) for tools. Built-in tools hosted by OpenAI, such as web search, file search, code interpreter and computer use, are not guaranteed to be available.
Request fields are in the Responses reference.
Gemini generateContent: the native v1beta endpoint#
generateContent is Gemini's native interface, served on the v1beta path. The model ID is part of the URL, the body carries contents, and generationConfig controls the output and thinking. This example calls Gemini 4 Argon, which the docs describe as the efficient Gemini 4 frontier reasoning model, faster than Carbon and with lower token use per turn.
curl "https://api.dreamto.ai/v1beta/models/gemini-4-argon:generateContent" \ -H "x-goog-api-key: $DREAMTO_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "contents": [{"role": "user", "parts": [{"text": "Explain quantum computing in three sentences."}]}] }'With the Google GenAI Python SDK you set the key and the base URL:
import osfrom google import genaiclient = genai.Client( api_key=os.environ["DREAMTO_API_KEY"], http_options={"base_url": "https://api.dreamto.ai"},)response = client.models.generate_content( model="gemini-4-argon", contents="Explain quantum computing in three sentences.",)print(response.text)Three rules from the generateContent reference:
- The model ID belongs in the path only. Do not send a
modelfield in the body. generateContentandstreamGenerateContentare available.countTokens,embedContent, Files, caching (cachedContents) and batch endpoints are not.- Gemini models take text, image, video, audio and PDF input, and thinking is set in
generationConfig.thinkingConfig.
Streaming on each protocol#
All three protocols stream server-sent events. The snippets below reuse the OpenAI client from the Chat Completions section.
Chat Completions. Add "stream": true. Each frame is a chat.completion.chunk and the last one is data: [DONE]. The final chunk of a streamed request carries usage.
stream = client.chat.completions.create( model="gpt-6.2-sol", messages=[{"role": "user", "content": "Write a four-line poem about autumn."}], stream=True,)for chunk in stream: if chunk.choices and chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="")Responses. Also "stream": true, but the events are typed: response.created, response.output_text.delta and others, ending with response.completed, which carries the complete Response object and usage.
stream = client.responses.create( model="gpt-6.2-sol", input="Write a four-line poem about autumn.", stream=True,)for event in stream: if event.type == "response.output_text.delta": print(event.delta, end="")Gemini. Replace :generateContent in the path with :streamGenerateContent?alt=sse. Each data frame is a GenerateContentResponse.
curl -N "https://api.dreamto.ai/v1beta/models/gemini-4-argon:streamGenerateContent?alt=sse" \ -H "x-goog-api-key: $DREAMTO_API_KEY" \ -H "Content-Type: application/json" \ -d '{"contents": [{"role": "user", "parts": [{"text": "Write a four-line poem about autumn."}]}]}'When a request fails after streaming has started, the error appears inside the stream and the HTTP status stays 200. Check the stream for an error as well as the status.
Model IDs you can pass#
Model IDs are exact strings. This table lists IDs that appear in both the API docs and the catalog. For your own key, GET /v1/models is the authority.
| Family | Model ID | What the docs say |
|---|---|---|
| GPT-6.2 | gpt-6.2-astra | The most capable tier of the GPT-6 family |
| GPT-6.2 | gpt-6.2-sol | The flagship workhorse of the GPT-6 family |
| GPT-6.1 | gpt-6.1-terra | Fast and efficient; 1,050,000-token context, 128,000 max output |
| DeepSeek | deepseek-v4.1-flash-1017 | The Flash model of the DeepSeek V4.1 series |
| Kimi | kimi-k3.1-pro | 1,048,576-token context; understands images natively |
| Kimi | kimi-k3.1-pro-highspeed | The same capability as K3.1 Pro at roughly 2–3× the speed |
| Grok | grok-4.7 | 500,000-token context; text and image input |
| Qwen | qwen4-max | The Max model of the Qwen4 series |
| Gemini 4 | gemini-4-carbon, gemini-4-argon, gemini-4-hydrogen | 1,048,576-token context |
Context and output figures are in tokens.
The catalog adds detail on the three models used in this guide:
- GPT-6.2 Sol takes text and image input, supports function calling, and has a 1.05M-token context with 128K output. It is the lower-cost, everyday model of GPT-6.2, while Astra targets the hardest projects.
- Gemini 4 Argon is the general-purpose frontier tier of Gemini 4, with a 1M-token context and
low,mediumorhighthinking. - DeepSeek V4.1 Flash has open weights, image input, a 1M-token context, 384K output, switchable thinking, JSON output and tool choice.
Each has a playground for trying it without code: GPT-6.2 Sol, Gemini 4 Argon and DeepSeek V4.1 Flash. The full list is on the models page. To use these IDs in an editor or a coding agent, see Use DreamTo models in Cursor, Cline, Codex and OpenCode.
Prices for the three models in this guide#
All three are billed per token. As of December 2026, DreamTo's prices in USD per 1M tokens are:
| Model | Input | Cache read | Output |
|---|---|---|---|
gpt-6.2-sol, input up to 272,000 tokens | 0.5 | 0.025 | 2.5 |
gemini-4-argon | 2.4 | 0.12 | 12 |
deepseek-v4.1-flash-1017 | 0.105 | 0.0021 | 0.42 |
Sol has a second tier for requests above 272,000 input tokens: 1 for input, 0.05 for cache read and 3.75 for output. Prices change, and the prices page has the current numbers. For more on one model, read the GPT-6.2 guide or the DeepSeek V4.1 Flash guide.
One error format for every protocol#
The language-model protocols all return the same error structure, so one handler covers every model:
{ "error": { "code": "not_found", "http_status": 404, "message": "The requested model was not found.", "request_id": "req_3f9a1c2b7d4e5f60718293a4", "type": "invalid_request_error" }}Branch on the HTTP status first, then on error.code. The message text is in English and written for people, not for program logic.
| HTTP | error.code | Typical cause | What to do |
|---|---|---|---|
| 400 | invalid_request | Malformed JSON, a missing required field, or a parameter the chosen model does not support | Fix the request as message says and retry |
| 401 | unauthorized | Missing or invalid API key | Check the API key header |
| 402 | insufficient_balance | Insufficient balance | Top up and retry |
| 403 | forbidden | The API key is not allowed to use the model | Contact DreamTo to enable access |
| 404 | not_found | The model does not exist or is not available | Check model |
| 429 | rate_limit_exceeded | Rate limit exceeded | Back off and retry |
| 500 | api_error | Internal error | Retry later |
| 502 / 503 / 504 | service_unavailable | The model is temporarily unavailable or timed out | Retry later |
A few errors come from the model side directly, mostly parameter validation errors. They may carry only code and message, and code may be the numeric status code, so rely on the HTTP status and the X-Request-Id response header. Every response carries that header; include it when you contact support.
4xx errors other than 429 usually need a corrected request. 429 and 5xx can be retried with exponential backoff. The Errors page is the full reference.
Checklist: moving an existing app to DreamTo#
- Set the base URL:
https://api.dreamto.ai/v1for the OpenAI SDKs,https://api.dreamto.aifor the Google GenAI SDKs. - Use your DreamTo API key, stripped of whitespace and quotes.
- Call
GET /v1/modelsand copy the model ID exactly. - Remove parameters the target model rejects, such as
temperatureon reasoning models. - Send the full conversation history with each request.
- If you stream, handle an error that arrives inside a 200 response.
FAQ#
What is the base URL for the DreamTo OpenAI-compatible API?#
OpenAI SDKs use https://api.dreamto.ai/v1, and the Chat Completions endpoint is POST /v1/chat/completions. Google GenAI SDKs take https://api.dreamto.ai without the /v1.
Can I use the OpenAI SDK with GPT, DeepSeek and Kimi models on one key?#
Yes. GPT, DeepSeek, Kimi, Grok and Qwen models all speak Chat Completions on DreamTo, so you change the model string and keep the client. An unsupported parameter is answered with a 400.
Does DreamTo support the Responses API?#
Yes, for GPT models, through POST /v1/responses, with text and image input, streaming and function calling. Retrieving, deleting and cancelling responses are not available, so send the full conversation in input each time.
How do I call Gemini models?#
Use the native endpoint, POST /v1beta/models/{model}:generateContent, with the key in x-goog-api-key and the model ID in the path. Gemini models can also be called through Chat Completions, with the common parameters only.
What does it cost?#
Language models are billed per token. As of December 2026, in USD per 1M tokens, GPT-6.2 Sol costs 0.5 for input and 2.5 for output on requests up to 272,000 input tokens, Gemini 4 Argon 2.4 and 12, and DeepSeek V4.1 Flash 0.105 and 0.42. The prices page has the current figures.


