Take credit/API
Redeem locks a provider. The acc_ key is that vendor’s real contract. Usage hits the live model and burns remaining cents. Upstream credentials stay on the server.
| Vendor | Path | Auth |
|---|---|---|
| OpenAI | POST /v1/chat/completions | Authorization: Bearer acc_… |
| DeepSeek | POST /v1/chat/completions | Authorization: Bearer acc_… |
| Anthropic | POST /v1/messages | x-api-key: acc_… |
| POST /v1beta/models/{model}:generateContent | x-goog-api-key: acc_… | |
| Grok | POST /v1/chat/completions | Authorization: Bearer acc_… |
Base URL is this origin. /gateway/v1 is the same API. Official SDKs work if you override baseURL.
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "acc_…",
baseURL: "http://localhost:3000/v1",
});
await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Hello" }],
});import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: "acc_…",
baseURL: "http://localhost:3000",
});
await client.messages.create({
model: "claude-sonnet-4-20250514",
max_tokens: 256,
messages: [{ role: "user", content: "Hello" }],
});Use the official generateContent path against this origin. Header is x-goog-api-key with the acc_ key. The model id is the one you locked at redeem.
curl http://localhost:3000/v1beta/models/gemini-2.0-flash:generateContent \
-H "x-goog-api-key: acc_…" \
-H "content-type: application/json" \
-d '{"contents":[{"parts":[{"text":"Hello"}]}]}'401 means the key is missing, revoked, or unknown. 400 means the body failed validation. 402 means the cap is spent. 503 means the upstream gateway is unset for that vendor. Desk credit still caps the key even when Gateway is healthy.