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

# Completions

> Sends a prompt to an OpenAI compatible completion model and returns a completion. Provides completions for open source models that are `text-generation`, `chat`, `audio-text-to-text`, `image-text-to-text`, `video-text-to-text`, and also supports closed source providers `openai`, `anthropic`, `mistral`, `cohere`, and `google`. To send a request to a closed source provider, prefix your model with their provider name, e.g. `openai/gpt-4`.



## OpenAPI

````yaml post /models/v2/openai/v1/completions
openapi: 3.1.0
info:
  title: OpenAI Compatible Models API
  description: >-
    API endpoints compatible with OpenAI Chat Completions, Completions, and the
    newer Responses API for running models.
  version: 1.1.0
servers:
  - url: https://api.bytez.com
security: []
paths:
  /models/v2/openai/v1/completions:
    post:
      summary: Completions
      description: >-
        Sends a prompt to an OpenAI compatible completion model and returns a
        completion. Provides completions for open source models that are
        `text-generation`, `chat`, `audio-text-to-text`, `image-text-to-text`,
        `video-text-to-text`, and also supports closed source providers
        `openai`, `anthropic`, `mistral`, `cohere`, and `google`. To send a
        request to a closed source provider, prefix your model with their
        provider name, e.g. `openai/gpt-4`.
      operationId: runTextCompletion
      parameters:
        - name: Authorization
          in: header
          description: Token for authentication
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompletionsRequest'
      responses:
        '200':
          description: Successful text completion
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompletionsResponse'
        '400':
          description: Bad request
        '500':
          description: Internal server error
components:
  schemas:
    CompletionsRequest:
      type: object
      properties:
        model:
          type: string
          description: The ID of the completion model to run (e.g., `text-davinci-003`)
        prompt:
          type: string
          description: The input text prompt
        max_tokens:
          type: integer
          description: Maximum number of tokens to generate
          default: 256
        temperature:
          type: number
          description: Sampling temperature
          default: 0.7
        stream:
          type: boolean
          description: Whether to stream responses
          default: false
        top_p:
          type: number
          description: Nucleus sampling parameter
        presence_penalty:
          type: number
          description: Penalize new tokens based on whether they appear in the text so far
        frequency_penalty:
          type: number
          description: >-
            Penalize new tokens based on their existing frequency in the text so
            far
        logprobs:
          type: integer
          description: >-
            Include the log probabilities on the `logprobs` most likely output
            tokens (legacy-style)
      required:
        - model
        - prompt
    CompletionsResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
        created:
          type: integer
        choices:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              text:
                type: string
              finish_reason:
                type: string

````