Local-only CLI that renders Algorand API clients from OpenAPI specs.
api/oas-generator/
├── pyproject.toml # project config + console script
├── README.md # this file
└── src/oas_generator/ # generator package and templatescli.py– argument parser and CLI entrypointparser.py/loader.py– read & validate OpenAPI specs (supports local paths, URLs, and shorthand)builder.py/models.py– shape spec data for renderingrenderer/engine.py/filters.py– Jinja environment and helperswriter.py– emit generated files into the target package
templates/client.py.j2– HTTP client implementationtemplates/config.py.j2– client configuration dataclasstemplates/exceptions.py.j2– error definitions surfaced by clientstemplates/package_init.py.j2– package-level exportstemplates/types.py.j2– shared type helperstemplates/models/*.j2– request/response models and serde helpers
The --spec argument accepts:
- Local paths:
api/specs/algod.oas3.json - Remote URLs:
https://raw.githubusercontent.com/.../algod.oas3.json - Shorthand:
oas://algod(fetches fromalgokit-oas-generatormain branch) - Shorthand with branch/tag:
oas://algod@v1.0.0oroas://indexer@feature-branch
# Using shorthand (recommended - single source of truth)
uv run --project api/oas-generator python -m oas_generator.cli \
--spec oas://algod \
--out src \
--package algokit_algod_client
# Using shorthand with specific branch/tag
uv run --project api/oas-generator python -m oas_generator.cli \
--spec oas://algod@v1.0.0 \
--out src \
--package algokit_algod_client
# Using a remote URL directly
uv run --project api/oas-generator python -m oas_generator.cli \
--spec https://raw.githubusercontent.com/algorandfoundation/algokit-oas-generator/main/specs/algod.oas3.json \
--out src \
--package algokit_algod_client
# Using a local path
uv run --project api/oas-generator python -m oas_generator.cli \
--spec api/specs/algod.oas3.json \
--out src \
--package algokit_algod_clientFollow up with uv run ruff check --fix and uv run ruff format on the regenerated package to keep formatting tidy.