openai-types
Standalone Rust types for the OpenAI API. Zero runtime dependencies beyond serde.
1079 types across 24 domains, auto-generated from the OpenAI Python SDK with manual overrides preserved on re-sync.
Usage
[]
= "0.1"
use ChatCompletion;
use ;
use ReasoningEffort;
let resp: ChatCompletion = from_str?;
Features
Each API domain is behind an optional feature flag. All enabled by default.
# Only what you need
= { = "0.1", = false, = ["chat", "responses"] }
| Feature | Types | Description |
|---|---|---|
chat |
50 | Chat completions |
responses |
314 | Responses API |
realtime |
188 | Realtime/WebSocket API |
beta |
80 | Assistants, threads, runs |
audio |
36 | Speech, transcription, translation |
evals |
93 | Evaluations |
image |
52 | Image generation/editing |
fine-tuning |
25 | Fine-tuning jobs |
vector-stores |
33 | Vector store search |
video |
20 | Sora video generation |
webhooks |
18 | Webhook events |
shared |
26 | Common types (Role, ReasoningEffort) |
structured |
- | schemars::JsonSchema derive |
| + 12 more | batch, completion, containers, conversations, embedding, file, graders, model, moderation, skills, uploads, websocket |
Sync from Python SDK
# or manually:
Override mechanism
_gen.rsfiles are machine-owned (overwritten on sync)- Other
.rsfiles are manual overrides (never touched) - Types in manual files are automatically skipped during generation
To override a generated type: create it in a manual .rs file in the domain directory. Next sync skips it.
Related
openai-oxide- Full async client using these types- OpenAI Python SDK - Source of type definitions
License
MIT