Setup
Basic Usage
Parameters
Model identifier. Common values: gpt-4o, gpt-4o-mini, o1, o1-mini, o3-mini.
OpenAI API key. Defaults to the OPENAI_API_KEY environment variable.
Override the API base URL.
Sampling temperature (0.0 to 2.0).
Maximum number of output tokens.
Nucleus sampling parameter.
Frequency penalty (-2.0 to 2.0).
Presence penalty (-2.0 to 2.0).
Seed for deterministic sampling.
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