> ## Documentation Index
> Fetch the complete documentation index at: https://portkey-docs-docs-prisma-airs-updates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create chat completion



## OpenAPI

````yaml https://raw.githubusercontent.com/PaloAltoNetworks/openapi/refs/heads/main/openapi.yaml post /chat/completions
openapi: 3.0.0
info:
  title: Prisma AIRS AI Gateway API
  version: 3.0.0
  description: ''
servers:
  - url: https://aigw.portkey.ai/v1
    description: Managed
  - url: https://self-hosted-gateway-url.example.com/v1
    description: Self-hosted -- replace with your own gateway host
security:
  - Authorization: []
tags:
  - name: Assistants
    description: ''
  - name: Audio
    description: ''
  - name: Batch
    description: ''
  - name: Chat
    description: ''
  - name: Completions
    description: ''
  - name: Embeddings
    description: ''
  - name: Files
    description: ''
  - name: Fine-Tuning
    description: ''
  - name: Images
    description: ''
  - name: Model Pricing
    description: ''
  - name: Models
    description: ''
  - name: Moderations
    description: ''
  - name: OCR
    description: ''
  - name: Realtime
    description: ''
  - name: Rerank
    description: ''
  - name: Responses
    description: ''
  - name: Vector Stores
    description: ''
  - name: Configs
    description: ''
  - name: Guardrails
    description: ''
  - name: Integrations
    description: ''
  - name: Integrations > Models
    description: ''
  - name: Integrations > Workspaces
    description: ''
  - name: Providers
    description: ''
  - name: Secret References
    description: ''
  - name: MCP Integrations
    description: ''
  - name: MCP Integrations > Capabilities
    description: ''
  - name: MCP Integrations > Metadata
    description: ''
  - name: MCP Integrations > Workspaces
    description: ''
  - name: MCP Servers
    description: ''
  - name: MCP Servers > Capabilities
    description: ''
  - name: MCP Servers > Connections
    description: ''
  - name: MCP Servers > User Access
    description: ''
  - name: API Keys
    description: ''
  - name: Deployments
    description: ''
  - name: Org Guardrails
    description: ''
  - name: Rate Limit Policies
    description: ''
  - name: Usage Limit Policies
    description: ''
  - name: Analytics > Graphs
    description: ''
  - name: Analytics > Groups
    description: ''
  - name: Analytics > Summary
    description: ''
  - name: Feedback
    description: ''
  - name: Logs
    description: ''
paths:
  /chat/completions:
    post:
      tags:
        - Chat
      operationId: createChatCompletion
      parameters:
        - $ref: '#/components/parameters/PortkeyTraceId'
        - $ref: '#/components/parameters/PortkeySpanId'
        - $ref: '#/components/parameters/PortkeyParentSpanId'
        - $ref: '#/components/parameters/PortkeySpanName'
        - $ref: '#/components/parameters/PortkeyMetadata'
        - $ref: '#/components/parameters/PortkeyCacheNamespace'
        - $ref: '#/components/parameters/PortkeyCacheForceRefresh'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateChatCompletionRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateChatCompletionResponse'
