{"id":31646430,"url":"https://github.com/genai-rs/openai-client-base","last_synced_at":"2026-04-10T11:01:06.983Z","repository":{"id":313965646,"uuid":"1053622716","full_name":"genai-rs/openai-client-base","owner":"genai-rs","description":"Auto-generated Rust client for OpenAI API from OpenAPI specification","archived":false,"fork":false,"pushed_at":"2026-04-05T04:58:02.000Z","size":5460,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-05T06:30:35.361Z","etag":null,"topics":["ai","api-client","gpt","llm","openai","openapi","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/openai-client-base","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/genai-rs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-09-09T17:44:15.000Z","updated_at":"2026-04-05T04:53:08.000Z","dependencies_parsed_at":"2025-09-09T21:07:17.914Z","dependency_job_id":"3b4f475d-1262-4fd6-b826-f0cec58a640b","html_url":"https://github.com/genai-rs/openai-client-base","commit_stats":null,"previous_names":["genai-rs/openai-client-base"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/genai-rs/openai-client-base","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genai-rs%2Fopenai-client-base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genai-rs%2Fopenai-client-base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genai-rs%2Fopenai-client-base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genai-rs%2Fopenai-client-base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/genai-rs","download_url":"https://codeload.github.com/genai-rs/openai-client-base/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genai-rs%2Fopenai-client-base/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31639524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","api-client","gpt","llm","openai","openapi","rust"],"created_at":"2025-10-07T05:50:05.533Z","updated_at":"2026-04-10T11:01:06.953Z","avatar_url":"https://github.com/genai-rs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# openai-client-base\n\n[![CI](https://github.com/genai-rs/openai-client-base/workflows/CI/badge.svg)](https://github.com/genai-rs/openai-client-base/actions)\n[![Security](https://github.com/genai-rs/openai-client-base/workflows/Security/badge.svg)](https://github.com/genai-rs/openai-client-base/actions)\n[![MSRV](https://img.shields.io/badge/MSRV-1.82.0-blue)](https://releases.rs/docs/1.82.0/)\n[![License](https://img.shields.io/github/license/genai-rs/openai-client-base)](./LICENSE-MIT)\n\nAuto-generated Rust client for the [OpenAI](https://openai.com) API, based on the Stainless OpenAPI specification.\n\n\u003e [!WARNING]\n\u003e **Important:** this is a low-level, auto-generated client library.\n\u003e \n\u003e This crate provides raw bindings to the OpenAI API, automatically generated from the OpenAPI specification.\n\u003e It is intended as a foundation for building higher-level, more ergonomic client libraries.\n\u003e\n\u003e **Most users should consider using a higher-level wrapper that provides:**\n\u003e - Simplified APIs with builder patterns\n\u003e - Better error handling and retries\n\u003e - Automatic rate limiting\n\u003e - Idiomatic Rust interfaces\n\u003e\n\u003e **Only use this crate directly if you need:**\n\u003e - Raw access to all OpenAPI endpoints\n\u003e - Custom retry/batching logic\n\u003e - Minimal dependencies\n\u003e - Full control over API interactions\n\n## Overview\n\nThis 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.\n\n## Features\n\n- **Complete API coverage**: all OpenAI endpoints from the official spec\n- **Auto-generated**: always up-to-date with the latest API changes\n- **Pure Rust**: type-safe bindings with serde serialization\n- **Async/await**: full async support with tokio and reqwest\n- **Streaming support**: server-sent events for compatible endpoints\n- **Customisable**: use as a foundation for your own client\n\n## Generation Pipeline\n\nThe client is generated through a comprehensive automated pipeline using Stainless as the single authoritative source:\n\n1. **Fetch Specification** (`fetch_spec.sh`): Download the latest OpenAPI spec from Stainless\n   - Source: `https://app.stainless.com/api/spec/documented/openai/openapi.documented.yml`\n   - Contains complete definitions for all API endpoints\n\n2. **Apply Spec Patches**:\n   - **Layer 1**: Fix model field types and handle allOf inheritance (`fix_model_fields.py`)\n   - **Layer 2**: Apply Rust compatibility patches (`patch_spec_rust_compat.py`)\n\n3. **Generate Rust Code**: Use OpenAPI Generator via Docker with reqwest library\n\n4. **Post-Generation Fixes**:\n   - Fix module paths and add bon builder support (`patch_generated.rs.sh`)\n   - Fix invalid enum variant names (e.g., Gpt4.1 -\u003e Gpt4_1)\n   - Add Display implementations for multipart types\n   - Fix empty enums with proper variants from spec\n   - Handle untagged unions (automatically detected from anyOf/oneOf)\n   - Fix nullable fields and constructor signatures\n   - Manage Default trait based on field types\n   - Apply clippy fixes and format code\n\nThe pipeline automatically detects and fixes issues rather than hardcoding solutions, making it robust against API changes.\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nopenai-client-base = { git = \"https://github.com/genai-rs/openai-client-base\" }\n```\n\n## Regenerating the Client\n\nTo regenerate the client with the latest OpenAPI spec:\n\n```bash\n# Regenerate with latest spec (default behavior)\n./scripts/generate.sh\n\n# Or use cached spec during development\nUSE_CACHED_SPEC=1 ./scripts/generate.sh\n```\n\nThe generation script automatically:\n- Downloads the latest OpenAPI spec from Stainless\n- Applies spec-level patches for Rust compatibility\n- Generates Rust code using OpenAPI Generator\n- Fixes compilation issues (untagged unions, nullable fields, enum variants)\n- Manages trait implementations (Default, Display)\n- Formats code with `cargo fmt` for consistency\n\nFor detailed pipeline documentation, see [PIPELINE.md](PIPELINE.md)\n\n## Requirements\n\n- Rust 1.82+ (stable toolchain recommended for consistent formatting)\n- Docker (for OpenAPI Generator)\n- `uv` (for Python dependency management) - [Install from here](https://docs.astral.sh/uv/getting-started/installation/)\n- ripgrep (`rg`) for post-processing scripts\n\n## License\n\nLicensed under either of:\n\n* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\n## Contributing\n\nThis is an automatically generated crate. For fixes to the generated code, please submit patches to the generation pipeline rather than the generated code directly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenai-rs%2Fopenai-client-base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenai-rs%2Fopenai-client-base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenai-rs%2Fopenai-client-base/lists"}