Completions
Create a Text Completion
ModelsExpand Collapse
class Completion: …
id: strUnique object identifier.
Unique object identifier.
The format and length of IDs may change over time.
The resulting completion up to and excluding the stop sequences.
model: ModelThe model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
Literal["claude-opus-4-6", "claude-sonnet-4-6", "claude-haiku-4-5", 12 more]The model that will complete your prompt.
The model that will complete your prompt.
See models for additional details and options.
claude-opus-4-6- Most intelligent model for building agents and codingclaude-sonnet-4-6- Best combination of speed and intelligenceclaude-haiku-4-5- Fastest model with near-frontier intelligenceclaude-haiku-4-5-20251001- Fastest model with near-frontier intelligenceclaude-opus-4-5- Premium model combining maximum intelligence with practical performanceclaude-opus-4-5-20251101- Premium model combining maximum intelligence with practical performanceclaude-sonnet-4-5- High-performance model for agents and codingclaude-sonnet-4-5-20250929- High-performance model for agents and codingclaude-opus-4-1- Exceptional model for specialized complex tasksclaude-opus-4-1-20250805- Exceptional model for specialized complex tasksclaude-opus-4-0- Powerful model for complex tasksclaude-opus-4-20250514- Powerful model for complex tasksclaude-sonnet-4-0- High-performance model with extended thinkingclaude-sonnet-4-20250514- High-performance model with extended thinkingclaude-3-haiku-20240307- Deprecated: Will reach end-of-life on April 20th, 2026. Please migrate to claude-haiku-4-5. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.
Most intelligent model for building agents and coding
Best combination of speed and intelligence
Fastest model with near-frontier intelligence
Fastest model with near-frontier intelligence
Premium model combining maximum intelligence with practical performance
Premium model combining maximum intelligence with practical performance
High-performance model for agents and coding
High-performance model for agents and coding
Exceptional model for specialized complex tasks
Exceptional model for specialized complex tasks
Powerful model for complex tasks
Powerful model for complex tasks
High-performance model with extended thinking
High-performance model with extended thinking
Fast and cost-effective model
stop_reason: Optional[str]The reason that we stopped.
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: Literal["completion"]Object type.
Object type.
For Text Completions, this is always "completion".