---
title: "LiteLLM Compatible Chat Completions"
method: POST
path: "/chat/completions"
tags: ["Integration - LiteLLM"]
---

# LiteLLM Compatible Chat Completions

`POST /chat/completions`

LiteLLM-compatible chat completions endpoint that automatically detects the provider from the model name and converts requests accordingly.

## Request body

- ChatCompletionRequest
  - `model` string, required — Model identifier in 'provider/model' format (e.g., 'openai/gpt-4o-mini', 'anthropic/claude-3-sonnet-20240229')
  - `messages` BifrostMessage[], required — Array of chat messages
    - `role` 'user' | 'assistant' | 'system' | 'tool', required — Role of the message sender
    - `content` union — Message content - can be simple text or structured content with text and images
      - string — Simple text content
      - ContentBlock[] — Structured content with text and images
        - union
          - object
            - `type` 'text', required — Content type for text blocks
            - `text` string, required — Text content
          - object
            - `type` 'image_url', required — Content type for image blocks
            - `image_url` ImageURLStruct, required
              - …
    - `tool_call_id` string — ID of the tool call (for tool messages)
    - `tool_calls` ToolCall[] — Tool calls made by assistant
      - `id` string — Unique tool call identifier
      - `type` 'function' — Tool call type
      - `function` FunctionCall, required
        - `name` string, required — Function name
        - `arguments` string, required — JSON string of function arguments
    - `refusal` string — Refusal message from assistant
    - `annotations` Annotation[] — Message annotations
      - `type` string, required — Annotation type
      - `url_citation` Citation, required
        - `start_index` integer, required — Start index in the text
        - `end_index` integer, required — End index in the text
        - `title` string, required — Citation title
        - `url` string — Citation URL
        - `sources` unknown
        - `type` string — Citation type
    - `thought` string — Assistant's internal thought process
  - `max_tokens` integer — Maximum number of tokens to generate
  - `fallbacks` string[] — Fallback model names in 'provider/model' format

## Response `200`

LiteLLM-compatible chat completion response

