---
title: "POST /api/text_generator/"
method: POST
path: "/api/text_generator/"
tags: ["text_generator"]
---

# POST /api/text_generator/

`POST /api/text_generator/`

## Request

- The document declares no server URL.
- Auth: API key in header `X-API-ID` and API key in header `X-API-KEY`

## Request body

- TextGenRequest
  - `model_name` string, required: Name of the Gemini model (e.g. gemini-3.8-flash).
  - `messages` Message[], required: List of messages with 'role' (user/model) and 'content'.
    - `role` 'user' | 'model', required: * `user` - user * `model` - model
    - `content` string: Message content. Either a plain text string, or a list of content parts for multimodal input. Each part is an object with 'type' ('text', 'image', or 'video'), and either 'text' (for text parts) or 'data' (base64) + 'mime_type' (for image/video parts).
    - `function_call` FunctionCallPart: A function call issued by the model.
      - `name` string, required: Name of the function to call.
      - `args` object: Arguments for the function call as a JSON object.
    - `function_response` FunctionResponsePart: A function response supplied by the caller.
      - `name` string, required: Name of the function that was called.
      - `response` object, required: The function's return value as a JSON object.
  - `system_instruction` string: Optional system instruction for the model.
  - `config` TextGenConfig: Structured config serializer for OpenAPI documentation.
    - `temperature` number, double: Controls randomness. Range: 0.0 - 2.0. Lower = more deterministic.
    - `max_output_tokens` integer: Maximum number of tokens to generate.
    - `top_p` number, double: Nucleus sampling threshold. Range: 0.0 - 1.0.
    - `top_k` integer: Top-k sampling. Only sample from top k tokens.
    - `presence_penalty` number, double: Penalize tokens already present in the text. Range: -2.0 - 2.0.
    - `frequency_penalty` number, double: Penalize tokens by frequency. Range: -2.0 - 2.0.
    - `seed` integer: Random seed for deterministic generation.
    - `stop_sequences` string[]: List of strings that stop generation when encountered.
    - `response_mime_type` 'text/plain' | 'application/json': * `text/plain` - text/plain * `application/json` - application/json
    - `response_json_schema` unknown
  - `tools` Tool[]: List of tools (function declarations) the model may call.
    - `function_declarations` FunctionDeclaration[], required: List of function declarations available to the model.
      - `name` string, required: Function name.
      - `description` string: Description of what the function does.
      - `parameters` unknown
  - `tool_config` ToolConfig: Controls how the model uses the provided tools.
    - `function_calling_config` FunctionCallingConfig: Controls how the model selects and calls functions.
      - `mode` 'AUTO' | 'ANY' | 'NONE' | 'VALIDATED': * `AUTO` - AUTO * `ANY` - ANY * `NONE` - NONE * `VALIDATED` - VALIDATED
      - `allowed_function_names` string[]: Restrict the model to only call these functions (used with mode=ANY).
  - `webhook_url` string, uri: Webhook URL for async status updates.
  - `sync` boolean: If true, the request blocks until generation completes and returns the result directly. Default is false (async).

## Response `201`

- TextGenResponse
  - `id` string, uuid, required
  - `model_name` string, required
  - `messages` Message[], required
    - `role` 'user' | 'model', required: * `user` - user * `model` - model
    - `content` string: Message content. Either a plain text string, or a list of content parts for multimodal input. Each part is an object with 'type' ('text', 'image', or 'video'), and either 'text' (for text parts) or 'data' (base64) + 'mime_type' (for image/video parts).
    - `function_call` FunctionCallPart: A function call issued by the model.
      - `name` string, required: Name of the function to call.
      - `args` object: Arguments for the function call as a JSON object.
    - `function_response` FunctionResponsePart: A function response supplied by the caller.
      - `name` string, required: Name of the function that was called.
      - `response` object, required: The function's return value as a JSON object.
  - `system_instruction` string: Optional system instruction for the model.
  - `config` TextGenConfig, required: Structured config serializer for OpenAPI documentation.
    - `temperature` number, double: Controls randomness. Range: 0.0 - 2.0. Lower = more deterministic.
    - `max_output_tokens` integer: Maximum number of tokens to generate.
    - `top_p` number, double: Nucleus sampling threshold. Range: 0.0 - 1.0.
    - `top_k` integer: Top-k sampling. Only sample from top k tokens.
    - `presence_penalty` number, double: Penalize tokens already present in the text. Range: -2.0 - 2.0.
    - `frequency_penalty` number, double: Penalize tokens by frequency. Range: -2.0 - 2.0.
    - `seed` integer: Random seed for deterministic generation.
    - `stop_sequences` string[]: List of strings that stop generation when encountered.
    - `response_mime_type` 'text/plain' | 'application/json': * `text/plain` - text/plain * `application/json` - application/json
    - `response_json_schema` unknown
  - `status` 'pending' | 'running' | 'done' | 'failed': * `pending` - pending * `running` - running * `done` - done * `failed` - failed
  - `response_text` string: Generated text response from the model.
  - `response_function_calls` FunctionCallPart[], required
    - `name` string, required: Name of the function to call.
    - `args` object: Arguments for the function call as a JSON object.
  - `failed_reason` string: Reason for failure if status is failed.
  - `credits_used` number, double: Credits consumed for this generation.
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required

## Changes

- **2026-11-03** `8423ba73b422`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/creatify/apis/creatify-ai-api/changes/api/text_generator/post.md)

---

[API](https://skmtc.dev/creatify/apis/creatify-ai-api.md) - [All operations](https://skmtc.dev/creatify/apis/creatify-ai-api/llms.txt) - [OpenAPI document](https://skmtc.dev/creatify/apis/creatify-ai-api/revisions/8423ba73b422?raw)
