> ## 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.

# SDK quickstart

> Call DreamTo with the official OpenAI, Anthropic and Google GenAI SDKs: minimal Python, Node.js and cURL examples.

DreamTo is compatible with all three official SDKs. Just change the Base URL to DreamTo and use your DreamTo API key. The examples below read the key from the `DREAMTO_API_KEY` environment variable:

```bash theme={null}
export DREAMTO_API_KEY="sk-xxxx"
```

| SDK | Base URL parameter | Value |
| - | - | - |
| OpenAI (Python / Node.js) | `base_url` / `baseURL` | `https://api.dreamto.ai/v1` |
| Anthropic (Python / Node.js) | `base_url` / `baseURL` | `https://api.dreamto.ai` |
| Google GenAI (Python / Node.js) | `http_options.base_url` / `httpOptions.baseUrl` | `https://api.dreamto.ai` |

## OpenAI SDK

For GPT, DeepSeek, Kimi, GLM, Grok and similar models. Install: `pip install openai` or `npm i openai`.

```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"])

resp = client.chat.completions.create(
    model="deepseek-v4.1-flash-1017",
    messages=[{"role": "user", "content": "Hi, introduce yourself."}],
)
print(resp.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 resp = await client.chat.completions.create({
  model: "deepseek-v4.1-flash-1017",
  messages: [{ role: "user", content: "Hi, introduce yourself." }],
});
console.log(resp.choices[0].message.content);
```

```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": "deepseek-v4.1-flash-1017",
    "messages": [{"role": "user", "content": "Hi, introduce yourself."}]
  }'
```

GPT models can also use the Responses API: `client.responses.create(model="gpt-6.2-sol", input="...")`. See [OpenAI Responses](https://docs.dreamto.ai/en/llm/openai-responses.md).

## Anthropic SDK

For the Claude family. Install: `pip install anthropic` or `npm i @anthropic-ai/sdk`.

```python Python theme={null}
import os
from anthropic import Anthropic

client = Anthropic(base_url="https://api.dreamto.ai", api_key=os.environ["DREAMTO_API_KEY"])

msg = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hi, introduce yourself."}],
)
print(msg.content[0].text)
```

```javascript Node.js theme={null}
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({ baseURL: "https://api.dreamto.ai", apiKey: process.env.DREAMTO_API_KEY });

const msg = await client.messages.create({
  model: "claude-sonnet-5-5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hi, introduce yourself." }],
});
console.log(msg.content[0].text);
```

```bash cURL theme={null}
curl https://api.dreamto.ai/v1/messages \
  -H "x-api-key: $DREAMTO_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5-5",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hi, introduce yourself."}]
  }'
```

## Google GenAI SDK

For the Gemini family. Install: `pip install google-genai` or `npm i @google/genai`.

```python Python theme={null}
import os
from google import genai
from google.genai import types

client = genai.Client(
    api_key=os.environ["DREAMTO_API_KEY"],
    http_options=types.HttpOptions(base_url="https://api.dreamto.ai"),
)

resp = client.models.generate_content(model="gemini-4-hydrogen", contents="Hi, introduce yourself.")
print(resp.text)
```

```javascript Node.js theme={null}
import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({
  apiKey: process.env.DREAMTO_API_KEY,
  httpOptions: { baseUrl: "https://api.dreamto.ai" },
});

const resp = await ai.models.generateContent({ model: "gemini-4-hydrogen", contents: "Hi, introduce yourself." });
console.log(resp.text);
```

```bash cURL theme={null}
curl "https://api.dreamto.ai/v1beta/models/gemini-4-hydrogen:generateContent" \
  -H "x-goog-api-key: $DREAMTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"contents": [{"parts": [{"text": "Hi, introduce yourself."}]}]}'
```

## Next steps

> [card] [OpenAI Chat Completions](https://docs.dreamto.ai/en/llm/openai-chat-completions.md)
>
> All parameters, streaming and function calling.

> [card] [OpenAI Responses](https://docs.dreamto.ai/en/llm/openai-responses.md)
>
> Reasoning effort and typed streaming events.

> [card] [Anthropic Messages](https://docs.dreamto.ai/en/llm/anthropic-messages.md)
>
> Thinking, tool use and prompt caching.

> [card] [Gemini generateContent](https://docs.dreamto.ai/en/llm/gemini-generate-content.md)
>
> Multimodal input, thinking and streaming.


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