A gateway layer between your code and every model provider
Oneledger sits in front of OpenAI, Anthropic, Google and DeepSeek. It speaks their API formats, decides where each request goes, meters every token, and keeps the keys and limits in one place.
Drop-in compatible endpoints
Oneledger implements the OpenAI Chat Completions specification, so the official OpenAI SDKs for Python and Node, LangChain, LlamaIndex and most agent frameworks work after changing the base URL and key.
- POST /v1/chat/completions
- POST /v1/messages (Anthropic format)
- GET /v1/models
- POST /v1/batches
Streaming uses server-sent events with stream: true. Tool calling, JSON mode and image inputs are passed through for models that support them.
stream.ts
import OpenAI from "openai";
const client = new OpenAI({
baseURL: process.env.ONELEDGER_BASE_URL, // Oneledger /v1 endpoint
apiKey: process.env.ONELEDGER_API_KEY,
});
const stream = await client.chat.completions.create({
model: "openai/gpt-6.1-sol",
messages: [{ role: "user", content: "Draft a release note." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
} Routing rules
| Model ID | Behavior |
|---|---|
| anthropic/claude-sonnet-5.5 | Fallback on |
| openai/gpt-6-astra | Single provider |
| google/gemini-4-argon | Pinned: us region |
| deepseek/deepseek-v4-pro | Off-peak batch |
Routing and provider fallback
Model IDs use the provider/model format. When a model is available from more than one provider, Oneledger sends the request to the healthiest one and retries on the next, up to 2 times, after a 429, a 5xx or a timeout.
Pin a key to a provider or region when a contract requires it. Pinned requests are never rerouted, and the response header tells you which provider served each call.
Spend caps on every key
Create separate keys for production, staging and each internal tool. Each key gets a monthly cap in dollars, an optional model allow-list and a rate limit (600 requests per minute by default). When a key reaches its cap, it returns HTTP 429 with a clear error until the next cycle or until you raise the limit.
Balance alerts email the account owner at the threshold you set, before credits run out.
- Usage
- API keys
- Credits
- Logs
- Team
API keys
October
- Active keys
- 6
- Month to date
- $1,284.10
- Near cap
- 1
- staging-eval
| Key | Spend / cap | Status |
|---|---|---|
| prod-support-bot sk-ol-…a91f | $812.40 / $2,000 | Active |
| staging-eval sk-ol-…07c2 | $188.90 / $200 | 91% of cap |
| batch-tagging sk-ol-…5d3e | $240.00 / $500 | Active |
| old-prototype sk-ol-…e1b8 | $0.00 / $50 | Revoked |
| Provider | p50 latency | Errors |
|---|---|---|
| Anthropic | 1.9 s | 0.3% |
| OpenAI | 1.4 s | 0.2% |
| 1.1 s | 0.5% |
Usage you can actually read
Every request is logged with key, model, provider, input, output and cached tokens, cost, latency and status code. Filter by any of them, compare weeks, and export daily totals as CSV for finance.
Prompt and completion bodies are not stored unless you enable request logging on a specific key for debugging.
Team and enterprise controls
Run one workspace for the whole company with shared credits and clear ownership of each key.
- Roles
- Owner, admin, developer and billing roles per workspace and project.
- Audit log
- Who created, changed, rotated or revoked each key, and when.
- Bring your own key
- Attach existing OpenAI, Anthropic or Google keys and keep your negotiated rates; that usage is billed by the provider.
- SSO (Enterprise)
- SAML 2.0 single sign-on with Okta or Microsoft Entra ID, plus SCIM provisioning.