Skip to content

Text Generator

Official API verified 2026-07-31

Generate text with supported Gemini models through synchronous, asynchronous, or Server-Sent Events streaming workflows.

Endpoints

OperationEndpoint
Create sync or async taskPOST /sse/text_generator/
Stream a taskPOST /sse/text_generator/stream/
List tasksGET /api/text_generator/
Get taskGET /api/text_generator/{id}/

Required input

  • model_name
  • messages, using user or model roles

Optional fields include system_instruction, generation config, tools, tool configuration, webhook_url, and sync.

Choose a mode

ModeBehaviorBest use
SyncSet sync: true; request waits for the completed responseShort deterministic jobs
AsyncDefault; returns pendingLonger or multimodal jobs, polling, and webhooks
StreamingReturns Gemini-native chunks over SSEInteractive text output

Async example

bash
curl --request POST \
  --url https://api.creatify.ai/sse/text_generator/ \
  --header 'Content-Type: application/json' \
  --header "X-API-ID: $CREATIFY_API_ID" \
  --header "X-API-KEY: $CREATIFY_API_KEY" \
  --data '{
    "model_name": "gemini-2.5-flash",
    "messages": [
      {"role": "user", "content": "Write three source-backed hooks for a local SEO and GEO video."}
    ],
    "system_instruction": "Return concise marketing hooks without unsupported claims."
  }'

Poll GET /api/text_generator/{id}/ until status is done or use webhook_url. Read response_text, response_function_calls, failed_reason, and credits_used from the result.

Streaming boundary

The streaming endpoint returns text/event-stream. Its final SSE chunk includes a Creatify object containing the generation ID and credits used.

Safety and cost

  • Keep API credentials server-side.
  • Treat HTTP 402 as insufficient credits and HTTP 429 as a rate-limit response.
  • Use async mode for image or video inputs and other potentially slow requests.
  • Record the returned credits_used rather than estimating text-generation cost.

Source: official Text Generator overview.