components:
  parameters:
    PortkeyTraceId:
      in: header
      name: x-portkey-trace-id
      schema:
        type: string
      required: false
    PortkeySpanId:
      in: header
      name: x-portkey-span-id
      schema:
        type: string
      required: false
    PortkeyParentSpanId:
      in: header
      name: x-portkey-parent-span-id
      schema:
        type: string
      required: false
    PortkeySpanName:
      in: header
      name: x-portkey-span-name
      schema:
        type: string
      required: false
    PortkeyMetadata:
      in: header
      name: x-portkey-metadata
      schema:
        type: object
      required: false
    PortkeyCacheNamespace:
      in: header
      name: x-portkey-cache-namespace
      schema:
        type: string
    PortkeyCacheForceRefresh:
      in: header
      name: x-portkey-cache-force-refresh
      schema:
        type: boolean
  schemas:
    CreateChatCompletionRequest:
      type: object
      properties:
        messages:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/ChatCompletionRequestMessage'
        model:
          anyOf:
            - type: string
            - type: string
              enum:
                - gpt-5
                - gpt-5-mini
                - gpt-5-nano
                - o4-mini
                - o3
                - o3-mini
                - o1
                - o1-mini
                - gpt-4o
                - gpt-4o-mini
                - gpt-4o-2024-05-13
                - gpt-4-turbo
                - gpt-4-turbo-2024-04-09
                - gpt-4-0125-preview
                - gpt-4-turbo-preview
                - gpt-4-1106-preview
                - gpt-4-vision-preview
                - gpt-4
                - gpt-4-0314
                - gpt-4-0613
                - gpt-4-32k
                - gpt-4-32k-0314
                - gpt-4-32k-0613
                - gpt-3.5-turbo
                - gpt-3.5-turbo-16k
                - gpt-3.5-turbo-0301
                - gpt-3.5-turbo-0613
                - gpt-3.5-turbo-1106
                - gpt-3.5-turbo-0125
                - gpt-3.5-turbo-16k-0613
          x-oaiTypeLabel: string
        frequency_penalty:
          type: number
          default: 0
          minimum: -2
          maximum: 2
          nullable: true
        logit_bias:
          type: object
          x-oaiTypeLabel: map
          nullable: true
          additionalProperties:
            type: integer
        logprobs:
          type: boolean
          default: false
          nullable: true
        top_logprobs:
          type: integer
          minimum: 0
          maximum: 20
          nullable: true
        max_tokens:
          type: integer
          nullable: true
          deprecated: true
        max_completion_tokens:
          type: integer
          nullable: true
        'n':
          type: integer
          minimum: 1
          maximum: 128
          default: 1
          nullable: true
        presence_penalty:
          type: number
          default: 0
          minimum: -2
          maximum: 2
          nullable: true
        response_format:
          type: object
          oneOf:
            - $ref: '#/components/schemas/ResponseFormatText'
            - $ref: '#/components/schemas/ResponseFormatJsonSchema'
            - $ref: '#/components/schemas/ResponseFormatJsonObject'
        seed:
          type: integer
          minimum: -9223372036854776000
          maximum: 9223372036854776000
          nullable: true
        stop:
          oneOf:
            - type: string
              nullable: true
            - type: array
              minItems: 1
              maxItems: 4
              items:
                type: string
        stream:
          type: boolean
          default: false
          nullable: true
        stream_options:
          $ref: '#/components/schemas/ChatCompletionStreamOptions'
        thinking:
          type: object
          nullable: true
          properties:
            type:
              type: string
              enum:
                - enabled
                - disabled
              default: disabled
            budget_tokens:
              type: integer
              minimum: 1
          required:
            - type
        temperature:
          type: number
          minimum: 0
          maximum: 2
          default: 1
          nullable: true
        top_p:
          type: number
          minimum: 0
          maximum: 1
          default: 1
          nullable: true
        tools:
          type: array
          items:
            $ref: '#/components/schemas/ChatCompletionTool'
        tool_choice:
          $ref: '#/components/schemas/ChatCompletionToolChoiceOption'
        parallel_tool_calls:
          $ref: '#/components/schemas/ParallelToolCalls'
        user:
          type: string
        function_call:
          deprecated: true
          oneOf:
            - type: string
              enum:
                - none
                - auto
            - $ref: '#/components/schemas/ChatCompletionFunctionCallOption'
          x-oaiExpandable: true
        functions:
          deprecated: true
          type: array
          minItems: 1
          maxItems: 128
          items:
            $ref: '#/components/schemas/ChatCompletionFunctions'
      required:
        - model
        - messages
    CreateChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
        choices:
          type: array
          items:
            type: object
            required:
              - finish_reason
              - index
              - message
              - logprobs
            properties:
              finish_reason:
                type: string
                enum:
                  - stop
                  - length
                  - tool_calls
                  - content_filter
                  - function_call
              index:
                type: integer
              message:
                $ref: '#/components/schemas/ChatCompletionResponseMessage'
              logprobs:
                type: object
                nullable: true
                properties:
                  content:
                    type: array
                    items:
                      $ref: '#/components/schemas/ChatCompletionTokenLogprob'
                    nullable: true
                required:
                  - content
        created:
          type: integer
        model:
          type: string
        system_fingerprint:
          type: string
        object:
          type: string
          enum:
            - chat.completion
        usage:
          $ref: '#/components/schemas/CompletionUsage'
      required:
        - choices
        - created
        - id
        - model
        - object
    ChatCompletionRequestMessage:
      oneOf:
        - $ref: '#/components/schemas/ChatCompletionRequestSystemMessage'
        - $ref: '#/components/schemas/ChatCompletionRequestDeveloperMessage'
        - $ref: '#/components/schemas/ChatCompletionRequestUserMessage'
        - $ref: '#/components/schemas/ChatCompletionRequestAssistantMessage'
        - $ref: '#/components/schemas/ChatCompletionRequestToolMessage'
        - $ref: '#/components/schemas/ChatCompletionRequestFunctionMessage'
      x-oaiExpandable: true
    ResponseFormatText:
      type: object
      title: Text
      properties:
        type:
          type: string
          enum:
            - text
          x-stainless-const: true
      required:
        - type
    ResponseFormatJsonSchema:
      type: object
      title: JSON schema
      properties:
        type:
          type: string
          enum:
            - json_schema
          x-stainless-const: true
        json_schema:
          type: object
          title: JSON schema
          properties:
            description:
              type: string
            name:
              type: string
            schema:
              $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema'
            strict:
              type: boolean
              default: false
              nullable: true
          required:
            - name
      required:
        - type
        - json_schema
    ResponseFormatJsonObject:
      type: object
      title: JSON object
      properties:
        type:
          type: string
          enum:
            - json_object
          x-stainless-const: true
      required:
        - type
    ChatCompletionStreamOptions:
      type: object
      nullable: true
      properties:
        include_usage:
          type: boolean
    ChatCompletionTool:
      type: object
      properties:
        type:
          type: string
          enum:
            - function
        function:
          $ref: '#/components/schemas/FunctionObject'
      required:
        - type
        - function
    ChatCompletionToolChoiceOption:
      oneOf:
        - type: string
          enum:
            - none
            - auto
            - required
        - $ref: '#/components/schemas/ChatCompletionNamedToolChoice'
      x-oaiExpandable: true
    ParallelToolCalls:
      type: boolean
      default: true
    ChatCompletionFunctionCallOption:
      type: object
      properties:
        name:
          type: string
      required:
        - name
    ChatCompletionFunctions:
      type: object
      deprecated: true
      properties:
        description:
          type: string
        name:
          type: string
        parameters:
          $ref: '#/components/schemas/FunctionParameters'
      required:
        - name
    ChatCompletionResponseMessage:
      type: object
      properties:
        content:
          type: string
          nullable: true
        tool_calls:
          $ref: '#/components/schemas/ChatCompletionMessageToolCalls'
        role:
          type: string
          enum:
            - assistant
        function_call:
          type: object
          deprecated: true
          properties:
            arguments:
              type: string
            name:
              type: string
          required:
            - name
            - arguments
        content_blocks:
          nullable: true
          type: array
          items:
            $ref: '#/components/schemas/ChatCompletionMessageContentBlock'
            type: object
      required:
        - role
        - content
    ChatCompletionTokenLogprob:
      type: object
      properties:
        token:
          type: string
        logprob:
          type: number
        bytes:
          type: array
          items:
            type: integer
          nullable: true
        top_logprobs:
          type: array
          items:
            type: object
            properties:
              token:
                type: string
              logprob:
                type: number
              bytes:
                type: array
                items:
                  type: integer
                nullable: true
            required:
              - token
              - logprob
              - bytes
      required:
        - token
        - logprob
        - bytes
        - top_logprobs
    CompletionUsage:
      type: object
      properties:
        completion_tokens:
          type: integer
        prompt_tokens:
          type: integer
        total_tokens:
          type: integer
        completion_tokens_details:
          type: object
          nullable: true
          properties:
            reasoning_tokens:
              type: integer
            accepted_prediction_tokens:
              type: integer
            rejected_prediction_tokens:
              type: integer
        prompt_tokens_details:
          type: object
          nullable: true
          properties:
            cached_tokens:
              type: integer
      required:
        - prompt_tokens
        - completion_tokens
        - total_tokens
    ChatCompletionRequestSystemMessage:
      type: object
      title: System message
      properties:
        content:
          type: string
        role:
          type: string
          enum:
            - system
        name:
          type: string
      required:
        - content
        - role
    ChatCompletionRequestDeveloperMessage:
      type: object
      title: Developer message
      properties:
        content:
          type: string
        role:
          type: string
          enum:
            - developer
        name:
          type: string
      required:
        - content
        - role
    ChatCompletionRequestUserMessage:
      type: object
      title: User message
      properties:
        content:
          oneOf:
            - type: string
              title: Text content
            - type: array
              title: Array of content parts
              items:
                $ref: '#/components/schemas/ChatCompletionRequestMessageContentPart'
              minItems: 1
          x-oaiExpandable: true
        role:
          type: string
          enum:
            - user
        name:
          type: string
      required:
        - content
        - role
    ChatCompletionRequestAssistantMessage:
      type: object
      title: Assistant message
      properties:
        content:
          type: string
          nullable: true
        role:
          type: string
          enum:
            - assistant
        name:
          type: string
        tool_calls:
          $ref: '#/components/schemas/ChatCompletionMessageToolCalls'
        function_call:
          type: object
          deprecated: true
          nullable: true
          properties:
            arguments:
              type: string
            name:
              type: string
          required:
            - arguments
            - name
      required:
        - role
    ChatCompletionRequestToolMessage:
      type: object
      title: Tool message
      properties:
        role:
          type: string
          enum:
            - tool
        content:
          type: string
        tool_call_id:
          type: string
      required:
        - role
        - content
        - tool_call_id
    ChatCompletionRequestFunctionMessage:
      type: object
      title: Function message
      deprecated: true
      properties:
        role:
          type: string
          enum:
            - function
        content:
          type: string
          nullable: true
        name:
          type: string
      required:
        - role
        - content
        - name
    ResponseFormatJsonSchemaSchema:
      type: object
      title: JSON schema
      additionalProperties: true
    FunctionObject:
      type: object
      properties:
        description:
          type: string
        name:
          type: string
        parameters:
          $ref: '#/components/schemas/FunctionParameters'
        strict:
          type: boolean
          default: false
          nullable: true
      required:
        - name
    ChatCompletionNamedToolChoice:
      type: object
      properties:
        type:
          type: string
          enum:
            - function
        function:
          type: object
          properties:
            name:
              type: string
          required:
            - name
      required:
        - type
        - function
    FunctionParameters:
      type: object
      additionalProperties: true
    ChatCompletionMessageToolCalls:
      type: array
      items:
        $ref: '#/components/schemas/ChatCompletionMessageToolCall'
    ChatCompletionMessageContentBlock:
      type: object
      oneOf:
        - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText'
        - $ref: '#/components/schemas/ChatCompletionMessageContentPartThinking'
        - $ref: >-
            #/components/schemas/ChatCompletionMessageContentPartRedactedThinking
    ChatCompletionRequestMessageContentPart:
      oneOf:
        - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText'
        - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartImage'
      x-oaiExpandable: true
    ChatCompletionMessageToolCall:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - function
        function:
          type: object
          properties:
            name:
              type: string
            arguments:
              type: string
          required:
            - name
            - arguments
      required:
        - id
        - type
        - function
    ChatCompletionRequestMessageContentPartText:
      type: object
      title: Text content part
      properties:
        type:
          type: string
          enum:
            - text
        text:
          type: string
      required:
        - type
        - text
    ChatCompletionMessageContentPartThinking:
      type: object
      title: Thinking content part
      properties:
        type:
          type: string
          enum:
            - thinking
        thinking:
          type: string
      required:
        - type
        - thinking
    ChatCompletionMessageContentPartRedactedThinking:
      type: object
      title: Redacted thinking content part
      properties:
        type:
          type: string
          enum:
            - redacted_thinking
        data:
          type: string
      required:
        - type
        - data
    ChatCompletionRequestMessageContentPartImage:
      type: object
      title: Image content part
      properties:
        type:
          type: string
          enum:
            - image_url
        image_url:
          type: object
          properties:
            url:
              type: string
              format: uri
            detail:
              type: string
              enum:
                - auto
                - low
                - high
              default: auto
          required:
            - url
      required:
        - type
        - image_url
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer

````