- BifrostResponse
  - `id` string — Unique response identifier
  - `object` 'chat.completion' | 'text.completion' — Response type
  - `choices` BifrostResponseChoice[] — Array of completion choices
    - `index` integer, required — Choice index
    - `message` BifrostMessage, required
      - `role` 'user' | 'assistant' | 'system' | 'tool', required — Role of the message sender
      - `content` union — Message content - can be simple text or structured content with text and images
        - string — Simple text content
        - ContentBlock[] — Structured content with text and images
          - union
            - object
              - …
            - object
              - …
      - `tool_call_id` string — ID of the tool call (for tool messages)
      - `tool_calls` ToolCall[] — Tool calls made by assistant
        - `id` string — Unique tool call identifier
        - `type` 'function' — Tool call type
        - `function` FunctionCall, required
          - `name` string, required — Function name
          - `arguments` string, required — JSON string of function arguments
      - `refusal` string — Refusal message from assistant
      - `annotations` Annotation[] — Message annotations
        - `type` string, required — Annotation type
        - `url_citation` Citation, required
          - `start_index` integer, required — Start index in the text
          - `end_index` integer, required — End index in the text
          - `title` string, required — Citation title
          - `url` string — Citation URL
          - `sources` unknown
          - `type` string — Citation type
      - `thought` string — Assistant's internal thought process
    - `finish_reason` 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call' — Reason completion stopped
    - `stop` string — Stop sequence that ended generation
    - `log_probs` LogProbs
      - `content` ContentLogProb[] — Log probabilities for content
        - `bytes` integer[] — Byte representation
        - `logprob` number, required — Log probability
        - `token` string, required — Token
        - `top_logprobs` LogProb[] — Top log probabilities
          - `bytes` integer[] — Byte representation
          - `logprob` number, required — Log probability
          - `token` string, required — Token
      - `refusal` LogProb[] — Log probabilities for refusal
        - `bytes` integer[] — Byte representation
        - `logprob` number, required — Log probability
        - `token` string, required — Token
  - `model` string — Model used for generation
  - `created` integer — Unix timestamp of creation
  - `service_tier` string — Service tier used
  - `system_fingerprint` string — System fingerprint
  - `usage` LLMUsage
    - `prompt_tokens` integer — Tokens in the prompt
    - `completion_tokens` integer — Tokens in the completion
    - `total_tokens` integer — Total tokens used
    - `completion_tokens_details` CompletionTokensDetails
      - `reasoning_tokens` integer — Tokens used for reasoning
      - `audio_tokens` integer — Tokens used for audio
      - `accepted_prediction_tokens` integer — Accepted prediction tokens
      - `rejected_prediction_tokens` integer — Rejected prediction tokens
  - `extra_fields` BifrostResponseExtraFields
    - `provider` 'openai' | 'anthropic' | 'azure' | 'bedrock' | 'cohere' | 'vertex' | 'mistral' | 'ollama' | 'groq' | 'sgl' — AI model provider
    - `model_params` ModelParameters
      - `temperature` number — Controls randomness in the output
      - `top_p` number — Nucleus sampling parameter
      - `top_k` integer — Top-k sampling parameter
      - `max_tokens` integer — Maximum number of tokens to generate
      - `stop_sequences` string[] — Sequences that stop generation
      - `presence_penalty` number — Penalizes repeated tokens
      - `frequency_penalty` number — Penalizes frequent tokens
      - `tools` Tool[] — Available tools for the model
        - `id` string — Unique tool identifier
        - `type` 'function', required — Tool type
        - `function` Function, required
          - `name` string, required — Function name
          - `description` string, required — Function description
          - `parameters` FunctionParameters, required
            - `type` string, required — Parameter type
            - `description` string — Parameter description
            - `properties` object — Parameter properties (JSON Schema)
            - `required` string[] — Required parameter names
            - `enum` string[] — Enum values for parameters
      - `tool_choice` ToolChoice
        - `type` 'none' | 'auto' | 'any' | 'function' | 'required', required — How tools should be chosen
        - `function` ToolChoiceFunction
          - `name` string, required — Name of the function to call
      - `parallel_tool_calls` boolean — Enable parallel tool execution
    - `latency` number — Request latency in seconds
    - `chat_history` BifrostMessage[] — Full conversation history
      - `role` 'user' | 'assistant' | 'system' | 'tool', required — Role of the message sender
      - `content` union — Message content - can be simple text or structured content with text and images
        - string — Simple text content
        - ContentBlock[] — Structured content with text and images
          - union
            - object
              - …
            - object
              - …
      - `tool_call_id` string — ID of the tool call (for tool messages)
      - `tool_calls` ToolCall[] — Tool calls made by assistant
        - `id` string — Unique tool call identifier
        - `type` 'function' — Tool call type
        - `function` FunctionCall, required
          - `name` string, required — Function name
          - `arguments` string, required — JSON string of function arguments
      - `refusal` string — Refusal message from assistant
      - `annotations` Annotation[] — Message annotations
        - `type` string, required — Annotation type
        - `url_citation` Citation, required
          - `start_index` integer, required — Start index in the text
          - `end_index` integer, required — End index in the text
          - `title` string, required — Citation title
          - `url` string — Citation URL
          - `sources` unknown
          - `type` string — Citation type
      - `thought` string — Assistant's internal thought process
    - `billed_usage` BilledLLMUsage
      - `prompt_tokens` number — Billed prompt tokens
      - `completion_tokens` number — Billed completion tokens
      - `search_units` number — Billed search units
      - `classifications` number — Billed classifications
    - `raw_response` object — Raw provider response

## Other responses

- `400` — unresolved $ref
- `500` — unresolved $ref

---

[API](https://skmtc.dev/getbifrost/apis/bifrost-http-transport-api.md) · [All operations](https://skmtc.dev/getbifrost/apis/bifrost-http-transport-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/getbifrost/bifrost-http-transport-api/revisions/e70d3ae3c0d0/schema)
