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

# Create a video

> Starts a video job and answers `202` at once: a clip takes from half a minute to several minutes. Requires an API key. Poll `GET /v1/videos/{id}` until `status` is `completed` or `failed`, then fetch the file from `GET /v1/videos/{id}/content`. NagaAI holds the full price of the clip on the balance while the job runs and charges it once, when the clip is ready. A job that fails is not charged.



## OpenAPI

````yaml /openapi/naga-api.json post /v1/videos
openapi: 3.1.0
info:
  title: NagaAI API
  description: >-
    NagaAI routes inference requests to a pool of upstream providers behind one
    endpoint. Requests speak the OpenAI or the Anthropic dialect, and the
    gateway selects a provider that serves the requested model. Two credentials
    exist and they are not interchangeable. An API key reaches models. A
    provisioning key manages the account: its keys, its balance, and its usage.
    Each operation declares which one it accepts. NagaAI charges the account in
    credits for the tokens a request consumes, at the published price of the
    model that served it. One credit costs one US dollar.
  termsOfService: https://naga.ac/legal/terms
  contact:
    name: NagaAI
    url: https://naga.ac
  version: '2026-03-31'
  summary: >-
    One API to many model providers, in the OpenAI and Anthropic request
    formats.
servers:
  - url: https://api.naga.ac
    description: Production
security: []
tags:
  - name: Chat Completions
    description: >-
      The OpenAI Chat Completions dialect, with streaming, tools and multimodal
      input.
    externalDocs:
      url: https://platform.openai.com/docs/api-reference/chat
      description: The OpenAI reference for this dialect.
  - name: Messages
    description: >-
      The Anthropic Messages dialect, as Claude-style clients and agents speak
      it.
    externalDocs:
      url: https://docs.anthropic.com/en/api/messages
      description: The Anthropic reference for this dialect.
  - name: Responses
    description: >-
      The OpenAI Responses dialect, with structured input, tools and streamed
      output items.
    externalDocs:
      url: https://platform.openai.com/docs/api-reference/responses
      description: The OpenAI reference for this dialect.
  - name: Embeddings
    description: Vector embeddings for search, retrieval, clustering and ranking.
    externalDocs:
      url: https://platform.openai.com/docs/api-reference/embeddings
      description: The OpenAI reference for this route.
  - name: Images
    description: Image generation and editing with multimodal models.
    externalDocs:
      url: https://platform.openai.com/docs/api-reference/images
      description: The OpenAI reference for these routes.
  - name: Audio
    description: Speech from text, and text from uploaded audio.
    externalDocs:
      url: https://platform.openai.com/docs/api-reference/audio
      description: The OpenAI reference for these routes.
  - name: Videos
    description: 'Video generation as a job: submit it, poll it, download the file.'
    externalDocs:
      url: https://docs.naga.ac/api/videos
      description: The NagaAI guide to video generation.
  - name: Moderations
    description: Safety classification of text and image input.
    externalDocs:
      url: https://platform.openai.com/docs/api-reference/moderations
      description: The OpenAI reference for this route.
  - name: Models
    description: The catalog of models, their capabilities and their prices.
    externalDocs:
      url: https://platform.openai.com/docs/api-reference/models
      description: The OpenAI reference for this route.
  - name: Startups
    description: The organizations whose models the catalog carries.
    externalDocs:
      url: https://docs.naga.ac/get-started/models
      description: The NagaAI guide to the model catalog.
  - name: Account
    description: The account's balance and its usage, behind a provisioning key.
    externalDocs:
      url: https://docs.naga.ac/account/balance-and-activity
      description: The NagaAI guide to balance and activity.
  - name: API Keys
    description: The account's API keys, behind a provisioning key.
    externalDocs:
      url: https://docs.naga.ac/account/api-keys
      description: The NagaAI guide to API keys.
