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

# Chat Completions

> Handle chat completion requests.

Supports both authenticated and public (unauthenticated) requests.
Guest users are limited to 10 chats/day per browser id.
Authenticated free users are not subject to a daily chat cap after they sign in.

<RequestExample>
  ```python Python theme={"theme":{"light":"github-light","dark":"dark-plus"}}
  !pip install vlmrun

  from vlmrun.client import VLMRun

  # Initialize the VLM Run client
  client = VLMRun(api_key="<VLMRUN_API_KEY>")

  # Create a chat completion
  response = client.agent.completions.create(
    model="vlmrun-orion-1:auto",
    messages=[{"role": "user", "content": "Who are you and what can you do?"}],
    temperature=0.7,
  )
  ```

  ```python Python (OpenAI SDK) theme={"theme":{"light":"github-light","dark":"dark-plus"}}
  import openai

  # Initialize the OpenAI client
  client = openai.OpenAI(
      base_url="https://api.vlm.run/v1/openai",
      api_key="<VLMRUN_API_KEY>"
  )

  # Create a chat completion
  response = client.chat.completions.create(
      model="vlmrun-orion-1:auto",
      messages=[{"role": "user", "content": "Who are you and what can you do?"}],
      temperature=0.7,
  )
  ```

  ```typescript Node.js SDK theme={"theme":{"light":"github-light","dark":"dark-plus"}}
  import { VlmRun } from "vlmrun";

  // Initialize the VLM Run client
  const client = new VlmRun({
    baseURL: "https://api.vlm.run/v1",
    apiKey: "<VLMRUN_API_KEY>"
  });

  // Create a chat completion
  const response = await client.agent.completions.create({
    model: "vlmrun-orion-1:auto",
    messages: [{ role: "user", content: "Who are you and what can you do?" }],
    temperature: 0.7,
  });
  console.log(response);
  ```
</RequestExample>


## OpenAPI

````yaml POST /v1/openai/chat/completions
openapi: 3.1.0
info:
  title: VLM Run Gateway API
  summary: Unified gateway for real-time vision-language inference.
  description: |
    The **VLM Run Gateway API** is the public entry point to the VLM Run
    inference platform. It fronts vision-language and computer-vision models
    behind a single OpenAI-compatible surface plus first-class real-time
    transports.

    [Terms of service](https://vlm.run/terms) |
    [VLM Run](https://vlm.run) |
    [Send email to support@vlm.run](mailto:support@vlm.run)
  termsOfService: https://vlm.run/terms
  contact:
    name: VLM Run
    url: https://vlm.run/
    email: support@vlm.run
  version: 0.10.0
servers:
  - url: https://gateway.vlm.run
    description: Production
  - url: http://localhost:8001
    description: Local development
security: []
paths:
  /v1/openai/chat/completions:
    post:
      summary: Chat Completions
      operationId: chat_completions_v1_openai_chat_completions_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            example: {}
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ChatCompletionRequest:
      properties:
        model:
          type: string
          title: Model
        messages:
          items:
            $ref: '#/components/schemas/ChatMessage'
          type: array
          title: Messages
        temperature:
          type: number
          title: Temperature
          default: 0.7
        max_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Tokens
        top_p:
          type: number
          title: Top P
          default: 1
        frequency_penalty:
          type: number
          title: Frequency Penalty
          default: 0
        presence_penalty:
          type: number
          title: Presence Penalty
          default: 0
        stop:
          anyOf:
            - type: string
            - items:
                type: string
              type: array
            - type: 'null'
          title: Stop
        stream:
          type: boolean
          title: Stream
          default: false
        'n':
          type: integer
          title: 'N'
          default: 1
        llm:
          anyOf:
            - type: string
            - type: 'null'
          title: Llm
        method:
          anyOf:
            - type: string
            - type: 'null'
          title: Method
        method_params:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Method Params
        video_max_frames:
          anyOf:
            - type: integer
            - type: 'null'
          title: Video Max Frames
        video_fps:
          anyOf:
            - type: number
            - type: 'null'
          title: Video Fps
        image_resolution:
          anyOf:
            - type: string
              enum:
                - 224x224
                - 336x336
                - 384x384
                - 448x448
                - 512x512
                - 768x768
            - type: 'null'
          title: Image Resolution
        video_resolution:
          anyOf:
            - type: string
              enum:
                - 256x192
                - 320x240
                - 448x336
                - 512x384
                - 640x480
            - type: 'null'
          title: Video Resolution
        document_dpi:
          anyOf:
            - type: integer
            - type: 'null'
          title: Document Dpi
        document_max_pages:
          anyOf:
            - type: integer
            - type: 'null'
          title: Document Max Pages
      type: object
      required:
        - model
        - messages
      title: ChatCompletionRequest
      description: OpenAI-compatible chat completion request.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ChatMessage:
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
          title: Role
        content:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/ContentPart'
              type: array
          title: Content
      type: object
      required:
        - role
        - content
      title: ChatMessage
      description: A single message in the conversation.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ContentPart:
      properties:
        type:
          type: string
          enum:
            - text
            - image_url
            - video_url
            - document_url
            - file_url
          title: Type
        text:
          anyOf:
            - type: string
            - type: 'null'
          title: Text
        image_url:
          anyOf:
            - $ref: '#/components/schemas/ImageUrl'
            - type: 'null'
        video_url:
          anyOf:
            - $ref: '#/components/schemas/VideoUrl'
            - type: 'null'
        document_url:
          anyOf:
            - $ref: '#/components/schemas/DocumentUrl'
            - type: 'null'
        file_url:
          anyOf:
            - $ref: '#/components/schemas/FileUrl'
            - type: 'null'
      type: object
      required:
        - type
      title: ContentPart
      description: A single content part in a multi-modal message.
    ImageUrl:
      properties:
        url:
          type: string
          title: Url
        detail:
          type: string
          enum:
            - auto
            - low
            - high
          title: Detail
          default: auto
      type: object
      required:
        - url
      title: ImageUrl
    VideoUrl:
      properties:
        url:
          type: string
          title: Url
      type: object
      required:
        - url
      title: VideoUrl
    DocumentUrl:
      properties:
        url:
          type: string
          title: Url
      type: object
      required:
        - url
      title: DocumentUrl
      description: PDF document referenced by URL or base64 data URI.
    FileUrl:
      properties:
        url:
          type: string
          title: Url
      type: object
      required:
        - url
      title: FileUrl
      description: Alias for :class:`DocumentUrl` — accepted for PDF document inputs.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````