OpenAI-compatible gateway + per-tenant cost attribution + real-time circuit breakers
1. Get API key at daylite.ai/dashboard (free, no card)
2. Change your base_url to https://api.daylite.ai/v1
3. Add X-Daylite-Customer header to track costs per customer
curl https://api.daylite.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Daylite-Customer: customer_123" \
-H "X-Daylite-Feature: chat" \
-d '{"model":"llama-3.3-70b","messages":[{"role":"user","content":"Hello"}]}'
# Response headers include:
# X-Daylite-Cost: 0.000420
# X-Daylite-Tokens-In: 12
# X-Daylite-Tokens-Out: 847
# X-Daylite-Customer: customer_123Pass customer ID and feature name in request headers. Get exact cost in USD in response headers. No middleware, no proxy — built into every request.
from openai import OpenAI
client = OpenAI(
base_url="https://api.daylite.ai/v1",
api_key="YOUR_API_KEY",
)
# The extra_headers parameter passes attribution data
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[{"role": "user", "content": "Summarize this document"}],
extra_headers={
"X-Daylite-Customer": "customer_123",
"X-Daylite-Feature": "document-summary",
},
)
# Response includes cost in headers
# Access via: response.headers["X-Daylite-Cost"]
print(response.choices[0].message.content)Set hard spend limits per tenant. When exceeded, the request is blocked before it reaches the provider — zero cost. Protects against runaway agent loops that can burn thousands in minutes.
curl -X POST https://api.daylite.ai/v1/budgets \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customer_id": "customer_123",
"monthly_cap_usd": 500.00,
"action_on_cap": "block",
"alert_thresholds": [0.5, 0.8, 0.9]
}'
# When tenant exceeds $500/month:
# → API returns 429 "Budget exceeded" — provider never called
# → Alerts fire at 50%, 80%, 90% via webhook
# → Protects against runaway agent loopsQuery usage breakdown by customer, feature, or model. Build your own dashboards or export CSV.
# All customers
curl https://api.daylite.ai/v1/usage \
-H "Authorization: Bearer YOUR_API_KEY"
# Specific customer
curl "https://api.daylite.ai/v1/usage?customer=customer_123" \
-H "Authorization: Bearer YOUR_API_KEY"
# Returns: totalCost, totalRequests, byFeature, byModel, budget statusfrom openai import OpenAI
client = OpenAI(
base_url="https://api.daylite.ai/v1",
api_key="YOUR_API_KEY",
)
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[{"role": "user", "content": "What is solar curtailment?"}],
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.daylite.ai/v1",
apiKey: "YOUR_API_KEY",
});
const response = await client.chat.completions.create({
model: "llama-3.3-70b",
messages: [{ role: "user", content: "What is solar curtailment?" }],
});
console.log(response.choices[0].message.content);stream = client.chat.completions.create(
model="llama-3.3-70b",
messages=[{"role": "user", "content": "Explain inference"}],
stream=True,
extra_headers={"X-Daylite-Customer": "customer_123"},
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")| Model | Context | Standard (in/out) | Batch (in/out) |
|---|---|---|---|
| llama-3.3-70b | 128K | $0.30 / $0.50 | $0.20 / $0.35 |
| llama-3.1-8b | 128K | $0.04 / $0.06 | $0.03 / $0.04 |
| deepseek-v3 | 128K | $0.35 / $1.00 | $0.25 / $0.70 |
Authorization: Bearer dl-your-api-keyFree key at dashboard. 50K requests/month free on Developer tier.
| Header | Direction | Description |
|---|---|---|
| X-Daylite-Customer | Request | Your customer ID for cost attribution |
| X-Daylite-Feature | Request | Feature name for cost breakdown |
| X-Daylite-Cost | Response | Cost of this request in USD |
| X-Daylite-Tokens-In | Response | Input tokens consumed |
| X-Daylite-Tokens-Out | Response | Output tokens generated |
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/chat/completions | Chat completions (streaming supported) |
| GET | /v1/models | List available models |
| GET | /v1/usage | Per-customer usage breakdown |
| POST | /v1/budgets | Set spend caps per customer |
| POST | /api/checkout | Purchase credit packs (Stripe) |