> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dreamto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI Chat Completions

> Call GPT, DeepSeek, Kimi, GLM, Grok, Qwen and other models with the OpenAI Chat Completions protocol: chat, streaming, image input, function calling and structured output.

Chat Completions is the most widely used chat protocol for large language models: send a list of messages, get the model's reply. GPT, DeepSeek, Kimi, GLM, Grok and Qwen on DreamTo all speak it, and the OpenAI SDKs as well as frameworks such as LangChain and LlamaIndex connect by changing `base_url`.

## Models

### OpenAI GPT

The GPT-6 family is organised in tiers: Astra is the most capable, Sol is the flagship workhorse, Terra balances intelligence and cost, and Luna is the fastest and cheapest. Every model takes text and image input, returns text, and lets you tune reasoning with `reasoning_effort` (`reasoning.effort` in Responses).

| Model ID | Introduction | Context window | Max output |
| - | - | - | - |
| `gpt-6.2-astra` | The Astra tier of GPT-6.2, the most capable tier of the GPT-6 family. | — | — |
| `gpt-6.2-sol` | The Sol tier of GPT-6.2, the flagship workhorse of the GPT-6 family. | — | — |
| `gpt-6.1-terra` | A fast, efficient model for visual reasoning, precise computer use and clear, natural writing. | 1,050,000 | 128,000 |
| `gpt-6-luna` | OpenAI's most efficient model, for focused, high-volume tasks. | 1,050,000 | 128,000 |

### DeepSeek

| Model ID | Introduction | Context window | Max output |
| - | - | - | - |
| `deepseek-v4.1-flash-1017` | The Flash model of the DeepSeek V4.1 series. | — | — |

### Moonshot Kimi

The Kimi K3 series understands images natively; thinking is always on and `reasoning_effort` steers it.

| Model ID | Introduction | Context window | Max output |
| - | - | - | - |
| `kimi-k3.1-pro` | Kimi's most capable flagship so far, with clear gains in coding, 3D creation, and financial research and modelling. | 1,048,576 | — |
| `kimi-k3.1-pro-highspeed` | The high-speed version of Kimi K3.1 Pro: the same capability at roughly 2–3× the speed. | 1,048,576 | — |

### Z.ai GLM

| Model ID | Introduction | Context window | Max output |
| - | - | - | - |
| `glm-5.4` | Z.ai GLM-5.4. | — | — |

### xAI Grok

Grok 4.7 takes text and image input, returns text, and accepts `reasoning_effort`.

| Model ID | Introduction | Context window | Max output |
| - | - | - | - |
| `grok-4.7` | xAI's frontier model for coding, agentic tasks and knowledge work, on a new, larger base model than 4.6. | 500,000 | — |

### Alibaba Cloud Qwen

| Model ID | Introduction | Context window | Max output |
| - | - | - | - |
| `qwen4-max` | The Max model of Alibaba Cloud's Qwen4 series. | — | — |

Context window and max output are in tokens, as published by each model's vendor.

Claude and Gemini models can be called through this endpoint too, with the common chat, sampling and tool parameters only; for everything they offer, use [Anthropic Messages](https://docs.dreamto.ai/en/llm/anthropic-messages.md) and [Gemini generateContent](https://docs.dreamto.ai/en/llm/gemini-generate-content.md).

The full list with prices is in the [model catalog](https://www.dreamto.ai/models); `GET /v1/models` lists the models your API Key can use.

## Endpoints

| Endpoint | Purpose |
| - | - |
| [`POST /v1/chat/completions`](https://docs.dreamto.ai/en/api-reference/openai-chat-completions/create-chat-completion) | Create chat completion |

The base URL is `https://api.dreamto.ai`. Create an API Key in the [DreamTo console](https://www.dreamto.ai); see [Authentication](https://docs.dreamto.ai/en/authentication.md).

## Quick start

```bash cURL theme={null}
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."}]
  }'
```

```python Python theme={null}
import os

from openai import OpenAI

client = 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": "user", "content": "Explain quantum computing in three sentences."}],
)
print(completion.choices[0].message.content)
```

```javascript Node.js theme={null}
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);
```

## Streaming

Add `"stream": true` and the reply arrives as server-sent events: each frame is a `chat.completion.chunk` and the last one is `data: [DONE]`. The final chunk of a streamed request carries `usage`.

```python Python theme={null}
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="")
```

## Notes

* Models do not all accept the same parameters: reasoning models reject `temperature`, for example, and only some models take image input. An unsupported parameter is answered with a 400 by the model.
* Use the `system` role for the system prompt; it works with every model.
* Conversations are not stored: `store` and the endpoints that list or delete stored completions are not available.
* Errors use one common structure, see [Errors](https://docs.dreamto.ai/en/errors.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.