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

# Deployment Chat Completion

> Test this exact deployment without changing the slug's production target.



## OpenAPI

````yaml /openapi.json post /api/v1/deploy/{deployment_id}/chat/completions
openapi: 3.1.0
info:
  title: Trajectory API
  version: 0.1.0
  x-trajectory-api-version: '2026-10-14'
  description: >-
    This contract is API version 2026-10-14. The optional Trajectory-API-Version
    header pins it, and tmp-contract is accepted as an alias. Requests without
    the header get this version. Version 2026-10-07 and the pre-launch legacy
    response formats are retired.
servers:
  - url: https://api.trajectory.ai
security: []
tags:
  - name: agents
    x-group: Agents
  - name: benchmarks
    x-group: Specs (benchmarks)
  - name: diagnostics
    x-group: Diagnostics
  - name: benchmark-ingestion
    x-group: Spec (benchmark) submissions
  - name: eval
    x-group: Evaluations
  - name: training
    x-group: Training
  - name: deployments
    x-group: Deployments
  - name: model-endpoints
    x-group: Model endpoints
  - name: inference
    x-group: Inference
  - name: trajectories
    x-group: Trajectories
  - name: artifacts
    x-group: Artifacts
  - name: telemetry
    x-group: Telemetry
  - name: supported-models
    x-group: Supported models
  - name: organizations
    x-group: Organizations
  - name: secrets
    x-group: Secrets
paths:
  /api/v1/deploy/{deployment_id}/chat/completions:
    post:
      tags:
        - deployments
        - inference
      summary: Deployment Chat Completion
      description: >-
        Test this exact deployment without changing the slug's production
        target.
      operationId: createDeploymentChatCompletion
      parameters:
        - name: deployment_id
          in: path
          required: true
          schema:
            type: string
            title: Deployment Id
        - name: X-Trajectory-Id
          in: header
          required: true
          schema:
            type: string
            minLength: 1
            title: X-Trajectory-Id
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Idempotency-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/ChatCompletionChunk'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InferenceErrorEnvelope'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InferenceErrorEnvelope'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InferenceErrorEnvelope'
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InferenceErrorEnvelope'
          description: Conflict
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InferenceErrorEnvelope'
          description: Too Many Requests
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InferenceErrorEnvelope'
          description: Internal Server Error
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InferenceErrorEnvelope'
          description: Bad Gateway
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InferenceErrorEnvelope'
          description: Service Unavailable
        '504':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InferenceErrorEnvelope'
          description: Gateway Timeout
      security:
        - InferenceAuthorization: []
        - ApiKeyAuth: []
