gauge-api
v1.0.10
Published
OpenAPI to Multi-Language SDK Generator (TypeScript, Python, Go, Java, C#, Ruby, PHP) - Stainless Alternative
Maintainers
Readme
GaugeAPI 🛠️
GaugeAPI is a high-precision, production-grade automated SDK generator designed as a lightweight, zero-cost alternative to Stainless. It parses OpenAPI specifications (OAS) and compiles them deterministically into bulletproof, type-safe, and idiomatic SDKs for multiple programming languages.
Built entirely using a Deterministic Compilation Architecture, GaugeAPI eliminates the risks of AI hallucinations and the recurring costs of third-party LLM APIs, delivering 100% accurate code generation in milliseconds.
✨ Features
- Zero-Cost Operation: No paid AI APIs required. Runs entirely locally or via free CI/CD environments (like GitHub Actions).
- Multi-Language Generation: Generates idiomatic SDKs for Python, TypeScript, and Go from a single
openapi.jsonoropenapi.yamlfile. - Strict Code Sanitization: Advanced security layer guarding against Code Injection and malicious schema inputs.
- Production-Ready DX (Developer Experience):
- Full IDE Autocomplete and IntelliSense support via precise type mapping.
- Automated Exponential Backoff Retry logic embedded into the generated HTTP base clients.
- Granular, human-readable error handling structures (
APIError,RateLimitError, etc.).
🏗️ Architecture & File Structure
The project follows a decoupled, pipelines-based data architecture:
gauge-api/
├── src/
│ ├── index.ts # CLI Entry point
│ ├── cli.ts # Command Line Interface handler
│ ├── core/
│ │ ├── parser.ts # OpenAPI Validation & Resolution
│ │ ├── transformer.ts # Type mapping & schema translation
│ │ ├── generator.ts # Handlebars template rendering engine
│ │ └── security.ts # Input sanitization & security auditing
│ ├── templates/ # Native language code layout blueprints
│ │ ├── python/
│ │ ├── typescript/
│ │ └── go/
│ └── languages/ # Language-specific compilation settings
└── tests/ # Automated testing suites🚀 Getting Started
Prerequisites
Ensure you have Node.js (v20 or higher) installed on your machine.
Installation
Clone the repository and navigate into the project directory:
git clone https://github.com/yourusername/gauge-api.git cd gauge-apiInstall the required open-source dependencies:
npm install
Running Locally
To generate an SDK from an example OpenAPI specification file, run the following command:
npm start -- --input ./examples/petstore-openapi.json --language python --output ./examples/generated/python🛡️ Security Specification
GaugeAPI is architected with a Security-First mindset to prevent supply chain vulnerabilities:
- AST & String Escaping: All schema details, method parameters, and descriptions are heavily sanitized inside
src/core/security.tsto neutralize Code Injection threats. - Zero-Scope Credential Leakage: Generated SDKs enforce strict variable encapsulation (e.g., native
#privatefields in TypeScript and double-underscoreself.__api_keymangling in Python) to prevent token scanning attacks from untrusted third-party dependencies.
🗺️ Roadmap & AI Ecosystem Integration
- [ ] Core Engine stabilization for Python and TypeScript output.
- [ ] Automated package manager deployment (
npm publish&twine upload) integration. - [ ] Model Context Protocol (MCP) Server Generation: Automate the creation of MCP servers from OpenAPI specs so that AI agents (like Anthropic Claude or OpenAI Assistants) can securely and directly interact with web ecosystems.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
