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

# Completions V1

> Post completions v1.

<Warning>
  **This endpoint has been deprecated.** Use the [Completions V2 API](/api-reference/completions/v2) instead for better performance, auto-routing, and lower costs.
</Warning>


## OpenAPI

````yaml post /ai/v1/chat/completions
openapi: 3.1.0
info:
  title: AI API
  description: |-
    Optimized for high-speed inference and scalability by Gloo AI

    [Swagger UI](./docs) | [ReDoc UI](./redoc)
  version: 1.0.0
servers:
  - url: https://platform.ai.gloo.com
security:
  - bearerAuth: []
tags:
  - name: Content Controls
  - name: Data Engine
  - name: Ingestion & Enrichment
  - name: answers
  - name: chat
  - name: completions
  - name: content
  - name: core
  - name: data
  - name: get-models
  - name: ingestion
  - name: sotc
paths:
  /ai/v1/chat/completions:
    post:
      tags:
        - completions
      summary: Post completions v1
      description: Post completions v1.
      operationId: post-completions
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StudioPostCompletionsRequestBody'
        required: true
      responses:
        '200':
          description: Non-streaming successful response
          content:
            application/json:
              schema:
                type: object
                title: Response Post-Completions
              example:
                id: chatcmpl-d7007d2f
                choices:
                  - finish_reason: stop
                    index: 0
                    logprobs: null
                    message:
                      content: >-
                        Hello. It's nice to meet you. Is there something I can
                        help you with or would you like to chat?
                      refusal: null
                      role: assistant
                      annotations: null
                      audio: null
                      function_call: null
                      tool_calls: null
                created: 1752600200
                model: us.meta.llama3-3-70b-instruct-v1:0
                object: chat.completion
                service_tier: null
                system_fingerprint: fp
                usage:
                  completion_tokens: 25
                  prompt_tokens: 1707
                  total_tokens: 1732
                  completion_tokens_details: null
                  prompt_tokens_details: null
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail: Model is required.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      deprecated: true
components:
  schemas:
    StudioPostCompletionsRequestBody:
      properties:
        model:
          type: string
          title: Model
          description: Model to use for generating responses
          default: us.meta.llama3-3-70b-instruct-v1:0
        messages:
          items:
            $ref: '#/components/schemas/LlmMessage'
          type: array
          title: Messages
          description: Messages to send to the LLM
        max_tokens:
          type: integer
          minimum: 1024
          title: Max Tokens
          description: Max tokens to use for generating responses
          default: 1024
        stream:
          type: boolean
          title: Stream
          description: Stream response as soon as tokens are generated by the model.
          default: false
        temperature:
          type: number
          maximum: 1
          minimum: 0
          title: Temperature
          description: Temperature to use for generating responses
          default: 0.7
        tools:
          items:
            $ref: '#/components/schemas/Tool'
          type: array
          title: Tools
          description: List of tools you want the LLM to leverage.
          default: []
        tool_choice:
          anyOf:
            - type: string
              enum:
                - none
                - auto
                - required
            - $ref: '#/components/schemas/ToolChoiceFunctionOption'
          title: Tool Choice
          description: Which tool your LLM should use among the list.
          default: none
      additionalProperties: true
      type: object
      required:
        - messages
      title: StudioPostCompletionsRequestBody
    Error:
      type: object
      properties:
        detail:
          type: string
          description: A human-readable description of the error.
      title: Error
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    LlmMessage:
      properties:
        role:
          type: string
          title: Role
          description: Role of the message sender
          default: user
        content:
          type: string
          title: Content
          description: Content of the message
          default: Hello!
      type: object
      title: LlmMessage
    Tool:
      properties:
        type:
          type: string
          title: Type
          description: This field must be the literal string function.
          default: function
        function:
          $ref: '#/components/schemas/ToolFunction'
          description: Function attributes.
      type: object
      required:
        - function
      title: Tool
    ToolChoiceFunctionOption:
      properties:
        function:
          $ref: '#/components/schemas/ToolChoiceFunction'
          description: The encapsulation of the chosen function to invoke.
        type:
          type: string
          title: Type
          description: This field must be the literal string function.
          default: function
      type: object
      required:
        - function
      title: ToolChoiceFunctionOption
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ToolFunction:
      properties:
        name:
          type: string
          title: Name
          description: Name of the function.
        description:
          type: string
          title: Description
          description: Description of the function.
        parameters:
          type: object
          title: Parameters
          description: Parameters to call the function.
          default: {}
        strict:
          type: boolean
          title: Strict
          description: Whether to adhere strictly to the parameters definition.
          default: false
      type: object
      required:
        - name
        - description
      title: ToolFunction
    ToolChoiceFunction:
      properties:
        name:
          type: string
          title: Name
          description: The name of the chosen function to invoke.
      type: object
      required:
        - name
      title: ToolChoiceFunction
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form Bearer `<token>`, where
        `<token>` is your [auth token](/studio/manage-api-credentials).

````