paths:
  /v1/videos:
    post:
      tags:
        - Videos
      summary: Create a video
      description: >-
        Starts a video job and answers `202` at once: a clip takes from half a
        minute to several minutes. Requires an API key. Poll `GET
        /v1/videos/{id}` until `status` is `completed` or `failed`, then fetch
        the file from `GET /v1/videos/{id}/content`. NagaAI holds the full price
        of the clip on the balance while the job runs and charges it once, when
        the clip is ready. A job that fails is not charged.
      operationId: create_video
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VideosGenerationsRequest'
            examples:
              basic:
                summary: Eight seconds at 720p with sound
                value:
                  model: kling-v3.0-pro
                  prompt: A red paper boat drifting on a calm lake at dawn
                  duration: 8
                  resolution: 720p
                  aspect_ratio: '16:9'
                  generate_audio: true
        required: true
      responses:
        '202':
          description: >-
            The job, accepted and queued. Poll `polling_url` until `status` is
            `completed` or `failed`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoJob'
              examples:
                basic:
                  summary: The job, queued
                  value:
                    id: 4b1f0c2e9a7d4e6f8a3b5c1d2e7f9a0b
                    object: video.generation
                    model: kling-v3.0-pro
                    status: pending
                    polling_url: >-
                      https://api.naga.ac/v1/videos/4b1f0c2e9a7d4e6f8a3b5c1d2e7f9a0b
                    created_at: 1774000000
                    duration: 8
                    resolution: 720p
                    aspect_ratio: '16:9'
          x-retry-safe: false
        '400':
          description: >-
            The request is malformed: a field failed its constraint, the body is
            not valid JSON, the model is unknown, or a value is not one the
            model supports.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          x-retry-safe: false
        '401':
          description: >-
            The API key is missing, malformed, disabled, or does not belong to
            an account that may call this route.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              examples:
                invalid-api-key:
                  summary: 401 — the key is not one this gateway serves
                  value:
                    error:
                      type: invalid_api_key
                      message: >-
                        The provided API key is invalid. Please ensure your API
                        key is correct and active. You can find more information
                        about obtaining a key on our website: https://naga.ac If
                        you just created this key, wait a few minutes and try
                        again.
          x-retry-safe: false
        '402':
          description: >-
            The balance, less the holds of the account's running video jobs,
            does not cover the full price of this one.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              examples:
                insufficient-credits:
                  summary: 402 — the account has no credits left
                  value:
                    error:
                      type: insufficient_quota
                      message: >-
                        More credits required to process this request. Visit
                        https://naga.ac/dashboard/credits to add credits.
          x-retry-safe: false
        '403':
          description: >-
            The prompt was blocked by the moderation policy, or what is left of
            the key's credit limit does not cover the price.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          x-retry-safe: false
        '413':
          description: The request body is larger than the 32 MiB this gateway accepts.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          x-retry-safe: false
        '500':
          description: >-
            The gateway failed for a reason of its own. Report it — this status
            marks NagaAI's own bugs, never an upstream verdict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          x-retry-safe: true
        '503':
          description: >-
            No upstream could take the job, or a store the gateway needs did not
            respond. `Retry-After`, when present, carries the suggested wait.
          headers:
            Retry-After:
              schema:
                type: string
              description: How long to wait before retrying, in seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          x-retry-safe: true
      security:
        - bearerAuth: []
        - xApiKeyAuth: []
      x-codeSamples:
        - lang: bash
          label: curl
          source: |-
            curl https://api.naga.ac/v1/videos \
              -H "Authorization: Bearer $NAGA_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
              "model": "kling-v3.0-pro",
              "prompt": "A red paper boat drifting on a calm lake at dawn",
              "duration": 8,
              "resolution": "720p",
              "aspect_ratio": "16:9",
              "generate_audio": true
            }'
