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

# Completions



## OpenAPI

````yaml https://api.dev-sgp.scale.com/openapi-versions/v5/openapi.json post /v5/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/completions:
    post:
      tags:
        - Inference
      summary: Completions
      operationId: POST-V5-/v5/completions
      parameters:
        - 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/CompletionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Completion'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    CompletionRequest:
      properties:
        stream:
          title: Stream
          description: >-
            Whether to stream back partial progress. If set, tokens will be sent
            as data-only server-sent events.
          type: boolean
        best_of:
          title: Best Of
          description: >-
            Generates best_of completions server-side and returns the best one.
            Must be greater than n when used together.
          type: integer
        echo:
          title: Echo
          description: Echo back the prompt in addition to the completion
          type: boolean
        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.
          type: number
        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: >-
            Include log probabilities of the most likely tokens. Maximum value
            is 5.
          type: integer
        max_tokens:
          title: Max Tokens
          description: >-
            The maximum number of tokens that can be generated in the
            completion.
          type: integer
        'n':
          title: 'N'
          description: How many completions to generate for each prompt.
          type: integer
        presence_penalty:
          title: Presence Penalty
          description: >-
            Number between -2.0 and 2.0. Positive values penalize new tokens
            based on their presence in the text so far.
          type: number
        seed:
          title: Seed
          description: >-
            If specified, attempts to generate deterministic samples.
            Determinism is not guaranteed.
          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.
        stream_options:
          title: Stream Options
          description: Options for streaming response. Only set this when stream is True.
          additionalProperties: true
          type: object
        suffix:
          title: Suffix
          description: >-
            The suffix that comes after a completion of inserted text. Only
            supported for gpt-3.5-turbo-instruct.
          type: string
        temperature:
          title: Temperature
          description: >-
            Sampling temperature between 0 and 2. Higher values make output more
            random, lower more focused.
          type: number
        top_p:
          title: Top P
          description: >-
            Alternative to temperature. Consider only tokens with top_p
            probability mass. Range 0-1.
          type: number
        user:
          title: User
          description: >-
            A unique identifier representing your end-user, which can help
            OpenAI monitor and detect abuse.
          type: string
        model:
          type: string
          title: Model
          description: model specified as `model_vendor/model`, for example `openai/gpt-4o`
        prompt:
          anyOf:
            - type: string
            - items:
                type: string
              type: array
          title: Prompt
          description: The prompt to generate completions for, encoded as a string
      additionalProperties: true
      type: object
      required:
        - model
        - prompt
      title: CompletionRequest
    Completion:
      properties:
        id:
          type: string
          title: Id
        object:
          type: string
          const: text_completion
          title: Object
          default: text_completion
        choices:
          items:
            $ref: '#/components/schemas/CompletionChoice'
          type: array
          title: Choices
        created:
          type: integer
          title: Created
        model:
          type: string
          title: Model
        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
    CompletionChoice:
      properties:
        finish_reason:
          type: string
          enum:
            - stop
            - length
            - content_filter
          title: Finish Reason
        index:
          type: integer
          title: Index
        logprobs:
          $ref: '#/components/schemas/Logprobs'
        text:
          type: string
          title: Text
      additionalProperties: true
      type: object
      required:
        - finish_reason
        - index
        - text
      title: CompletionChoice
    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.
    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
    Logprobs:
      properties:
        text_offset:
          title: Text Offset
          items:
            type: integer
          type: array
        token_logprobs:
          title: Token Logprobs
          items:
            type: number
          type: array
        tokens:
          title: Tokens
          items:
            type: string
          type: array
        top_logprobs:
          title: Top Logprobs
          items:
            additionalProperties:
              type: number
            type: object
          type: array
      additionalProperties: true
      type: object
      title: Logprobs
    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.
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````