Skip to main content

Setup

Basic Usage

Parameters

str
default:"gpt-4o"
Model identifier. Common values: gpt-4o, gpt-4o-mini, o1, o1-mini, o3-mini.
str
OpenAI API key. Defaults to the OPENAI_API_KEY environment variable.
str
Override the API base URL.
float
Sampling temperature (0.0 to 2.0).
int
Maximum number of output tokens.
float
Nucleus sampling parameter.
float
Frequency penalty (-2.0 to 2.0).
float
Presence penalty (-2.0 to 2.0).
int
Seed for deterministic sampling.
bool
default:"true"
Whether to use strict mode for structured outputs.

Structured Output

OpenAI supports native structured outputs via JSON Schema:

Audio Support

OpenAI models support audio input and output:

Vision

Pass images in messages for visual understanding:

Async Usage

Streaming