> ## 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.

# 채팅 완성 생성

> OpenAI 호환 Chat Completions 엔드포인트입니다. 현재는 비스트리밍 호출을 중심으로 합니다.



## OpenAPI

````yaml /ko/openapi.json post /v1/chat/completions
openapi: 3.1.0
info:
  title: APIAny.AI 공개 API
  version: 1.0.0
  description: APIAny.AI의 모델 통합, 비동기 미디어 작업, 채팅 생성, 크레딧 조회 및 작업 조회를 위한 공개 API입니다.
servers:
  - url: https://apiany.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Models
    description: 공개 모델 카탈로그입니다.
  - name: Chat
    description: 텍스트 생성 및 채팅 호환 엔드포인트입니다.
  - name: Images
    description: 이미지 생성 및 이미지 편집 엔드포인트입니다.
  - name: Videos
    description: 동영상 생성 엔드포인트입니다.
  - name: Moderation
    description: Image safety and moderation endpoints.
  - name: Tasks
    description: 비동기 작업 조회입니다.
  - name: Account
    description: 계정 및 크레딧 조회입니다.
  - name: Free APIs
    description: Free utility APIs protected by API key rate limits.
paths:
  /v1/chat/completions:
    post:
      tags:
        - Chat
      summary: 채팅 완성 생성
      description: OpenAI 호환 Chat Completions 엔드포인트입니다. 현재는 비스트리밍 호출을 중심으로 합니다.
      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 호환 채팅 완성 응답입니다.
          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: 샘플링 온도입니다.
        top_p:
          type: number
          minimum: 0
          maximum: 1
          description: 뉴클리어스 샘플링 누적 확률입니다.
        max_tokens:
          type: integer
          minimum: 1
          description: 응답의 최대 토큰 수입니다.
        stop:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
          description: 최대 4개의 정지 시퀀스입니다.
        'n':
          type: integer
          minimum: 1
          description: 생성할 후보 응답 수입니다.
        frequency_penalty:
          type: number
          minimum: -2
          maximum: 2
        presence_penalty:
          type: number
          minimum: -2
          maximum: 2
        seed:
          type: integer
          description: 가능한 한 재현 가능한 샘플링 시드입니다.
        response_format:
          type: object
          description: 'JSON 객체 또는 JSON Schema 출력을 강제합니다. 예: { "type": "json_object" }.'
          additionalProperties: true
        tools:
          type: array
          description: 모델이 호출할 수 있는 도구/함수 선언입니다.
          items:
            type: object
            additionalProperties: true
        tool_choice:
          description: >-
            도구 선택: '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: 오남용 모니터링을 위한 최종 사용자 식별자입니다.
        stream:
          type: boolean
          description: >-
            true이면 SSE로 증분 델타를 스트리밍하며(OpenAI chat.completion.chunk), '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: 요청 파라미터가 유효하지 않습니다.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: API 키가 없거나 API 키가 유효하지 않습니다.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    RateLimited:
      description: 요청이 속도 제한을 초과했습니다.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key

````