> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aihubmax.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Plain Text

> Use the returned task ID to [query the task](/pages/en/api-manual/task-management/get-task-detail) for the final result.



## OpenAPI

````yaml openapi/en/llm-text.json POST /v1/llm/generations
openapi: 3.1.0
info:
  title: LLM · llm-text protocol
  version: '1.0'
  description: >-
    Request format of the unified LLM entrypoint **`llm-text`**: only `prompt`
    (no `image_urls` / `video_urls` / `audio_url` / `messages`) → plain-text
    generation.


    **The `/v1/llm/generations` endpoint supports 5 request forms**:

    - `llm-text` (this file): `prompt` only

    - `llm-vision`: `prompt` + `image_urls[]`

    - `llm-video`: `prompt` + `video_urls[]`

    - `llm-audio`: `audio_url`

    - `llm-custom`: `messages[]` (OpenAI Chat compatible)


    The final task result is queried via `GET /v1/tasks/{task_id}`; the SSE
    streaming subscription endpoint is `GET
    /v1/llm/generations/{task_id}/stream`, shared by all 5 protocols.
servers:
  - url: https://api.aihubmax.com
security:
  - BearerAuth: []
paths:
  /v1/llm/generations:
    post:
      tags:
        - LLM > llm-text
      summary: Submit an LLM generation task (llm-text protocol)
      description: >-
        Use the returned task ID to [query the
        task](/pages/en/api-manual/task-management/get-task-detail) for the
        final result.
      operationId: llm-text
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LLMTextRequest'
            examples:
              example_0:
                summary: Async non-streaming
                value:
                  model: claude-opus-4-7
                  prompt: Summarize the theory of relativity in two sentences.
                  max_tokens: 64
                  temperature: 0.3
              example_1:
                summary: Sync streaming (SSE response)
                value:
                  model: gemini-2.5-pro
                  prompt: Count from one to five.
                  sync: true
                  stream: true
                  max_tokens: 32
                  system_prompt: You are a terse assistant.
      responses:
        '200':
          description: Task created (async mode) / full response (sync mode)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
              examples:
                non_stream:
                  summary: sync=false, stream=false
                  value:
                    id: task-llmrouter-1776874481-rj6bs3yb
                    object: llm.generation.task
                    type: llm
                    model: claude-opus-4-7
                    status: pending
                    progress: 0
                    created: 1776874481
                    stream: null
                    results: null
                    error: null
                stream:
                  summary: sync=false, stream=true
                  value:
                    id: task-llmrouter-1776874565-yq3szvcu
                    object: llm.generation.task
                    type: llm
                    model: claude-opus-4-7
                    status: pending
                    progress: 0
                    created: 1776874565
                    stream:
                      url: >-
                        /v1/llm/generations/task-llmrouter-1776874565-yq3szvcu/stream
                    results: null
                    error: null
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  schemas:
    LLMTextRequest:
      type: object
      required:
        - model
        - prompt
      additionalProperties: true
      properties:
        model:
          type: string
          description: >-
            [Get Model
            List](/pages/en/api-manual/text-series/llm-async/llm-generations-models)
          example: claude-opus-4-7
        prompt:
          type: string
          maxLength: 100000
          description: User prompt, up to 100,000 characters.
          example: Summarize the theory of relativity in two sentences.
        sync:
          type: boolean
          default: false
          description: >-
            Synchronous mode. When `true`, the endpoint blocks until the
            upstream completes and returns the full response (if `stream=true`
            at the same time, returns an SSE stream); when `false`, the endpoint
            returns the task ID immediately, and results are fetched via `GET
            /v1/tasks/{task_id}` or the SSE endpoint.
          example: false
        stream:
          type: boolean
          default: false
          description: >-
            Whether to stream. When `true`, the Submit response includes
            `stream.url` pointing to the SSE subscription path; streaming chunks
            are unified as the OpenAI `chat.completion.chunk` format.
          example: false
        max_tokens:
          type: integer
          nullable: true
          minimum: 1
          description: Generation token limit. Optional.
          example: 64
        temperature:
          type: number
          nullable: true
          minimum: 0
          maximum: 2
          description: Sampling temperature, range [0, 2]. Optional.
          example: 0.3
        system_prompt:
          type: string
          nullable: true
          maxLength: 10000
          description: >-
            System instruction, prepended to the conversation context. Optional,
            up to 10,000 characters.
          example: You are a terse assistant.
        reasoning:
          type: boolean
          nullable: true
          description: >-
            Whether to include reasoning tokens. Passed through to the upstream;
            concrete semantics depend on the upstream model (thinking models
            like gemini-2.5-pro may require `true`).
    SubmitResponse:
      type: object
      description: >-
        Submit response, conforming to the unified task standard shape.
        `results` / `error` are fixed at `null` during submit; they are returned
        via `GET /v1/tasks/{task_id}` after the task completes or fails. In
        `sync=true, stream=false` mode, the endpoint directly returns the full
        OpenAI ChatCompletion JSON (does not follow this shape).
      required:
        - id
        - object
        - type
        - model
        - status
        - progress
        - created
      properties:
        id:
          type: string
          description: Task ID, formatted as `task-llmrouter-{timestamp}-{8random}`.
          example: task-llmrouter-1776874565-yq3szvcu
        object:
          type: string
          enum:
            - llm.generation.task
          example: llm.generation.task
        type:
          type: string
          enum:
            - llm
          example: llm
        model:
          type: string
          description: The model name submitted by the client (echoed verbatim)
          example: claude-opus-4-7
        status:
          type: string
          enum:
            - pending
          example: pending
        progress:
          type: integer
          example: 0
        created:
          type: integer
          example: 1776874565
        stream:
          nullable: true
          description: 'Returns `{url: ...}` when `stream=true`; `null` when `stream=false`.'
          oneOf:
            - $ref: '#/components/schemas/StreamInfo'
            - type: 'null'
        results:
          type: array
          nullable: true
          description: >-
            Fixed at `null` during submit; returned via `GET
            /v1/tasks/{task_id}` after the task completes — `results[0]` is the
            full OpenAI `ChatCompletion` response.
          items:
            type: object
          example: null
        error:
          type: object
          nullable: true
          description: >-
            Fixed at `null` during submit; returned via `GET
            /v1/tasks/{task_id}` when the task fails.
          example: null
    StreamInfo:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          example: /v1/llm/generations/task-llmrouter-1776874565-yq3szvcu/stream
    ErrorResponse401:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: No authentication token provided
            type:
              type: string
              example: authentication_error
    ErrorResponse422:
      type: object
      description: >-
        Parameter validation failure. Common `code`: `protocol_not_detectable`,
        `model_not_registered`, `invalid_param`, `upstream_client_error`.
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: >-
                model 'unknown-model' is not registered on any
                gateway:llm-router:* channel for this user group
            type:
              type: string
              example: invalid_request_error
            code:
              type: string
              example: model_not_registered
    ErrorResponse429:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Request rate limit exceeded
            type:
              type: string
              example: rate_limit_error
    ErrorResponse500:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Internal server error
            type:
              type: string
              example: internal_error
    ErrorResponse503:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: 'all 3 candidates exhausted; last error: ...'
            type:
              type: string
              example: upstream_error
            code:
              type: string
              example: all_platforms_exhausted
  responses:
    Unauthorized:
      description: Token invalid or missing
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse401'
    UnprocessableEntity:
      description: Parameter validation failure / model not registered / upstream 4xx
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse422'
    TooManyRequests:
      description: Request rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse429'
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse500'
    ServiceUnavailable:
      description: Upstream service unavailable
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse503'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        All endpoints require Bearer Token authentication. Add to the request
        header:


        `Authorization: Bearer YOUR_API_KEY`


        `YOUR_API_KEY` is the API Token (`sk-...` format).

````