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

# Text Generation

> POST /v1/generate — synchronous LLM, speech-to-text, image-to-text, and video-to-text.

## Endpoint

```
POST /v1/generate
```

Returns the result **immediately** — no polling needed.

<Note>
  **Which endpoint to use for LLM?** Check `capabilities.endpoint` from `GET /v1/models`:

  * Standard chat models (GPT-*, Gemini-*, etc.) have `"endpoint": "/v1/chat/completions"` — use `POST /v1/chat/completions` with `messages[]` (OpenAI-compatible format).
  * Some LLM models and all non-LLM models (STT, OCR, caption) have `"endpoint": "/v1/generate"` — use this endpoint with a `prompt` field.

  For image generation use [`POST /v1/images/generations`](/docs/api/images).
</Note>

## Request

<ParamField header="Authorization" type="string" required>
  `Bearer <your-token>`
</ParamField>

<ParamField header="Content-Type" type="string" required>
  `application/json`
</ParamField>

### Body

<ParamField body="model" type="string" required>
  Model ID from `GET /v1/models`. Accepted types: `llm`, `speech-to-text`, `image-to-text`, `video-to-text`.
</ParamField>

<ParamField body="prompt" type="string">
  Text prompt or question. Required for LLM and most models.
</ParamField>

<ParamField body="system_prompt" type="string">
  System prompt for LLM models.
</ParamField>

<ParamField body="max_tokens" type="number">
  Maximum tokens for LLM response. Range: 1–32768.
</ParamField>

<ParamField body="temperature" type="number" default="1">
  Sampling temperature (0–2). Lower = more deterministic.
</ParamField>

<ParamField body="reasoning" type="boolean">
  Include reasoning trace in LLM response.
</ParamField>

<ParamField body="audio" type="string">
  Audio file URL for speech-to-text models.
</ParamField>

<ParamField body="language" type="string">
  Language hint for STT (e.g. `vi`, `en`). Pass `auto` for automatic detection.
</ParamField>

<ParamField body="image" type="string">
  Image URL for image-to-text, OCR, or vision models.
</ParamField>

<ParamField body="images" type="array">
  Array of image URLs for vision LLM models.
</ParamField>

<ParamField body="video" type="string">
  Video URL for video-to-text / captioning models.
</ParamField>

<ParamField body="output_format" type="string">
  Output format for OCR models. Values: `json`, `markdown`.
</ParamField>

## Examples

**LLM — text generation** (dùng `id` từ `GET /v1/models` với `capabilities.endpoint: "/v1/generate"`):

```bash theme={null}
curl -X POST https://hypergate.store/v1/generate \
  -H "Authorization: Bearer your-token" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<llm-model-id>",
    "prompt": "Explain async/await in JavaScript in 2 sentences.",
    "max_tokens": 200
  }'
```

**Speech to text:**

```bash theme={null}
curl -X POST https://hypergate.store/v1/generate \
  -H "Authorization: Bearer your-token" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai-whisper-turbo",
    "audio": "https://example.com/recording.mp3",
    "language": "vi"
  }'
```

**OCR:**

```bash theme={null}
curl -X POST https://hypergate.store/v1/generate \
  -H "Authorization: Bearer your-token" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "paddle-ocr",
    "image": "https://example.com/document.jpg",
    "output_format": "markdown"
  }'
```

**Video captioning:**

```bash theme={null}
curl -X POST https://hypergate.store/v1/generate \
  -H "Authorization: Bearer your-token" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "molmo2/video-captioner",
    "video": "https://example.com/clip.mp4"
  }'
```

## Response `200`

**Text / transcription:**

```json theme={null}
{
  "model": "<model-id>",
  "output": "Async/await is syntactic sugar over Promises..."
}
```

| Field | Description |
| - | - |
| `model` | Model ID used for the request. |
| `output` | Result — text for LLM/STT/OCR/caption. |
| `outputs` | Present only when the model returns multiple results. |

<Note>For image generation use [`POST /v1/images/generations`](/docs/api/images) — it has its own response format.</Note>


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