| Crates.io | openai-client-base |
| lib.rs | openai-client-base |
| version | 0.3.0 |
| created_at | 2025-09-11 11:54:37.111696+00 |
| updated_at | 2025-09-18 11:52:34.591544+00 |
| description | Auto-generated Rust client for the OpenAI API |
| homepage | https://github.com/genai-rs/openai-client-base |
| repository | https://github.com/genai-rs/openai-client-base |
| max_upload_size | |
| id | 1833735 |
| size | 6,265,085 |
Auto-generated Rust client for the OpenAI API, based on the Stainless OpenAPI specification.
[!WARNING] 🚀 This is a low-level, auto-generated client library.
This crate provides raw bindings to the OpenAI API, automatically generated from the OpenAPI specification. It is intended as a foundation for building higher-level, more ergonomic client libraries.
Most users should consider using a higher-level wrapper that provides:
- ✅ Simplified API with builder patterns
- ✅ Better error handling and retries
- ✅ Automatic rate limiting
- ✅ More idiomatic Rust interfaces
Only use this crate directly if you need:
- Raw access to all OpenAPI endpoints
- Custom retry/batching logic
- Minimal dependencies
- Full control over API interactions
This crate provides the foundational types and API client implementation for OpenAI's API, generated directly from their OpenAPI specification. It's designed to be used as a base dependency for higher-level OpenAI client libraries.
The client is generated through a comprehensive automated pipeline using Stainless as the single authoritative source:
Fetch Specification (fetch_spec.sh): Download the latest OpenAPI spec from Stainless
https://app.stainless.com/api/spec/documented/openai/openapi.documented.ymlApply Spec Patches:
fix_model_fields.py)patch_spec_rust_compat.py)Generate Rust Code: Use OpenAPI Generator via Docker with reqwest library
Post-Generation Fixes:
patch_generated.rs.sh)The pipeline automatically detects and fixes issues rather than hardcoding solutions, making it robust against API changes.
Add this to your Cargo.toml:
[dependencies]
openai-client-base = { git = "https://github.com/genai-rs/openai-client-base" }
To regenerate the client with the latest OpenAPI spec:
# Regenerate with latest spec (default behavior)
./scripts/generate.sh
# Or use cached spec during development
USE_CACHED_SPEC=1 ./scripts/generate.sh
The generation script automatically:
cargo fmt for consistencyFor detailed pipeline documentation, see PIPELINE.md
uv (for Python dependency management) - Install from hererg) for post-processing scriptsLicensed under either of:
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
This is an automatically generated crate. For fixes to the generated code, please submit patches to the generation pipeline rather than the generated code directly.