100% OpenAI Drop-in Compatibility.
Switch your baseURL to https://api.attenval.com/v1, pass your atv_live_... key, and immediately leverage intelligent model routing with zero code refactoring.
curl https://api.attenval.com/v1/chat/completions \
-H "Authorization: Bearer atv_live_9f8a3d12bc784a9" \
-H "Content-Type: application/json" \
-d '{
"model": "attenval-code",
"messages": [
{ "role": "system", "content": "You are a compiler engineer." },
{ "role": "user", "content": "Write a zero-allocation LRU cache in Rust." }
],
"stream": false,
"temperature": 0.2
}' import os
from openai import OpenAI
# Attenval drop-in configuration
client = OpenAI(
api_key=os.environ.get("ATTENVAL_API_KEY", "atv_live_..."),
base_url="https://api.attenval.com/v1"
)
# Stream completion tokens
stream = client.chat.completions.create(
model="attenval-code",
messages=[
{"role": "system", "content": "You are a compiler engineer."},
{"role": "user", "content": "Write a zero-allocation LRU cache in Rust."}
],
stream=True,
temperature=0.2
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True) import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.ATTENVAL_API_KEY ?? 'atv_live_...',
baseURL: 'https://api.attenval.com/v1',
});
async function run() {
const response = await client.chat.completions.create({
model: 'attenval-code',
messages: [
{ role: 'system', content: 'You are a compiler engineer.' },
{ role: 'user', content: 'Write a zero-allocation LRU cache in Rust.' },
],
});
console.log(response.choices[0]?.message.content);
// Access Attenval ledger metadata
const meta = (response as any).attenval;
if (meta) {
console.log(`Credits spent: ${meta.credits_used} | Remaining: ${meta.balance_remaining}`);
}
}
run(); const response = await fetch('https://api.attenval.com/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer atv_live_YOUR_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'attenval-auto',
messages: [{ role: 'user', content: 'Hello Attenval!' }],
}),
});
const data = await response.json();
console.log(data); Built for Production Reliability
Engineered to give developers maximum uptime, strict ledger consistency, and zero vendor lock-in.
Sub-Millisecond Token Metering
Attenval isolates account balances in dedicated Cloudflare SQLite Durable Objects. Two-phase reserve and settle execution guarantees zero double-spend or negative balances under massive concurrency.
Encrypted Hashed Key Storage
API secrets (atv_live_... and atv_test_...) are shown only once upon creation. We store only salted cryptographic hashes. You can set daily credit limits and revoke keys instantly.
Automatic Provider Failover
If an upstream provider experiences elevated latency or outages, the Attenval AI Gateway reroutes incoming requests to healthy secondary nodes within milliseconds without dropping client connections.
Granular Custom Telemetry
Every completion response embeds an attenval metadata payload detailing the routed provider, actual tokens metered, integer credits consumed, and balance remaining.
Explore Guides & Endpoints
Quickstart →
From zero to your first streaming completion in under 5 minutes.
SpecificationAPI Endpoints Reference →
Complete schema for chat completions, credits, usage, and API key management.
ReliabilityErrors & Overdraft →
HTTP status codes, rate limiting headers, and atomic rollback guarantees.
Pricing & RatesModel Catalogs →
Context limits, underlying architectures, and integer credit rates per 1k tokens.