Completions
Create a Text Completion
ModelsExpand Collapse
class Completion:
id: String
Unique object identifier.
The format and length of IDs may change over time.
completion: String
The resulting completion up to and excluding the stop sequences.
model: Model
The model that will complete your prompt.
See models for additional details and options.
CLAUDE_OPUS_4_5_20251101("claude-opus-4-5-20251101")
Premium model combining maximum intelligence with practical performance
CLAUDE_OPUS_4_5("claude-opus-4-5")
Premium model combining maximum intelligence with practical performance
CLAUDE_3_7_SONNET_LATEST("claude-3-7-sonnet-latest")
High-performance model with early extended thinking
CLAUDE_3_7_SONNET_20250219("claude-3-7-sonnet-20250219")
High-performance model with early extended thinking
CLAUDE_3_5_HAIKU_LATEST("claude-3-5-haiku-latest")
Fastest and most compact model for near-instant responsiveness
CLAUDE_3_5_HAIKU_20241022("claude-3-5-haiku-20241022")
Our fastest model
CLAUDE_HAIKU_4_5("claude-haiku-4-5")
Hybrid model, capable of near-instant responses and extended thinking
CLAUDE_HAIKU_4_5_20251001("claude-haiku-4-5-20251001")
Hybrid model, capable of near-instant responses and extended thinking
CLAUDE_SONNET_4_20250514("claude-sonnet-4-20250514")
High-performance model with extended thinking
CLAUDE_SONNET_4_0("claude-sonnet-4-0")
High-performance model with extended thinking
CLAUDE_4_SONNET_20250514("claude-4-sonnet-20250514")
High-performance model with extended thinking
CLAUDE_SONNET_4_5("claude-sonnet-4-5")
Our best model for real-world agents and coding
CLAUDE_SONNET_4_5_20250929("claude-sonnet-4-5-20250929")
Our best model for real-world agents and coding
CLAUDE_OPUS_4_0("claude-opus-4-0")
Our most capable model
CLAUDE_OPUS_4_20250514("claude-opus-4-20250514")
Our most capable model
CLAUDE_4_OPUS_20250514("claude-4-opus-20250514")
Our most capable model
CLAUDE_OPUS_4_1_20250805("claude-opus-4-1-20250805")
Our most capable model
CLAUDE_3_OPUS_LATEST("claude-3-opus-latest")
Excels at writing and complex tasks
CLAUDE_3_OPUS_20240229("claude-3-opus-20240229")
Excels at writing and complex tasks
CLAUDE_3_HAIKU_20240307("claude-3-haiku-20240307")
Our previous most fast and cost-effective
stopReason: Optional<String>
The reason that we stopped.
This may be one the following values:
"stop_sequence": we reached a stop sequence — either provided by you via thestop_sequencesparameter, or a stop sequence built into the model"max_tokens": we exceededmax_tokens_to_sampleor the model's maximum
type: JsonValue; "completion"constant"completion"constant
Object type.
For Text Completions, this is always "completion".