---
title: "Text completions (LiteLLM - OpenAI format)"
method: POST
path: "/litellm/v1/completions"
tags: ["LiteLLM Integration"]
---

# Text completions (LiteLLM - OpenAI format)

`POST /litellm/v1/completions`

Creates a text completion using OpenAI-compatible format via LiteLLM.
This is the legacy completions API.

## Request body

- OpenAITextCompletionRequest
  - `model` string, required — Model identifier
  - `prompt` union, required — The prompt(s) to generate completions for
    - string
    - string[]
  - `stream` boolean — Whether to stream the response
  - `max_tokens` integer
  - `temperature` number
  - `top_p` number
  - `frequency_penalty` number
  - `presence_penalty` number
  - `logit_bias` object
  - `logprobs` integer
  - `n` integer
  - `stop` union
    - string
    - string[]
  - `suffix` string
  - `echo` boolean
  - `best_of` integer
  - `user` string
  - `seed` integer
  - `fallbacks` string[]

## Response `200`

Successful response

- TextCompletionResponse
  - `id` string
  - `choices` object[]
    - `index` integer
    - `finish_reason` string
    - `log_probs` object
      - `content` object[]
        - `bytes` integer[]
        - `logprob` number
        - `token` string
        - `top_logprobs` object[]
          - `bytes` integer[]
          - `logprob` number
          - `token` string
      - `refusal` object[]
        - `bytes` integer[]
        - `logprob` number
        - `token` string
      - `text_offset` integer[]
      - `token_logprobs` number[]
      - `tokens` string[]
      - `top_logprobs` object[]
    - `text` string — For text completions
    - `message` ChatMessage
      - `role` 'assistant' | 'user' | 'system' | 'tool' | 'developer', required
      - `name` string
      - `content` union — Message content - can be a string or array of content blocks
        - string
        - object[]
          - `type` 'text' | 'image_url' | 'input_audio' | 'file' | 'refusal', required
          - `text` string
          - `refusal` string
          - `image_url` object
            - `url` string, required
            - `detail` 'low' | 'high' | 'auto'
          - `input_audio` object
            - `data` string, required
            - `format` string
          - `file` object
            - `file_data` string
            - `file_id` string
            - `filename` string
            - `file_type` string
          - `cache_control` CacheControl — Cache control settings for content blocks
            - `type` 'ephemeral'
            - `ttl` string — Time to live (e.g., "1m", "1h")
      - `tool_call_id` string — For tool messages
      - `refusal` string
      - `audio` object
        - `id` string
        - `data` string
        - `expires_at` integer
        - `transcript` string
      - `reasoning` string
      - `reasoning_details` object[]
        - `id` string
        - `index` integer
        - `type` 'reasoning.summary' | 'reasoning.encrypted' | 'reasoning.text'
        - `summary` string
        - `text` string
        - `signature` string
        - `data` string
      - `annotations` object[]
        - `type` string
        - `url_citation` object
          - `start_index` integer
          - `end_index` integer
          - `title` string
          - `url` string
          - `sources` object
          - `type` string
      - `tool_calls` object[]
        - `index` integer
        - `type` string
        - `id` string
        - `function` object, required
          - `name` string
          - `arguments` string
    - `delta` object — For streaming chat completions
      - `role` string
      - `content` string
      - `refusal` string
      - `audio` object
        - `id` string
        - `data` string
        - `expires_at` integer
        - `transcript` string
      - `reasoning` string
      - `reasoning_details` object[]
        - `id` string
        - `index` integer
        - `type` 'reasoning.summary' | 'reasoning.encrypted' | 'reasoning.text'
        - `summary` string
        - `text` string
        - `signature` string
        - `data` string
      - `tool_calls` object[]
        - `index` integer
        - `type` string
        - `id` string
        - `function` object, required
          - `name` string
          - `arguments` string
  - `model` string
  - `object` string
  - `system_fingerprint` string
  - `usage` BifrostLLMUsage — Token usage information
    - `prompt_tokens` integer — Total input tokens including any prompt-cache tokens (read + write). Subtract prompt_tokens_details.cached_read_tokens and prompt_tokens_details.cached_write_tokens to get the non-cached portion.
    - `prompt_tokens_details` ChatPromptTokensDetails
      - `text_tokens` integer
      - `audio_tokens` integer
      - `image_tokens` integer
      - `cached_read_tokens` integer — Tokens served from the prompt cache (cache hit). These tokens are already included in prompt_tokens and are billed at the reduced cache-read rate. Populated for all providers that support prompt caching (Anthropic, Bedrock, OpenAI, Gemini, xAI, etc.).
      - `cached_write_tokens` integer — Tokens written to the prompt cache on this request (cache creation / write). These tokens are already included in prompt_tokens and are billed at the cache-creation rate. Populated for providers that separately report cache write tokens (Anthropic, Bedrock).
    - `completion_tokens` integer — Number of output/completion tokens generated.
    - `completion_tokens_details` ChatCompletionTokensDetails
      - `text_tokens` integer
      - `accepted_prediction_tokens` integer
      - `audio_tokens` integer
      - `citation_tokens` integer
      - `num_search_queries` integer
      - `reasoning_tokens` integer
      - `image_tokens` integer
      - `rejected_prediction_tokens` integer
    - `total_tokens` integer
    - `cost` BifrostCost — Cost breakdown for the request
      - `input_tokens_cost` number
      - `output_tokens_cost` number
      - `reasoning_tokens_cost` number — Cost for reasoning/thinking tokens (reasoning models)
      - `citation_tokens_cost` number — Cost for citation tokens
      - `search_queries_cost` number — Cost for web search queries
      - `request_cost` number
      - `total_cost` number
  - `extra_fields` BifrostResponseExtraFields — Additional fields included in responses
    - `request_type` string — Type of request that was made
    - `provider` 'openai' | 'azure' | 'anthropic' | 'bedrock' | 'cohere' | 'vertex' | 'vllm' | 'mistral' | 'ollama' | 'groq' | 'sgl' | 'parasail' | 'perplexity' | 'replicate' | 'cerebras' | 'deepseek' | 'gemini' | 'openrouter' | 'elevenlabs' | 'huggingface' | 'nebius' | 'xai' | 'runway' | 'fireworks' — AI model provider identifier
    - `model_requested` string — The model that was requested
    - `model_deployment` string — The actual model deployment used
    - `latency` integer — Request latency in milliseconds
    - `chunk_index` integer — Index of the chunk for streaming responses
    - `raw_request` object — Raw request if enabled
    - `raw_response` object — Raw response if enabled
    - `cache_debug` BifrostCacheDebug
      - `cache_hit` boolean
      - `cache_id` string
      - `hit_type` string
      - `requested_provider` string
      - `requested_model` string
      - `provider_used` string
      - `model_used` string
      - `input_tokens` integer
      - `threshold` number
      - `similarity` number

## Other responses

- `400` — Bad request
- `500` — Internal server error

---

[API](https://skmtc.net/getbifrost/apis/bifrost-api.md) · [All operations](https://skmtc.net/getbifrost/apis/bifrost-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/getbifrost/bifrost-api/versions/f8cab88f64ea/schema)