components:
  schemas:
    VideosGenerationsRequest:
      type: object
      description: Start one video generation job.
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          description: The video model, named by its id or alias.
        prompt:
          type: string
          description: >-
            What to generate, in words. One to 8192 characters, and moderation
            screens it first.
        duration:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            Clip length in seconds; one of the model's `supported_durations`.
            Absent takes the model's default.
        resolution:
          type:
            - string
            - 'null'
          description: >-
            One of the model's `supported_resolutions`, such as `720p`. Absent
            takes the model's default.
        aspect_ratio:
          type:
            - string
            - 'null'
          description: >-
            One of the model's `supported_aspect_ratios`, such as `16:9`. Absent
            takes the model's default.
        frame_images:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/VideoFrameImage'
          description: Images that become the first or the last frame, one per frame type.
        generate_audio:
          type:
            - boolean
            - 'null'
          description: >-
            Ask for a soundtrack. Only a model with `generate_audio` accepts
            `true`, and the audio price applies.
        seed:
          type:
            - integer
            - 'null'
          format: int64
          description: A seed for repeatable output, where the model supports one.
    VideoJob:
      type: object
      description: A video job as the gateway reports it.
      required:
        - id
        - object
        - model
        - status
        - polling_url
        - created_at
        - duration
        - resolution
        - aspect_ratio
      properties:
        id:
          type: string
          description: The job id; the polling and content URLs carry it.
        object:
          type: string
          description: Always `video.generation`.
          example: video.generation
        model:
          type: string
          description: The model the job was submitted for, as the caller named it.
        status:
          type: string
          description: '`pending`, `in_progress`, `completed` or `failed`.'
        polling_url:
          type: string
          description: Where to poll this job.
        created_at:
          type: integer
          format: int64
          description: Unix seconds when the job was accepted.
        completed_at:
          type:
            - integer
            - 'null'
          format: int64
          description: Unix seconds when the job reached `completed` or `failed`.
        duration:
          type: integer
          format: int64
          description: The requested clip length in seconds.
        resolution:
          type: string
          description: The requested resolution.
        aspect_ratio:
          type: string
          description: The requested aspect ratio.
        urls:
          type:
            - array
            - 'null'
          items:
            type: string
          description: Links to the finished file; present once the job is `completed`.
        usage:
          oneOf:
            - allOf:
                - $ref: '#/components/schemas/VideoUsage'
              description: What the job was charged; present once the job is `completed`.
            - type: 'null'
        error:
          oneOf:
            - allOf:
                - $ref: '#/components/schemas/VideoJobError'
              description: >-
                Why the job failed; present only when it is `failed`. A failed
                job is not charged.
            - type: 'null'
    ErrorEnvelope:
      type: object
      description: >-
        `{"error": {…}}` — the body of every non-2xx answer outside
        `/v1/messages`.
      required:
        - error
      properties:
        error:
          allOf:
            - $ref: '#/components/schemas/ErrorBody'
          description: The failure itself, and the envelope's only member.
    VideoFrameImage:
      type: object
      description: 'One frame image: an image URL and the frame it pins.'
      required:
        - type
        - image_url
        - frame_type
      properties:
        type:
          type: string
          description: Always `image_url`.
        image_url:
          allOf:
            - $ref: '#/components/schemas/VideoImageUrl'
          description: The image, as a public `https` URL or a `data:` URI.
        frame_type:
          type: string
          description: '`first_frame` or `last_frame`.'
    VideoUsage:
      type: object
      description: The charge of a finished job.
      required:
        - cost
        - seconds
      properties:
        cost:
          type: string
          description: Credits charged, as a decimal string.
        seconds:
          type: integer
          format: int64
          description: Seconds of video the charge counts.
    VideoJobError:
      type: object
      description: Why a job failed.
      required:
        - message
        - type
      properties:
        message:
          type: string
          description: A short, provider-neutral reason.
        type:
          type: string
          description: '`upstream_error`, `moderation` or `timeout`.'
    ErrorBody:
      type: object
      description: 'The `error` member: what went wrong, in the caller''s terms.'
      required:
        - type
        - message
      properties:
        type:
          type: string
          description: >-
            The class of the failure; a provider's own class can reach you
            unchanged.
          examples:
            - invalid_request_error
            - authentication_required
            - invalid_api_key
            - invalid_provisioning_key
            - invalid_session_token
            - disabled_api_key
            - disabled_provisioning_key
            - expired_api_key
            - credit_limit_exceeded
            - rate_limit_exceeded
            - model_deprecated
            - inappropriate_content
            - billing_metering_incomplete
            - billing_request_id_invalid
            - billing_writer_missing
            - server_error
        message:
          type: string
          description: The human-readable sentence shown to the caller.
        code:
          type:
            - string
            - 'null'
          description: The finer-grained code, when the failure has one.
        param:
          type:
            - string
            - 'null'
          description: The request field the failure is about, when it is about one.
    VideoImageUrl:
      type: object
      description: 'The `{ "url": … }` wrapper the chat dialect uses for an image too.'
      required:
        - url
      properties:
        url:
          type: string
          description: A public `https` URL or a `data:` URI.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'An account API key. Send it as `Authorization: Bearer <key>`.'
    xApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        An account API key. Send it as `x-api-key: <key>`, the header
        Anthropic-style clients use.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.