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

# Chat Completions



## OpenAPI

````yaml https://api.dev-sgp.scale.com/openapi-versions/v5/openapi.json post /v5/chat/completions
openapi: 3.1.0
info:
  title: EGP API V5
  description: >-
    This is the parent API for all EGP APIs. If you are looking for the EGP API,
    please go to https://api.egp.scale.com/docs.
  contact:
    name: Scale Generative AI Platform
    url: https://scale.com/genai-platform
  version: 0.1.0
servers:
  - url: https://api.egp.scale.com
security: []
paths:
  /v5/chat/completions:
    post:
      tags:
        - Inference
      summary: Chat Completions
      operationId: POST-V5-/v5/chat/completions
      parameters:
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
        - name: x-openai-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Openai-Api-Key
        - name: x-selected-account-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Account ID Header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ChatCompletion'
                  - $ref: '#/components/schemas/ChatCompletionChunk'
                title: Response Post-V5-/V5/Chat/Completions
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    ChatCompletionRequest:
      properties:
        top_k:
          title: Top K
          description: Only sample from the top K options for each subsequent token
          type: integer
        frequency_penalty:
          title: Frequency Penalty
          description: >-
            Number between -2.0 and 2.0. Positive values penalize new tokens
            based on their existing frequency in the text so far.
          type: number
          maximum: 2
          minimum: -2
        function_call:
          title: Function Call
          description: >-
            Deprecated in favor of tool_choice. Controls which function is
            called by the model.
          additionalProperties: true
          type: object
        functions:
          title: Functions
          description: >-
            Deprecated in favor of tools. A list of functions the model may
            generate JSON inputs for.
          items:
            additionalProperties: true
            type: object
          type: array
        logit_bias:
          title: Logit Bias
          description: >-
            Modify the likelihood of specified tokens appearing in the
            completion. Maps tokens to bias values from -100 to 100.
          additionalProperties:
            type: integer
          type: object
        logprobs:
          title: Logprobs
          description: Whether to return log probabilities of the output tokens or not.
          type: boolean
        max_completion_tokens:
          title: Max Completion Tokens
          description: >-
            An upper bound for the number of tokens that can be generated,
            including visible output tokens and reasoning tokens.
          type: integer
        max_tokens:
          title: Max Tokens
          description: >-
            Deprecated in favor of max_completion_tokens. The maximum number of
            tokens to generate.
          type: integer
        metadata:
          title: Metadata
          description: >-
            Developer-defined tags and values used for filtering completions in
            the dashboard.
          additionalProperties:
            type: string
          type: object
        modalities:
          title: Modalities
          description: >-
            Output types that you would like the model to generate for this
            request.
          items:
            type: string
          type: array
        'n':
          title: 'N'
          description: How many chat completion choices to generate for each input message.
          type: integer
        parallel_tool_calls:
          title: Parallel Tool Calls
          description: Whether to enable parallel function calling during tool use.
          type: boolean
        prediction:
          title: Prediction
          description: >-
            Static predicted output content, such as the content of a text file
            being regenerated.
          additionalProperties: true
          type: object
        presence_penalty:
          title: Presence Penalty
          description: >-
            Number between -2.0 and 2.0. Positive values penalize tokens based
            on whether they appear in the text so far.
          type: number
          maximum: 2
          minimum: -2
        reasoning_effort:
          title: Reasoning Effort
          description: >-
            For o1 models only. Constrains effort on reasoning. Values: low,
            medium, high.
          type: string
        response_format:
          title: Response Format
          description: An object specifying the format that the model must output.
          additionalProperties: true
          type: object
        seed:
          title: Seed
          description: >-
            If specified, system will attempt to sample deterministically for
            repeated requests with same seed.
          type: integer
        stop:
          anyOf:
            - type: string
            - items:
                type: string
              type: array
          title: Stop
          description: Up to 4 sequences where the API will stop generating further tokens.
        store:
          title: Store
          description: >-
            Whether to store the output for use in model distillation or evals
            products.
          type: boolean
        stream:
          title: Stream
          description: If true, partial message deltas will be sent as server-sent events.
          type: boolean
        stream_options:
          title: Stream Options
          description: Options for streaming response. Only set this when stream is true.
          additionalProperties: true
          type: object
        temperature:
          title: Temperature
          description: >-
            What sampling temperature to use. Higher values make output more
            random, lower more focused.
          type: number
          maximum: 2
          minimum: 0
        tool_choice:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
          title: Tool Choice
          description: >-
            Controls which tool is called by the model. Values: none, auto,
            required, or specific tool.
        tools:
          title: Tools
          description: >-
            A list of tools the model may call. Currently, only functions are
            supported. Max 128 functions.
          items:
            additionalProperties: true
            type: object
          type: array
        top_logprobs:
          title: Top Logprobs
          description: >-
            Number of most likely tokens to return at each position, with
            associated log probability.
          type: integer
          maximum: 20
          minimum: 0
        top_p:
          title: Top P
          description: >-
            Alternative to temperature. Only tokens comprising top_p probability
            mass are considered.
          type: number
          maximum: 1
          minimum: 0
        audio:
          title: Audio
          description: >-
            Parameters for audio output. Required when audio output is requested
            with modalities: ['audio'].
          additionalProperties: true
          type: object
        model:
          type: string
          title: Model
          description: model specified as `model_vendor/model`, for example `openai/gpt-4o`
        messages:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Messages
          description: openai standard message format
      additionalProperties: true
      type: object
      required:
        - model
        - messages
      title: ChatCompletionRequest
    ChatCompletion:
      properties:
        id:
          type: string
          title: Id
        object:
          type: string
          const: chat.completion
          title: Object
          default: chat.completion
        choices:
          items:
            $ref: '#/components/schemas/openai__types__chat__chat_completion__Choice'
          type: array
          title: Choices
        created:
          type: integer
          title: Created
        model:
          type: string
          title: Model
        service_tier:
          title: Service Tier
          type: string
          enum:
            - auto
            - default
            - flex
            - scale
            - priority
        system_fingerprint:
          title: System Fingerprint
          type: string
        usage:
          $ref: '#/components/schemas/CompletionUsage'
      additionalProperties: true
      type: object
      required:
        - id
        - choices
        - created
        - model
    ChatCompletionChunk:
      properties:
        id:
          type: string
          title: Id
        object:
          type: string
          const: chat.completion.chunk
          title: Object
          default: chat.completion.chunk
        choices:
          items:
            $ref: >-
              #/components/schemas/openai__types__chat__chat_completion_chunk__Choice
          type: array
          title: Choices
        created:
          type: integer
          title: Created
        model:
          type: string
          title: Model
        service_tier:
          title: Service Tier
          type: string
          enum:
            - auto
            - default
            - flex
            - scale
            - priority
        system_fingerprint:
          title: System Fingerprint
          type: string
        usage:
          $ref: '#/components/schemas/CompletionUsage'
      additionalProperties: true
      type: object
      required:
        - id
        - choices
        - created
        - model
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    openai__types__chat__chat_completion__Choice:
      properties:
        finish_reason:
          type: string
          enum:
            - stop
            - length
            - tool_calls
            - content_filter
            - function_call
          title: Finish Reason
        index:
          type: integer
          title: Index
        logprobs:
          $ref: '#/components/schemas/ChoiceLogprobs'
        message:
          $ref: '#/components/schemas/ChatCompletionMessage'
      additionalProperties: true
      type: object
      required:
        - finish_reason
        - index
        - message
      title: Choice
    CompletionUsage:
      properties:
        completion_tokens:
          type: integer
          title: Completion Tokens
        prompt_tokens:
          type: integer
          title: Prompt Tokens
        total_tokens:
          type: integer
          title: Total Tokens
        completion_tokens_details:
          $ref: '#/components/schemas/CompletionTokensDetails'
        prompt_tokens_details:
          $ref: '#/components/schemas/PromptTokensDetails'
      additionalProperties: true
      type: object
      required:
        - completion_tokens
        - prompt_tokens
        - total_tokens
      title: CompletionUsage
      description: Usage statistics for the completion request.
    openai__types__chat__chat_completion_chunk__Choice:
      properties:
        delta:
          $ref: '#/components/schemas/ChoiceDelta'
        finish_reason:
          type: string
          enum:
            - stop
            - length
            - tool_calls
            - content_filter
            - function_call
          title: Finish Reason
        index:
          type: integer
          title: Index
        logprobs:
          $ref: '#/components/schemas/ChoiceLogprobs'
      additionalProperties: true
      type: object
      required:
        - delta
        - index
      title: Choice
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          title: Error Type
          type: string
        input:
          title: Input
        ctx:
          type: object
          title: Context
          additionalProperties: true
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ChoiceLogprobs:
      properties:
        content:
          title: Content
          items:
            $ref: '#/components/schemas/ChatCompletionTokenLogprob'
          type: array
        refusal:
          title: Refusal
          items:
            $ref: '#/components/schemas/ChatCompletionTokenLogprob'
          type: array
      additionalProperties: true
      type: object
      title: ChoiceLogprobs
      description: Log probability information for the choice.
    ChatCompletionMessage:
      properties:
        content:
          title: Content
          type: string
        refusal:
          title: Refusal
          type: string
        role:
          type: string
          const: assistant
          title: Role
        annotations:
          title: Annotations
          items:
            $ref: '#/components/schemas/Annotation'
          type: array
        audio:
          $ref: '#/components/schemas/ChatCompletionAudio'
        function_call:
          $ref: '#/components/schemas/FunctionCall'
        tool_calls:
          title: Tool Calls
          items:
            anyOf:
              - $ref: '#/components/schemas/ChatCompletionMessageFunctionToolCall'
              - $ref: '#/components/schemas/ChatCompletionMessageCustomToolCall'
          type: array
      additionalProperties: true
      type: object
      required:
        - role
      title: ChatCompletionMessage
      description: A chat completion message generated by the model.
    CompletionTokensDetails:
      properties:
        accepted_prediction_tokens:
          title: Accepted Prediction Tokens
          type: integer
        audio_tokens:
          title: Audio Tokens
          type: integer
        reasoning_tokens:
          title: Reasoning Tokens
          type: integer
        rejected_prediction_tokens:
          title: Rejected Prediction Tokens
          type: integer
      additionalProperties: true
      type: object
      title: CompletionTokensDetails
      description: Breakdown of tokens used in a completion.
    PromptTokensDetails:
      properties:
        audio_tokens:
          title: Audio Tokens
          type: integer
        cached_tokens:
          type: integer
          title: Cached Tokens
      additionalProperties: true
      type: object
      title: PromptTokensDetails
      description: Breakdown of tokens used in the prompt.
    ChoiceDelta:
      properties:
        content:
          title: Content
          type: string
        function_call:
          $ref: '#/components/schemas/ChoiceDeltaFunctionCall'
        refusal:
          title: Refusal
          type: string
        role:
          title: Role
          type: string
          enum:
            - developer
            - system
            - user
            - assistant
            - tool
        tool_calls:
          title: Tool Calls
          items:
            $ref: '#/components/schemas/ChoiceDeltaToolCall'
          type: array
      additionalProperties: true
      type: object
      title: ChoiceDelta
      description: A chat completion delta generated by streamed model responses.
    ChatCompletionTokenLogprob:
      properties:
        token:
          type: string
          title: Token
        bytes:
          title: Bytes
          items:
            type: integer
          type: array
        logprob:
          type: number
          title: Logprob
        top_logprobs:
          items:
            $ref: '#/components/schemas/TopLogprob'
          type: array
          title: Top Logprobs
      additionalProperties: true
      type: object
      required:
        - token
        - logprob
        - top_logprobs
      title: ChatCompletionTokenLogprob
    Annotation:
      properties:
        type:
          type: string
          const: url_citation
          title: Type
        url_citation:
          $ref: >-
            #/components/schemas/openai__types__chat__chat_completion_message__AnnotationURLCitation
      additionalProperties: true
      type: object
      required:
        - type
        - url_citation
      title: Annotation
      description: A URL citation when using web search.
    ChatCompletionAudio:
      properties:
        id:
          type: string
          title: Id
        data:
          type: string
          title: Data
        expires_at:
          type: integer
          title: Expires At
        transcript:
          type: string
          title: Transcript
      additionalProperties: true
      type: object
      required:
        - id
        - data
        - expires_at
        - transcript
      title: ChatCompletionAudio
      description: >-
        If the audio output modality is requested, this object contains data

        about the audio response from the model. [Learn
        more](https://platform.openai.com/docs/guides/audio).
    FunctionCall:
      properties:
        arguments:
          title: Arguments
          type: string
        name:
          type: string
          title: Name
      additionalProperties: true
      type: object
      required:
        - arguments
        - name
      title: FunctionCall
      description: >-
        Deprecated and replaced by `tool_calls`.


        The name and arguments of a function that should be called, as generated
        by the model.
    ChatCompletionMessageFunctionToolCall:
      properties:
        id:
          type: string
          title: Id
        function:
          $ref: '#/components/schemas/Function'
        type:
          type: string
          const: function
          title: Type
      additionalProperties: true
      type: object
      required:
        - id
        - function
        - type
      title: ChatCompletionMessageFunctionToolCall
      description: A call to a function tool created by the model.
    ChatCompletionMessageCustomToolCall:
      properties:
        id:
          type: string
          title: Id
        custom:
          $ref: '#/components/schemas/Custom'
        type:
          type: string
          const: custom
          title: Type
      additionalProperties: true
      type: object
      required:
        - id
        - custom
        - type
      title: ChatCompletionMessageCustomToolCall
      description: A call to a custom tool created by the model.
    ChoiceDeltaFunctionCall:
      properties:
        arguments:
          title: Arguments
          type: string
        name:
          type: string
          title: Name
      additionalProperties: true
      type: object
      title: ChoiceDeltaFunctionCall
      description: >-
        Deprecated and replaced by `tool_calls`.


        The name and arguments of a function that should be called, as generated
        by the model.
    ChoiceDeltaToolCall:
      properties:
        index:
          type: integer
          title: Index
        id:
          type: string
          title: Id
        function:
          $ref: '#/components/schemas/ChoiceDeltaToolCallFunction'
        type:
          type: string
          const: function
          title: Type
      additionalProperties: true
      type: object
      required:
        - index
      title: ChoiceDeltaToolCall
    TopLogprob:
      properties:
        token:
          type: string
          title: Token
        bytes:
          title: Bytes
          items:
            type: integer
          type: array
        logprob:
          type: number
          title: Logprob
      additionalProperties: true
      type: object
      required:
        - token
        - logprob
      title: TopLogprob
    openai__types__chat__chat_completion_message__AnnotationURLCitation:
      properties:
        end_index:
          type: integer
          title: End Index
        start_index:
          type: integer
          title: Start Index
        title:
          type: string
          title: Title
        url:
          type: string
          title: Url
      additionalProperties: true
      type: object
      required:
        - end_index
        - start_index
        - title
        - url
      title: AnnotationURLCitation
      description: A URL citation when using web search.
    Function:
      properties:
        arguments:
          title: Arguments
          type: string
        name:
          type: string
          title: Name
      additionalProperties: true
      type: object
      required:
        - arguments
        - name
      title: Function
      description: The function that the model called.
    Custom:
      properties:
        input:
          type: string
          title: Input
        name:
          type: string
          title: Name
      additionalProperties: true
      type: object
      required:
        - input
        - name
      title: Custom
      description: The custom tool that the model called.
    ChoiceDeltaToolCallFunction:
      properties:
        arguments:
          title: Arguments
          type: string
        name:
          type: string
          title: Name
      additionalProperties: true
      type: object
      title: ChoiceDeltaToolCallFunction
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````