OpenAI¶
Setup¶
No extra install — included with pip install llmgate.
Model prefixes¶
Models starting with gpt-, o1-, o3-, or chatgpt- are routed to OpenAI automatically.
completion("gpt-4o", messages)
completion("gpt-4o-mini", messages)
completion("o3-mini", messages)
completion("o1-preview", messages)
Vision¶
OpenAI supports both URL and base64 images with an optional detail hint:
completion("gpt-4o", messages=[{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image."},
{"type": "image_url", "image_url": {"url": "https://...", "detail": "high"}},
],
}])
detail values: "auto" (default) · "low" (85 tokens) · "high" (full resolution, more tokens)
Structured outputs¶
Uses native json_schema with strict: true — the most reliable structured output mode available:
Notes¶
o1-*ando3-*reasoning models do not supportsystemmessages ortemperature. Pass asextra_kwargsor omit.frequency_penaltyandpresence_penaltyare passed through via**extra_kwargs.