---
title: Gemini Stream inhoud genereren | RunAPI
description: Stuur een verzoek via de Gemini-compatibele Stream Generate Content-bewerking
  van RunAPI.
url: https://runapi.ai/nl/docs/api/gemini/stream-generate-content.md
canonical: https://runapi.ai/nl/docs/api/gemini/stream-generate-content
locale: nl
---

> HTML-versie: https://runapi.ai/nl/docs/api/gemini/stream-generate-content
> Site-index voor agents: https://runapi.ai/llms.txt

# Gemini Stream inhoud genereren

## Overzicht

Gebruik RunAPI's Gemini-compatibele Stream Generate Content-bewerking met een compatibel model en de verzoek- en antwoordstructuren van het protocol.

### Snelstart

1. Maak een API-sleutel aan en stel deze in als RUNAPI_API_KEY.
2. Kies een compatibel model en stuur de gedocumenteerde padparameters en JSON-body.
3. Lees de JSON-respons of server-sent events die voor deze bewerking worden weergegeven, en handel protocollfouten af.

## Eindpunt

POST /v1beta/models/{model}:streamGenerateContent?alt=sse

Basis-URL: https://runapi.ai

Contractversie: v1

Voorkeursauthenticatie: x-goog-api-key: YOUR_API_TOKEN

## Authenticatiedragers

RunAPI accepteert elke hieronder vermelde carrier. Gegenereerde voorbeelden gebruiken de voorkeurskoptekst van het protocol.

- `Authorization: Bearer YOUR_API_TOKEN`
- `x-api-key: YOUR_API_TOKEN`
- `x-goog-api-key: YOUR_API_TOKEN` (Voorkeur)
- `?key=YOUR_API_TOKEN`

## Compatibele modellen

Open een modelpagina voor actuele prijzen, snelheidslimieten en details over commercieel gebruik.

