1
Get your API key
- Sign in to the Velobase Dashboard.
- Create a project if you haven’t already.
- Go to Keys and generate a new key.
vb_live_is a project key. Use it server-side and tell Velobase who to bill with theX-Velobase-Customer: <user-id>header.vb_customer_is a customer-scoped key. It carries its own customer binding, so no header is needed.
2
Fund a customer wallet
Add funds to a customer’s wallet. If the customer does not exist yet, Velobase creates them automatically.This deposits 1,000,000 credits, which is $1.00.
amount is a positive integer number of credits: 1 credit = 1 micro-USD, so 1 USD = 1,000,000 credits.3
Make a model call
Point your OpenAI or Anthropic SDK at Velobase forwards the request upstream, settles the real token cost against the customer’s wallet, and returns per-call billing details in the response headers:
https://api.velobase.io/v1 and pass X-Velobase-Customer to say which wallet to bill. Models are defined per project: in the dashboard, add a model with a public id, your price, and your own upstream provider key, then call it by that id. GET /v1/models lists your project’s models.Always set
max_tokens. Before each call the gateway places a temporary hold
on the customer’s wallet (released or settled when the call finishes), and the
output part of that hold is sized from max_tokens. Without it the gateway
reserves for a large 8,000-token output, so customers need a much bigger
balance to pass the 402 check than the call will actually cost.X-Velobase-Cost-CreditsandX-Velobase-Cost-Usd: what this call cost.X-Velobase-Balance-CreditsandX-Velobase-Balance-Usd: the wallet balance after the call.X-Velobase-Transaction-Id: the ledger transaction for this call.X-Velobase-Trace-Id: your correlation id, echoed back if you sent one.
message_delta).You can list your project’s models with
GET /v1/models and review per-call spend with GET /v1/usage. A model whose upstream provider key has not been attached yet returns 402 byok_key_required.4
Bill work you price yourself (optional)
For work that is not a model call (for example image generation or a fixed-price feature), use the billing ledger primitives directly. Charge a customer in two ways:
- Use direct deduction when the cost is known upfront.
- Use staged deduction when the final cost is only known after execution.
- Option A: Direct deduction
- Option B: Staged deduction
Use this for fixed-price operations such as image generation or a known API call cost.This deducts 200,000 credits ($0.20) immediately.
5
Check the wallet
SDKs
Prefer a typed client? Install the Velobase JavaScript SDK and pin the version:Next steps
Funding wallets
Wallet categories, validity periods, and balance breakdown.
Direct deduction
Charge immediately when cost is known.
Staged deduction
Freeze first, then settle the actual cost.
API reference
Complete endpoint reference.