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

# Native chat completion

> Single, stable shape across every AdSkull LLM. Optional SSE streaming.



## OpenAPI

````yaml /api/openapi.yaml post /v1/llm/chat
openapi: 3.1.0
info:
  title: AdSkull Public API
  version: 1.0.0
  summary: Public API for AdSkull creative generation.
  description: >
    Create AI ad assets, images, videos, voiceovers, custom voices, and talking
    avatars.

    Responses expose AdSkull product resources.
servers:
  - url: https://api.adskull.io
security:
  - bearerAuth: []
tags:
  - name: Account
  - name: Models
  - name: Assets
  - name: Images
  - name: Videos
  - name: Voices
  - name: Talking Avatars
  - name: Webhooks
  - name: LLM
  - name: LLM OpenAI Compat
  - name: LLM Anthropic Compat
paths:
  /v1/llm/chat:
    post:
      tags:
        - LLM
      summary: Native chat completion
      description: Single, stable shape across every AdSkull LLM. Optional SSE streaming.
      parameters:
        - in: header
          name: Idempotency-Key
          schema:
            type: string
            maxLength: 255
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LLMChatRequest'
      responses:
        '200':
          description: Completion or SSE stream.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LLMChatResponse'
            text/event-stream:
              schema:
                type: string
        '400':
          $ref: 6644843e-f702-48d2-b6a9-13373081678a
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/InsufficientCredits'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - bearerAuth: []
components:
  schemas:
    LLMChatRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: AdSkull LLM model ID, e.g. claude-opus-4.7
        messages:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/LLMChatMessage'
        max_tokens:
          type: integer
          nullable: true
        temperature:
          type: number
          minimum: 0
          maximum: 2
          nullable: true
        top_p:
          type: number
          minimum: 0
          maximum: 1
          nullable: true
        stream:
          type: boolean
          default: false
        tools:
          type: array
          items:
            type: object
        tool_choice:
          type: object
          nullable: true
        stop:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        seed:
          type: integer
          nullable: true
        response_format:
          type: object
          nullable: true
        attachments:
          type: array
          items:
            type: object
            required:
              - type
              - url
            properties:
              type:
                type: string
                enum:
                  - image
                  - audio
                  - video
                  - file
              url:
                type: string
                format: uri
    LLMChatResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          const: chat.completion
        model:
          type: string
        created:
          type: integer
        choices:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              message:
                type: object
                properties:
                  role:
                    type: string
                  content:
                    type: string
                  tool_calls:
                    type: array
                    nullable: true
                    items:
                      type: object
              finish_reason:
                type: string
        usage:
          $ref: '#/components/schemas/LLMUsage'
    LLMChatMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
            - tool
        content:
          oneOf:
            - type: string
            - type: array
              items:
                type: object
    LLMUsage:
      type: object
      properties:
        input_tokens:
          type: integer
        output_tokens:
          type: integer
        cached_tokens:
          type: integer
        millicredits_charged:
          type: integer
        credits_charged:
          type: number
    ErrorEnvelope:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - request_id
          properties:
            code:
              type: string
            message:
              type: string
            request_id:
              type: string
            details:
              type: object
              additionalProperties: true
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    InsufficientCredits:
      description: Not enough credits.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: Missing scope, plan, or resource access.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Conflict:
      description: Idempotency or concurrency conflict.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    RateLimited:
      description: Rate limit exceeded.
      headers:
        Retry-After:
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key

````