🚀 Introduction
The Text Generator API lets you run text generation with Gemini models. It supports three modes:- Sync mode (
sync: true): The request blocks until generation completes and returns the result directly. - Async mode (default): The request returns immediately with a
pendingstatus. Poll or receive a webhook when the result is ready. - Streaming mode (SSE): Tokens are streamed back in real time via Server-Sent Events.
✅ Prerequisites
- A Creatify account with API access
- Your API credentials (see Authentication)
Supported Models
1) Create a Text Generation Task
Sendmodel_name, messages, and optional parameters like system_instruction, config, and webhook_url.
Endpoint: POST /sse/text_generator/
Body:
model_name(string, required) — Name of the Gemini model (e.g.gemini-2.5-flash)messages(array, required) — List of message objects withrole(userormodel) andcontentsystem_instruction(string, optional) — System instruction for the modelconfig(object, optional) — Generation config parameters (temperature, max_output_tokens, etc.)webhook_url(string URL, optional) — Webhook URL for async status updatessync(boolean, optional, default:false) — Iftrue, the request blocks until generation completes and returns the result directly
Async Mode (default)
Sync Mode
Set"sync": true to block until generation completes. The response will contain the final result directly — no polling or webhook needed.
Config Parameters
Multimodal Input (Image / Video)
Messages support multimodal content — send images or videos alongside text by providing a list of content parts. Each part specifies atype (text, image, or video) with the corresponding data.
Limits: Images up to 20 MB, videos up to 100 MB.
Supported MIME types:
- Image:
image/jpeg,image/png,image/gif,image/webp - Video:
video/mp4,video/mpeg,video/mov,video/avi,video/webm,video/quicktime, and more
Function Calling
Enable the model to call functions you define. Providetools with function declarations and optionally configure calling behavior with tool_config.
2) Streaming Mode (SSE)
For real-time token streaming, use the dedicated SSE endpoint. Tokens are delivered as they are generated — no polling needed. Endpoint: POST /sse/text_generator/stream/ The request body is the same as the standard endpoint (minussync and webhook_url). The response is an SSE stream (text/event-stream) of Gemini-native response chunks. The final chunk includes a creatify object with the generation id and credits_used.
The streaming endpoint uses the same authentication (X-API-KEY + X-API-ID) and credit system as the standard endpoint.
3) Check Status (Poll) or Receive Webhook (Async mode only)
When using async mode (default), you can poll the task untilstatus is done, or provide a webhook to be notified automatically. The generated text is in the response_text field.
If you used "sync": true, skip this step — the response already contains the completed result.
Endpoint: GET /sse/text_generator/{id}/
Poll
Webhook (Optional)
If you supplied awebhook_url when creating the task, we’ll POST a payload when it finishes. The generated text is in the response_text field.
You can verify the task any time with a GET to /sse/text_generator/{id}/.

