Lunar SDK
Lunar provides SDKs for Python and TypeScript with a simple, OpenAI-compatible interface to access multiple LLM providers through the PureAI API. It features intelligent fallback mechanisms, per-request cost tracking, and a built-in evaluation framework.Key Features
OpenAI-Compatible
Drop-in replacement for OpenAI SDK. Migrate existing code with minimal changes.
Intelligent Fallbacks
Automatic retry with fallback models when providers experience issues.
Cost Tracking
Real-time cost tracking for every request with token-level granularity.
Built-in Evals
Comprehensive evaluation framework with 15+ built-in scorers.
Clients
- Python
- TypeScript
| Client | Description |
|---|---|
Lunar | Synchronous client for standard applications |
AsyncLunar | Asynchronous client for high-performance applications |
Quick Example
- Python
- TypeScript
Resources
Both SDKs expose the same resources:| Resource | Description |
|---|---|
client.chat.completions | Chat completion API (messages-based) |
client.completions | Text completion API (prompt-based) |
client.models | List available models |
client.providers | List available providers |
client.evals | Run evaluations |
client.datasets | Manage evaluation datasets |