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

# Chat Completions

> Creates a model response for the given chat conversation.



## OpenAPI

````yaml post /chat/completions
openapi: 3.0.0
info:
  title: Horay.ai API
  description: The Horay.ai REST API
  version: 1.0.0
  contact:
    name: Horay.ai Support
    url: https://www.horay.ai/
  license:
    name: MIT
    url: https://github.com/horayai/OpenAPI/blob/main/LICENSE.txt
servers:
  - url: https://api.horay.ai/v1
security:
  - bearerAuth: []
paths:
  /chat/completions:
    post:
      tags:
        - Chat Completions
      summary: Chat Completions
      description: Creates a model response for the given chat conversation.
      operationId: chat-completions
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/ChatCompletionStream'
        '400':
          description: BadRequest
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StringData'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StringData'
        '404':
          description: NotFound
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StringData'
        '429':
          description: RateLimit
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StringData'
        '503':
          description: Overloaded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StringData'
        '504':
          description: Timeout
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StringData'
      deprecated: false
components:
  schemas:
    ChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: The name of the model to query.
          example: meta-llama/Meta-Llama-3.1-8B-Instruct
          default: meta-llama/Meta-Llama-3.1-8B-Instruct
          enum:
            - meta-llama/Meta-Llama-3.1-405B-Instruct
            - meta-llama/Meta-Llama-3.1-70B-Instruct
            - meta-llama/Meta-Llama-3.1-8B-Instruct
            - meta-llama/Llama-3.2-1B-Instruct
            - meta-llama/Llama-3.2-3B-Instruct
            - nvidia/Llama-3.1-Nemotron-70B-Instruct
            - google/gemma-2-27b-it
            - google/gemma-2-9b-it
            - Qwen/Qwen2.5-72B-Instruct
            - Qwen/Qwen2.5-Coder-32B-Instruct
            - Qwen/Qwen2.5-7B-Instruct
            - Qwen/Qwen2-72B-Instruct
            - Gryphe/MythoMax-L2-13b
            - gpt-4o-2024-11-20
            - gpt-4o-2024-08-06
            - gpt-4o-mini
            - o1-preview
            - o1-mini
            - claude-3-5-sonnet-v2@20241022
            - claude-3-5-sonnet@20240620
        messages:
          type: array
          description: A list of messages comprising the conversation so far.
          items:
            type: object
            properties:
              role:
                type: string
                description: >-
                  The role of the messages author. Choice between: system, user,
                  or assistant.
                example: user
                default: user
                enum:
                  - user
                  - assistant
                  - system
              content:
                type: string
                description: The contents of the message.
                example: >-
                  Unlock your AI Creativity with Horay.ai's Blazing Fast,
                  Affordable and Production Ready API, What impact will it have
                  on the industry?
                default: >-
                  Unlock your AI Creativity with Horay.ai's Blazing Fast,
                  Affordable and Production Ready API, What impact will it have
                  on the industry?
            required:
              - role
              - content
          minItems: 1
          maxItems: 10
        stream:
          type: boolean
          description: >-
            If set, tokens are returned as Server-Sent Events as they are made
            available. Stream terminates with `data: [DONE]`
          example: false
          default: false
        max_tokens:
          type: integer
          description: The maximum number of tokens to generate.
          example: 512
          default: 512
          minimum: 1
          maximum: 4096
        stop:
          type: array
          description: >-
            A list of string sequences that will truncate (stop) inference text
            output.
          items:
            type: string
        temperature:
          type: number
          description: Determines the degree of randomness in the response.
          format: float
          example: 0.7
          default: 0.7
        top_p:
          type: number
          description: >-
            The `top_p` (nucleus) parameter is used to dynamically adjust the
            number of choices for each predicted token based on the cumulative
            probabilities.
          format: float
          example: 0.7
          default: 0.7
        top_k:
          type: number
          format: float
          example: 50
          default: 50
        frequency_penalty:
          type: number
          format: float
          example: 0.5
          default: 0.5
        'n':
          type: integer
          description: Number of generations to return
          example: 1
          default: 1
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
        choices:
          $ref: '#/components/schemas/ChatCompletionChoicesData'
        usage:
          $ref: '#/components/schemas/UsageData'
        created:
          type: integer
        model:
          type: string
        object:
          type: string
          enum:
            - chat.completion
    ChatCompletionStream:
      type: object
      properties:
        id:
          type: string
        choices:
          $ref: '#/components/schemas/ChatCompletionChoicesData'
        created:
          type: integer
        model:
          type: string
        object:
          type: string
          enum:
            - chat.completion.chunk
    StringData:
      type: string
    ChatCompletionChoicesData:
      type: array
      items:
        type: object
        properties:
          message:
            type: object
            properties:
              role:
                type: string
                example: assistant
              content:
                type: string
          finish_reason:
            $ref: '#/components/schemas/FinishReason'
    UsageData:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
    FinishReason:
      type: string
      enum:
        - stop
        - eos
        - length
        - tool_calls
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````