components:
  schemas:
    ChatCompletionRequest:
      properties:
        model:
          type: string
          title: Model
        messages:
          items:
            $ref: '#/components/schemas/ChatMessage'
          type: array
          title: Messages
        stream:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Stream
          default: false
        disable_thinking:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Disable Thinking
        temperature:
          anyOf:
            - type: number
            - type: 'null'
          title: Temperature
        max_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Tokens
          description: Maximum generated tokens, including reasoning tokens when emitted.
        top_p:
          anyOf:
            - type: number
            - type: 'null'
          title: Top P
      additionalProperties: true
      type: object
      required:
        - model
        - messages
      title: ChatCompletionRequest
    ChatCompletionResponse:
      properties:
        id:
          type: string
          title: Id
        object:
          type: string
          title: Object
        created:
          type: integer
          title: Created
        model:
          type: string
          title: Model
        choices:
          items:
            $ref: '#/components/schemas/ChatCompletionChoice'
          type: array
          title: Choices
        usage:
          anyOf:
            - $ref: '#/components/schemas/Usage'
            - type: 'null'
      additionalProperties: true
      type: object
      required:
        - id
        - object
        - created
        - model
        - choices
      title: ChatCompletionResponse
    ChatCompletionChunk:
      additionalProperties: true
      properties:
        id:
          type: string
          title: Id
        object:
          type: string
          title: Object
        created:
          type: integer
          title: Created
        model:
          type: string
          title: Model
        choices:
          items:
            $ref: '#/components/schemas/ChatCompletionChunkChoice'
          title: Choices
          type: array
        usage:
          anyOf:
            - $ref: '#/components/schemas/Usage'
            - type: 'null'
        service_tier:
          anyOf:
            - type: string
            - type: 'null'
          title: Service Tier
        system_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: System Fingerprint
      required:
        - id
        - object
        - created
        - model
        - choices
      title: ChatCompletionChunk
      type: object
    InferenceErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/InferenceErrorDetail'
      type: object
      required:
        - error
      title: InferenceErrorEnvelope
    ChatMessage:
      properties:
        role:
          type: string
          title: Role
        content:
          anyOf:
            - type: string
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Content
      additionalProperties: true
      type: object
      required:
        - role
      title: ChatMessage
    ChatCompletionChoice:
      properties:
        index:
          type: integer
          title: Index
        message:
          $ref: '#/components/schemas/ChatCompletionResponseMessage'
        finish_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Finish Reason
        logprobs:
          anyOf:
            - $ref: '#/components/schemas/ChatCompletionChoiceLogprobs'
            - type: 'null'
      additionalProperties: true
      type: object
      required:
        - index
        - message
      title: ChatCompletionChoice
    Usage:
      properties:
        prompt_tokens:
          type: integer
          title: Prompt Tokens
        completion_tokens:
          type: integer
          title: Completion Tokens
        total_tokens:
          type: integer
          title: Total Tokens
        completion_tokens_details:
          anyOf:
            - $ref: '#/components/schemas/CompletionTokensDetails'
            - type: 'null'
        prompt_tokens_details:
          anyOf:
            - $ref: '#/components/schemas/PromptTokensDetails'
            - type: 'null'
      additionalProperties: true
      type: object
      required:
        - prompt_tokens
        - completion_tokens
        - total_tokens
      title: Usage
    ChatCompletionChunkChoice:
      additionalProperties: true
      properties:
        index:
          type: integer
          title: Index
        delta:
          $ref: '#/components/schemas/ChatCompletionChunkDelta'
        finish_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Finish Reason
        logprobs:
          anyOf:
            - $ref: '#/components/schemas/ChatCompletionChoiceLogprobs'
            - type: 'null'
      required:
        - index
        - delta
      title: ChatCompletionChunkChoice
      type: object
    InferenceErrorDetail:
      properties:
        message:
          type: string
          title: Message
        type:
          type: string
          title: Type
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
      type: object
      required:
        - message
        - type
      title: InferenceErrorDetail
    ChatCompletionResponseMessage:
      properties:
        role:
          type: string
          title: Role
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
        tool_calls:
          anyOf:
            - items:
                $ref: '#/components/schemas/ChatCompletionResponseToolCall'
              type: array
            - type: 'null'
          title: Tool Calls
        function_call:
          anyOf:
            - $ref: '#/components/schemas/ChatCompletionResponseFunction'
            - type: 'null'
      additionalProperties: true
      type: object
      required:
        - role
        - content
      title: ChatCompletionResponseMessage
    ChatCompletionChoiceLogprobs:
      properties:
        content:
          anyOf:
            - items:
                $ref: '#/components/schemas/ChatCompletionTokenLogprob'
              type: array
            - type: 'null'
          title: Content
        refusal:
          anyOf:
            - items:
                $ref: '#/components/schemas/ChatCompletionTokenLogprob'
              type: array
            - type: 'null'
          title: Refusal
      additionalProperties: true
      type: object
      title: ChatCompletionChoiceLogprobs
    CompletionTokensDetails:
      properties:
        accepted_prediction_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Accepted Prediction Tokens
        audio_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Audio Tokens
        reasoning_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Reasoning Tokens
        rejected_prediction_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Rejected Prediction Tokens
      additionalProperties: true
      type: object
      title: CompletionTokensDetails
    PromptTokensDetails:
      properties:
        audio_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Audio Tokens
        cached_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Cached Tokens
      additionalProperties: true
      type: object
      title: PromptTokensDetails
    ChatCompletionChunkDelta:
      additionalProperties: true
      properties:
        role:
          anyOf:
            - type: string
            - type: 'null'
          title: Role
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
        refusal:
          anyOf:
            - type: string
            - type: 'null'
          title: Refusal
        function_call:
          anyOf:
            - $ref: '#/components/schemas/ChatCompletionChunkFunction'
            - type: 'null'
        tool_calls:
          anyOf:
            - items:
                $ref: '#/components/schemas/ChatCompletionChunkToolCall'
              type: array
            - type: 'null'
          title: Tool Calls
      title: ChatCompletionChunkDelta
      type: object
    ChatCompletionResponseToolCall:
      properties:
        id:
          type: string
          title: Id
        type:
          type: string
          const: function
          title: Type
        function:
          $ref: '#/components/schemas/ChatCompletionResponseFunction'
      additionalProperties: true
      type: object
      required:
        - id
        - type
        - function
      title: ChatCompletionResponseToolCall
    ChatCompletionResponseFunction:
      properties:
        name:
          type: string
          title: Name
        arguments:
          type: string
          title: Arguments
      additionalProperties: true
      type: object
      required:
        - name
        - arguments
      title: ChatCompletionResponseFunction
    ChatCompletionTokenLogprob:
      properties:
        token:
          type: string
          title: Token
        logprob:
          type: number
          title: Logprob
        bytes:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Bytes
        top_logprobs:
          items:
            $ref: '#/components/schemas/ChatCompletionTokenTopLogprob'
          type: array
          title: Top Logprobs
      additionalProperties: true
      type: object
      required:
        - token
        - logprob
        - top_logprobs
      title: ChatCompletionTokenLogprob
    ChatCompletionChunkFunction:
      additionalProperties: true
      properties:
        arguments:
          anyOf:
            - type: string
            - type: 'null'
          title: Arguments
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
      title: ChatCompletionChunkFunction
      type: object
    ChatCompletionChunkToolCall:
      additionalProperties: true
      properties:
        index:
          type: integer
          title: Index
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        function:
          anyOf:
            - $ref: '#/components/schemas/ChatCompletionChunkFunction'
            - type: 'null'
        type:
          anyOf:
            - const: function
              type: string
            - type: 'null'
          title: Type
      required:
        - index
      title: ChatCompletionChunkToolCall
      type: object
    ChatCompletionTokenTopLogprob:
      properties:
        token:
          type: string
          title: Token
        logprob:
          type: number
          title: Logprob
        bytes:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Bytes
      additionalProperties: true
      type: object
      required:
        - token
        - logprob
      title: ChatCompletionTokenTopLogprob
  securitySchemes:
    InferenceAuthorization:
      type: http
      scheme: bearer
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Organization API key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.