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

# Chat-Completion erstellen

> OpenAI-kompatibler Chat-Completions-Endpunkt. Derzeit überwiegend für nicht-streamende Aufrufe vorgesehen.



## OpenAPI

````yaml /de/openapi.json post /v1/chat/completions
openapi: 3.1.0
info:
  title: APIAny.AI Öffentliche API
  version: 1.0.0
  description: >-
    Öffentliche API von APIAny.AI für Modellaggregation, asynchrone
    Medienaufgaben, Chat-Generierung, Guthabenabfrage und Aufgabenabfrage.
servers:
  - url: https://apiany.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Models
    description: Öffentlicher Modellkatalog.
  - name: Chat
    description: Endpunkte für Textgenerierung und chatkompatible Funktionen.
  - name: Images
    description: Endpunkte für Bildgenerierung und Bildbearbeitung.
  - name: Videos
    description: Endpunkte für Videogenerierung.
  - name: Moderation
    description: Image safety and moderation endpoints.
  - name: Tasks
    description: Abfrage asynchroner Aufgaben.
  - name: Account
    description: Konto- und Guthabenabfrage.
  - name: Free APIs
    description: Free utility APIs protected by API key rate limits.
paths:
  /v1/chat/completions:
    post:
      tags:
        - Chat
      summary: Chat-Completion erstellen
      description: >-
        OpenAI-kompatibler Chat-Completions-Endpunkt. Derzeit überwiegend für
        nicht-streamende Aufrufe vorgesehen.
      operationId: createChatCompletion
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            examples:
              basic:
                value:
                  model: gpt-5.4
                  messages:
                    - role: user
                      content: Write a concise product tagline for APIAny.AI.
                  temperature: 0.7
      responses:
        '200':
          description: OpenAI-kompatible Chat-Completion-Antwort.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    ChatCompletionRequest:
      type: object
      properties:
        model:
          type: string
          example: gpt-5.4
        messages:
          type: array
          items:
            $ref: '#/components/schemas/ChatMessage'
        temperature:
          type: number
          minimum: 0
          maximum: 2
          description: Sampling-Temperatur.
        top_p:
          type: number
          minimum: 0
          maximum: 1
          description: Kumulierte Wahrscheinlichkeitsmasse für Nucleus-Sampling.
        max_tokens:
          type: integer
          minimum: 1
          description: Maximale Anzahl an Token in der Antwort.
        stop:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
          description: Bis zu 4 Stoppsequenzen.
        'n':
          type: integer
          minimum: 1
          description: Anzahl der zu generierenden Antwortvarianten.
        frequency_penalty:
          type: number
          minimum: -2
          maximum: 2
        presence_penalty:
          type: number
          minimum: -2
          maximum: 2
        seed:
          type: integer
          description: Möglichst reproduzierbarer Sampling-Seed.
        response_format:
          type: object
          description: >-
            Erzwingt eine JSON-Objekt- oder JSON-Schema-Ausgabe, z. B. { "type":
            "json_object" }.
          additionalProperties: true
        tools:
          type: array
          description: Tool-/Funktionsdeklarationen, die das Modell aufrufen kann.
          items:
            type: object
            additionalProperties: true
        tool_choice:
          description: >-
            Tool-Auswahl: 'auto' | 'none' | 'required' | { type: 'function',
            function: { name } }.
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
        logprobs:
          type: boolean
        top_logprobs:
          type: integer
          minimum: 0
          maximum: 20
        logit_bias:
          type: object
          additionalProperties: true
        user:
          type: string
          description: Endnutzerkennung zur Risikoüberwachung.
        stream:
          type: boolean
          description: >-
            Bei true werden Inkremente über SSE gestreamt (OpenAI
            chat.completion.chunk), abgeschlossen durch 'data: [DONE]'.
      required:
        - model
        - messages
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          example: chat.completion
        created:
          type: integer
        model:
          type: string
        choices:
          type: array
          items:
            type: object
            additionalProperties: true
        usage:
          $ref: '#/components/schemas/TokenUsage'
      required:
        - id
        - object
        - created
        - model
        - choices
    ChatMessage:
      type: object
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
            - tool
        content:
          oneOf:
            - type: string
            - type: array
              items:
                type: object
                additionalProperties: true
      required:
        - role
        - content
    TokenUsage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
        input_tokens:
          type: integer
        output_tokens:
          type: integer
        cached_input_tokens:
          type: integer
      additionalProperties: true
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              enum:
                - invalid_request
                - auth_error
                - rate_limit
                - insufficient_quota
                - content_policy
                - timeout
                - network_error
                - service_error
                - billable_error
                - unknown
            message:
              type: string
            param:
              type:
                - string
                - 'null'
            code:
              type:
                - string
                - 'null'
          required:
            - type
            - message
      required:
        - error
  responses:
    BadRequest:
      description: Ungültige Anfrageparameter.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Fehlender oder ungültiger API-Key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    RateLimited:
      description: Ratenlimit überschritten.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key

````