Skip to main content

Overview

The completions capability provides access to chat and text completion APIs through LiteLLM, supporting multiple providers.

Python Usage

Chat Completion

Text Completion (Legacy)

Async Usage

Parameters

Result Object

The CompletionResult object contains:
  • id: Response ID
  • content: Generated text
  • role: Message role (“assistant”)
  • model: Model used
  • finish_reason: Why generation stopped
  • usage: Token usage statistics
  • tool_calls: Any tool calls made