- [claude-fable-5-1](https://runapi.ai/nl/models/claude)
- [claude-fable-5](https://runapi.ai/nl/models/claude)
- [claude-sonnet-5](https://runapi.ai/nl/models/claude)
- [claude-opus-5](https://runapi.ai/nl/models/claude)
- [claude-opus-4-8](https://runapi.ai/nl/models/claude)
- [claude-opus-4-7](https://runapi.ai/nl/models/claude)
- [claude-opus-4-6](https://runapi.ai/nl/models/claude)
- [claude-sonnet-4-6](https://runapi.ai/nl/models/claude)
- [claude-opus-4-5-20251101](https://runapi.ai/nl/models/claude)
- [claude-sonnet-4-5-20250929](https://runapi.ai/nl/models/claude)
- [claude-haiku-4-5-20251001](https://runapi.ai/nl/models/claude)
- [claude-opus-4-1-20250805](https://runapi.ai/nl/models/claude)
- [gpt-5.5](https://runapi.ai/nl/models/gpt)
- [gpt-5.5-pro](https://runapi.ai/nl/models/gpt)
- [gpt-5.4](https://runapi.ai/nl/models/gpt)
- [gpt-5.4-mini](https://runapi.ai/nl/models/gpt)
- [gpt-5.4-nano](https://runapi.ai/nl/models/gpt)
- [gpt-5.4-pro](https://runapi.ai/nl/models/gpt)
- [gpt-5.3-codex](https://runapi.ai/nl/models/gpt)
- [gpt-5.3-codex-spark](https://runapi.ai/nl/models/gpt)
- [gpt-5.2](https://runapi.ai/nl/models/gpt)
- [gpt-5.6-luna](https://runapi.ai/nl/models/gpt)
- [gpt-5.6-sol](https://runapi.ai/nl/models/gpt)
- [gpt-5.6-terra](https://runapi.ai/nl/models/gpt)
- [gpt-6-astra](https://runapi.ai/nl/models/gpt)
- [gemini-3.7-flash](https://runapi.ai/nl/models/gemini)
- [gemini-3.6-flash](https://runapi.ai/nl/models/gemini)
- [gemini-3.5-flash](https://runapi.ai/nl/models/gemini)
- [gemini-3.1-pro-preview](https://runapi.ai/nl/models/gemini)
- [gemini-3-flash-preview](https://runapi.ai/nl/models/gemini)
- [gemini-2.5-pro](https://runapi.ai/nl/models/gemini)
- [gemini-2.5-flash](https://runapi.ai/nl/models/gemini)
- [deepseek-v4-flash-vision-exp](https://runapi.ai/nl/models/deepseek)
- [deepseek-v4-pro](https://runapi.ai/nl/models/deepseek)
- [deepseek-v4-flash](https://runapi.ai/nl/models/deepseek)
- [glm-5.2](https://runapi.ai/nl/models/glm)
- [glm-5.1](https://runapi.ai/nl/models/glm)
- [glm-5-turbo](https://runapi.ai/nl/models/glm)
- [glm-5](https://runapi.ai/nl/models/glm)
- [glm-4.7](https://runapi.ai/nl/models/glm)
- [glm-4.6](https://runapi.ai/nl/models/glm)
- [glm-4.5](https://runapi.ai/nl/models/glm)
- [glm-4.5-air](https://runapi.ai/nl/models/glm)
- [kimi-k3](https://runapi.ai/nl/models/kimi)
- [kimi-k2.7-code](https://runapi.ai/nl/models/kimi)
- [kimi-k2.6](https://runapi.ai/nl/models/kimi)
- [kimi-k2.5](https://runapi.ai/nl/models/kimi)
- [MiniMax-M3](https://runapi.ai/nl/models/minimax)
- [MiniMax-M2.7](https://runapi.ai/nl/models/minimax)
- [MiniMax-M2.7-highspeed](https://runapi.ai/nl/models/minimax)
- [MiniMax-M2.5](https://runapi.ai/nl/models/minimax)
- [MiniMax-M2.5-highspeed](https://runapi.ai/nl/models/minimax)
- [MiniMax-M2.1](https://runapi.ai/nl/models/minimax)
- [MiniMax-M2](https://runapi.ai/nl/models/minimax)
- [grok-4.5](https://runapi.ai/nl/models/grok)
- [grok-4.3](https://runapi.ai/nl/models/grok)

## Verzoekcontract

Alleen velden met zowel openbaar protocol als bewijs van RunAPI-ondersteuning worden vermeld. Aanvullende JSON-bodyvelden worden doorgegeven.

### JSON-body

Vereist: `contents`

```json
{
  "contents": {
    "description": "Gespreksinhoud in Gemini Content- en Part-indeling.",
    "type": "array"
  },
  "generationConfig": {
    "description": "Gemini-generatieconfiguratie voor de aanvraag.",
    "type": "object"
  },
  "systemInstruction": {
    "description": "Systeeminstructies weergegeven als Gemini Content.",
    "type": "object"
  },
  "tools": {
    "description": "Tools die het model kan aanroepen.",
    "type": "array"
  }
}
```

### Padparameters

Vereist: `model`

```json
{
  "model": {
    "description": "RunAPI-modelidentificator in het wire-pad geplaatst.",
    "type": "string"
  }
}
```

### Verzoekvoorbeeld

```json
{
  "contents": [
    {
      "parts": [
        {
          "text": "Summarize one practical improvement for an API deployment."
        }
      ],
      "role": "user"
    }
  ]
}
```

## SSE-event: chunk

Mediatype: `text/event-stream`

### Schema

```json
{
  "additionalProperties": true,
  "properties": {
    "candidates": {
      "items": {
        "additionalProperties": true,
        "properties": {
          "content": {
            "additionalProperties": true,
            "properties": {
              "parts": {
                "type": "array"
              },
              "role": {
                "type": "string"
              }
            },
            "type": "object"
          },
          "finishReason": {
            "type": "string"
          },
          "index": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "modelVersion": {
      "type": "string"
    },
    "responseId": {
      "type": "string"
    },
    "usageMetadata": {
      "additionalProperties": true,
      "properties": {
        "candidatesTokenCount": {
          "type": "integer"
        },
        "promptTokenCount": {
          "type": "integer"
        },
        "totalTokenCount": {
          "type": "integer"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
```

### Voorbeeld

```json
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "text": "Hello"
          }
        ],
        "role": "model"
      },
      "finishReason": "STOP",
      "index": 0
    }
  ],
  "modelVersion": "gemini-3.5-flash",
  "responseId": "resp_example",
  "usageMetadata": {
    "candidatesTokenCount": 8,
    "promptTokenCount": 12,
    "totalTokenCount": 20
  }
}
```

## Protocolfout: invalid_request

HTTP 400

### Schema

```json
{
  "additionalProperties": true,
  "properties": {
    "error": {
      "additionalProperties": true,
      "properties": {
        "code": {
          "type": "integer"
        },
        "message": {
          "type": "string"
        },
        "status": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message",
        "status"
      ],
      "type": "object"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}
```

### Voorbeeld

```json
{
  "error": {
    "code": 400,
    "message": "contents is required",
    "status": "INVALID_ARGUMENT"
  }
}
```

## Gebruik

### Schema

```json
{
  "additionalProperties": true,
  "properties": {
    "candidatesTokenCount": {
      "type": "integer"
    },
    "promptTokenCount": {
      "type": "integer"
    },
    "totalTokenCount": {
      "type": "integer"
    }
  },
  "type": "object"
}
```

### Voorbeeld

```json
{
  "candidatesTokenCount": 8,
  "promptTokenCount": 12,
  "totalTokenCount": 20
}
```

## Gegenereerde codevoorbeelden

Elk cURL-, JavaScript- en Python-voorbeeld verstuurt de gevalideerde aanvraag uit dit contract zonder dat een protocolspecifieke SDK vereist is.

### curl

```curl
curl -X POST https://runapi.ai/v1beta/models/gemini-3.5-flash:streamGenerateContent\?alt\=sse \
  -H x-goog-api-key:\ YOUR_API_TOKEN \
  -H Content-Type:\ application/json \
  -d \{\"contents\":\[\{\"role\":\"user\",\"parts\":\[\{\"text\":\"Summarize\ one\ practical\ improvement\ for\ an\ API\ deployment.\"\}\]\}\]\}
```

### javascript

```javascript
const response = await fetch("https://runapi.ai/v1beta/models/gemini-3.5-flash:streamGenerateContent?alt=sse", {
  method: "POST",
  headers: {
  "x-goog-api-key": "YOUR_API_TOKEN",
  "Content-Type": "application/json"
},
  body: JSON.stringify({
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Summarize one practical improvement for an API deployment."
        }
      ]
    }
  ]
})
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
  const { value, done } = await reader.read();
  if (done) break;
  console.log(decoder.decode(value, { stream: true }));
}
```

### python

#### Installeren

```bash
pip install requests
```

```python
import requests

response = requests.post(
    "https://runapi.ai/v1beta/models/gemini-3.5-flash:streamGenerateContent?alt=sse",
    headers={"x-goog-api-key": "YOUR_API_TOKEN", "Content-Type": "application/json"},
    json={"contents": [{"role": "user", "parts": [{"text": "Summarize one practical improvement for an API deployment."}]}]},
    stream=True
)
response.raise_for_status()
for line in response.iter_lines(decode_unicode=True):
    if line:
        print(line)
```

## Gerelateerde handleidingen

- [Authenticatie](https://runapi.ai/nl/docs/guides/authentication.md)
- [Snelstart](https://runapi.ai/nl/docs/guides/llm-api/quickstart.md)

---

## Meer van RunAPI

- [Home](https://runapi.ai/nl/.md)
- [Modelcatalogus](https://runapi.ai/nl/models.md)
- [Prijzen](https://runapi.ai/nl/pricing.md)
- [Providers](https://runapi.ai/nl/models)
- [Documentatie](https://runapi.ai/nl/docs/guides)
- [SDK's](https://runapi.ai/nl/sdk.md)
- [CLI](https://runapi.ai/nl/cli.md)
- [MCP Server](https://runapi.ai/nl/mcp.md)
- [Claude Code vs Cursor](https://runapi.ai/nl/claude-code-vs-cursor.md)
- [Cursor API instellen](https://runapi.ai/nl/cursor-api-setup.md)
- [RunAPI vs OpenRouter](https://runapi.ai/nl/openrouter-alternative.md)
- [Enterprise](https://runapi.ai/nl/contact.md)
- [Contact](https://runapi.ai/nl/contact.md)
- [Voorwaarden](https://runapi.ai/nl/terms.md)
- [Privacy](https://runapi.ai/nl/privacy.md)
- [Site-index voor agents](https://runapi.ai/llms.txt)

Contact: contact@runapi.ai

## Gestructureerde gegevens

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "nl",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/nl",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/nl/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "nl",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/nl",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/nlicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "nl",
    "@type": "TechArticle",
    "headline": "Gemini Stream inhoud genereren",
    "description": "Stuur een verzoek via de Gemini-compatibele Stream Generate Content-bewerking van RunAPI.",
    "url": "https://runapi.ai/nl/docs/api/gemini/stream-generate-content",
    "mainEntityOfPage": "https://runapi.ai/nl/docs/api/gemini/stream-generate-content"
  }
]
```
