---
title: "Generate text using AI"
method: POST
path: "/collection/{collection_id}/generate/text/"
---

# Generate text using AI

`POST /collection/{collection_id}/generate/text/`

## Path parameters

- `collection_id` string, required

## Request body

- union — Provide either `prompt` for inline text or `prompt_url` for a previously uploaded prompt file.
  - object
    - `prompt` string, required — Inline prompt text. Use for smaller prompts.
    - `prompt_url` string — URL to a previously uploaded plain-text prompt file. Use for larger prompts.
    - `video_id` string
    - `model_name` string — Hosted tier (`mini`, `basic`, `pro`, `ultra`) or self-hosted sandbox model name.
    - `sandbox_id` string — Sandbox ID to use when `model_name` is a self-hosted model.
    - `max_tokens` integer
    - `temperature` number
    - `model_config` object — Additional self-hosted model configuration.
    - `callback_url` string
  - object
    - `prompt` string — Inline prompt text. Use for smaller prompts.
    - `prompt_url` string, required — URL to a previously uploaded plain-text prompt file. Use for larger prompts.
    - `video_id` string
    - `model_name` string — Hosted tier (`mini`, `basic`, `pro`, `ultra`) or self-hosted sandbox model name.
    - `sandbox_id` string — Sandbox ID to use when `model_name` is a self-hosted model.
    - `max_tokens` integer
    - `temperature` number
    - `model_config` object — Additional self-hosted model configuration.
    - `callback_url` string

## Response `200`

Text generation started or completed

- union
  - AsyncResponse
    - `success` boolean
    - `status` 'processing' | 'done' | 'failed'
    - `data` object
      - `id` string
      - `output_url` string
  - object
    - `success` boolean
    - `data` object
      - `output` string

---

[API](https://skmtc.net/video-db/apis/videodb-server-api.md) · [All operations](https://skmtc.net/video-db/apis/videodb-server-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/video-db/videodb-server-api/versions/21b1d1d3eae8/schema)
