Models: OpenAI¶
See also
- Guide → Providers: guide/providers.md
- Architecture → Provider Abstraction: architecture/provider-abstraction.md#provider-mapping
alloy.models.openai ¶
OpenAIBackend ¶
Bases: ModelBackend
OpenAI backend using the Responses API.
Implements completion and streaming via responses.create
/responses.stream
,
supports function tool-calls by looping with previous_response_id
, and
emits structured outputs using text.format
with a JSON Schema when an
output_schema
is provided. Raises ConfigurationError
if the SDK is
unavailable.
Usage¶
export OPENAI_API_KEY=...
export ALLOY_MODEL=gpt-5-mini
Note:
- Some reasoning models (e.g.,
gpt-5
,o1
,o3
) ignore or reject temperature settings. Alloy detects these and does not sendtemperature
for such models; a debug log line is emitted when dropped.