Skip to main content
POST
/
collection
/
{collection_id}
/
generate
/
text
Generate text using AI
curl --request POST \
  --url https://api.videodb.io/collection/{collection_id}/generate/text/ \
  --header 'Content-Type: application/json' \
  --header 'x-access-token: <api-key>' \
  --data '
{
  "prompt": "Summarize the content of this video",
  "video_id": "m-12345",
  "model_name": "gpt-4",
  "max_tokens": 500,
  "temperature": 0.7,
  "callback_url": "https://webhook.example.com/callback"
}
'
{
  "success": true,
  "status": "processing",
  "data": {
    "id": "job-123",
    "output_url": "https://api.videodb.io/async-response/job-123"
  }
}
Generate text content using AI language models with different model tiers. Choose between basic, pro, and ultra models, and get results as plain text or JSON.
import videodb

conn = videodb.connect(api_key="your_api_key")
coll = conn.get_collection()

# Generate plain text
script = coll.generate_text(
    prompt="Write a 30-second commercial script for a coffee brand",
    model_name="pro",
    response_type="text"
)

print(script)

# Generate JSON response
data = coll.generate_text(
    prompt="Extract key points from a video summary",
    model_name="pro",
    response_type="json"
)

print(data)
  • Model options: basic (default), pro, ultra with increasing complexity and quality
  • Response types: text (plain string) or json (structured object)
  • Returns directly as string or dict, not wrapped in an asset object
  • Useful for generating captions, scripts, summaries, and extracted data

Authorizations

x-access-token
string
header
required

API key for authentication (sk-xxx format)

Path Parameters

collection_id
string
required
Example:

"default"

Body

application/json
prompt
string
required
Example:

"Summarize the content of this video"

video_id
string
Example:

"m-12345"

model_name
string
Example:

"gpt-4"

max_tokens
integer
Example:

500

temperature
number
Example:

0.7

callback_url
string
Example:

"https://webhook.example.com/callback"

Response

200 - application/json

Text generation started or completed

success
boolean
Example:

true

status
enum<string>
Available options:
processing,
done,
failed
Example:

"processing"

data
object