Skip to main content
The complete() and completeSimple() functions provide a synchronous interface for getting LLM responses. They internally use stream() and streamSimple() but await the full result.

Import

complete

Get a complete response with provider-specific options.
Model<TApi>
required
The model to use for generation
Context
required
Conversation context
ProviderStreamOptions
Same options as stream() (see Stream Functions)
object

Example

completeSimple

Get a complete response with unified reasoning parameter.
Model<TApi>
required
The model to use for generation
Context
required
Conversation context
SimpleStreamOptions
Same options as streamSimple() (see Stream Functions)

Example

Error Handling

Both functions throw errors on failure:

Cancellation

Use AbortSignal to cancel requests:

Tool Calls

When the response includes tool calls:

Usage Statistics

All responses include token usage:

Comparison with Stream

Performance

complete() and completeSimple() have the same performance as their streaming counterparts - they just buffer the events internally: