OpenAI-compatible API. Earn with attention.
Point your baseURL at https://api.attenval.com/v1, pass atv_live_YOUR_KEY, and call Auto, Fast, Code, or Smart. The amount a request uses depends on the alias.
curl https://api.attenval.com/v1/chat/completions \
-H "Authorization: Bearer atv_live_YOUR_KEY" \
-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": true,
"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_YOUR_KEY"),
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_YOUR_KEY',
baseURL: 'https://api.attenval.com/v1',
});
async function run() {
// Chat completions are streaming-only (SSE).
const stream = 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.' },
],
stream: true,
temperature: 0.2,
});
for await (const chunk of stream) {
const delta = chunk.choices[0]?.delta?.content;
if (delta) process.stdout.write(delta);
}
}
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!' }],
stream: true,
}),
});
// Response is text/event-stream, not a single JSON object.
const sse = await response.text();
console.log(sse); What you get in the API
Drop-in clients, hashed keys, reserved credits, and opaque aliases.
Reserve, then settle
Each request reserves credits before work starts and settles to actual use when it finishes. Unused reserved credits return to your balance.
Hashed key storage
API secrets (atv_live_YOUR_KEY and atv_test_...) are shown only once. We store hashes, not the secret. Set a daily credit cap and revoke keys instantly.
Four capability aliases
Call Auto, Fast, Code, or Smart. The amount a request uses depends on the alias. On a 502, retry the request.
Attenval metadata
Completions include an attenval object with requested_model, credits_used, and balance_remaining only.
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, 402 credit errors, and Retry-After on 429.
Model aliases →
Auto, Fast, Code, and Smart. The amount a request uses depends on the alias.