forge¶
The developer runtime for AI-era Python.
forge is a modular Python runtime that eliminates the undifferentiated heavy lifting of backend development — config, logging, retries, AI model integration, health checks, caching, and more.
Quick Install¶
Your First AI Call¶
import asyncio
from forge.ai import complete, Message
async def main():
response = await complete(
messages=[Message.user("What is the capital of France?")],
model="gpt-4o",
)
print(response.content)
asyncio.run(main())
Why forge?¶
forge sits below your web framework. It is not a replacement for FastAPI, Django, or Flask.
It is the infrastructure layer that every Python backend needs — unified, modular, and
production-ready from pip install.
What's Included¶
| Module | Description |
|---|---|
| Config | Typed, validated, layered configuration from env vars, .env, and TOML |
| Logging | Structured JSON logging with automatic trace context propagation |
| Retry | Exponential backoff, jitter, and circuit breaker for resilience |
| AI | Unified interface across OpenAI, Anthropic, Gemini, and Ollama |
| Health | Kubernetes-compatible /health and /ready endpoints |
| Cache | Decorator-based caching with in-memory LRU and Redis backends |
| Validation | Pydantic-integrated input validation with consistent error responses |
Next Steps¶
- Getting Started — 5-minute guide
- Modules — explore each module
- API Reference — comprehensive API docs
- FAQ — common questions and comparisons