A CLI for compiling the OpenAI OpenAPI specification into deterministic, LLM-friendly HTML blocks and discovery manifests.
pdm install
pdm run openai-for-ai build --spec-url https://app.stainless.com/api/spec/documented/openai/openapi.documented.yml --out site/This fetches the latest spec (with ETag-based caching), renders operation and component pages beneath site/, and generates helper indexes such as llms.txt, manifest.json, and blocks/index.json.
Output paths are derived from tag and schema names but are sanitized into safe path segments.
Use pdm run openai-for-ai build --help to see all available options.
pdm run openai-for-ai build --spec-url https://app.stainless.com/api/spec/documented/openai/openapi.documented.yml --out site/--spec-urlfetches the published OpenAI OpenAPI document and respects the built-in ETag cache to avoid redundant downloads.--out site/writes the rendered HTML fragments and indexes into thesite/directory that ships with the repo.
pdm run openai-for-ai build- With no flags, the builder uses the default remote spec, writes into
site/, and includes the default language examples (curl,python).
pdm run openai-for-ai build --spec-url https://app.stainless.com/api/spec/documented/openai/openapi.documented.yml --lang javascript --out site/--lang javascriptrenders blocks optimized for JavaScript code samples.- Combining
--langwith an explicit--outlets you produce language-specific previews without overwriting other assets.
pdm run pytestThe integration tests exercise the full build pipeline against the real OpenAI OpenAPI specification bundled under tests/data/openai.documented.yml. Ensure optional dependencies (e.g., Jinja2) are installed so these tests execute instead of being skipped.
This project is licensed under the MIT License.
