Idempotency covers all three write surfaces: deposits use an
idempotency_key body field, the billing primitives (freeze, consume, deduct, unfreeze) use your transaction_id, and model gateway calls (POST /v1/chat/completions, POST /v1/messages) use the optional Idempotency-Key request header.How it works
When Velobase receives a request, it checks if the provided identifier has already been processed for that specific customer:- First request: The operation is processed, the customer’s wallet is updated, and the result is returned with
"is_idempotent_replay": false. - Duplicate request: Velobase recognizes the identifier, skips the operation, and immediately returns the exact same result as the original request, but marked with
"is_idempotent_replay": true.
Identifiers by Endpoint
Velobase uses different identifier fields depending on the operation type. These fields must be passed in the JSON request body.
All amount fields on these requests are positive integer credits (1 USD = 1,000,000 credits).
Gateway calls: the Idempotency-Key header
Model gateway calls settle the customer wallet automatically, so their idempotency handle is a request header rather than a body field. SendIdempotency-Key: <unique-key> on POST /v1/chat/completions or POST /v1/messages:
- First request with a given key: the call is relayed and billed normally.
- Replay of the same key: the gateway returns
409with a clear message instead of relaying the call again and double-charging the customer.
Error: Transaction Conflict
Identifiers are scoped to the customer (customer_id). If you attempt to reuse the exact same transaction_id or idempotency_key for a different customer, Velobase will reject the request with a 409 Conflict error (transaction_conflict):
user-123-task-456).