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

# Gemini generateContent

> Call Gemini models with the Gemini generateContent protocol (v1beta): multimodal input, thinking, streaming, function calling and structured output.

generateContent is Gemini's native interface (v1beta). The model ID is part of the path; the body carries text, images, audio, video and files in `contents`, and `generationConfig` controls the output and thinking. The Google Gen AI SDKs connect by changing the base URL and the API Key.

## Models

Gemini models take text, image, video, audio and PDF input, return text, and support thinking (`generationConfig.thinkingConfig`).

| Model ID | Introduction | Context window | Max output |
| - | - | - | - |
| `gemini-4-carbon` | Google's most capable reasoning model, built for complex software engineering, multimodal knowledge work and science. | 1,048,576 | 65,536 |
| `gemini-4-argon` | The efficient Gemini 4 frontier reasoning model: faster than Carbon, with lower token use per turn. | 1,048,576 | 65,536 |
| `gemini-4-hydrogen` | The fast, efficient Gemini 4 model for everyday coding and agentic workflows. | 1,048,576 | 65,536 |
| `gemini-4-neon` | A Gemini 4 series model. | — | — |

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

Gemini image models (the Nano Banana family) use the same endpoint, see [Image generation](https://docs.dreamto.ai/en/image/models/gemini-3-1-flash-image.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 /v1beta/models/{model}:generateContent`](https://docs.dreamto.ai/en/api-reference/gemini-generate-content/generate-content) | Generate content |
| [`POST /v1beta/models/{model}:streamGenerateContent`](https://docs.dreamto.ai/en/api-reference/gemini-generate-content/stream-generate-content) | Stream generate content |

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/v1beta/models/gemini-4-hydrogen: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."}]}]
  }'
```

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

from google import genai

client = 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-hydrogen",
    contents="Explain quantum computing in three sentences.",
)
print(response.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 response = await ai.models.generateContent({
  model: "gemini-4-hydrogen",
  contents: "Explain quantum computing in three sentences.",
});
console.log(response.text);
```

## Streaming

Replace `:generateContent` in the path with `:streamGenerateContent?alt=sse` and the reply arrives as server-sent events, each data frame a `GenerateContentResponse`.

```bash cURL theme={null}
curl -N "https://api.dreamto.ai/v1beta/models/gemini-4-hydrogen: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."}]}]}'
```

## Notes

* The API Key goes in the `x-goog-api-key` header, the `?key=` query parameter, or `Authorization: Bearer`.
* The model ID belongs in the path only; do not send a `model` field in the body.
* `generateContent` and `streamGenerateContent` are available; `countTokens`, `embedContent`, Files, caching (`cachedContents`) and batch endpoints are not.
* 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.