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

# Gemini

> Use native generateContent, streaming, and token-counting endpoints.

## Text generation

Choose a platform model with the `gemini` protocol. Use the gateway root, `x-goog-api-key`, and the Gemini `contents` format. Do not prepend the OpenAI SDK's `/v1` Base URL to a `/v1beta` path.

```bash cURL theme={null}
curl "https://YOUR-REGION.example/v1beta/models/MODEL_ID:generateContent" \
  -H "x-goog-api-key: $CODEFLARE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"contents":[{"role":"user","parts":[{"text":"Hello"}]}],"generationConfig":{"maxOutputTokens":256}}'
```

Replace `MODEL_ID` with the platform ID. URL-encode it as a path segment if it contains special characters. Responses use the native Gemini candidate format.

## Streaming and counting

Use `POST /v1beta/models/MODEL_ID:streamGenerateContent?alt=sse` for streams, with a streaming-compatible route. `POST /v1beta/models/MODEL_ID:countTokens` requires channel support and has no generation charge.

The gateway also accepts `/v1/models/MODEL_ID:ACTION`. `GET /v1beta/models` returns a Gemini-style catalog; `GET /v1/models` keeps the OpenAI format.

## Capability boundaries

Multimodal input, reasoning, tools, and other configuration depend on the model and upstream implementation. A generation endpoint does not imply support for every provider media service. Do not automatically retry requests whose execution is uncertain.


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