Velaron.AI

DocsAPI reference

Chat Completions

The OpenAI Chat Completions shape. Same request, same response, same streaming events, so existing clients work unchanged.

POST/v1/chat/completions

The body is passed to the model provider as is. Velaron.AI reads model, messages, stream and the max-tokens field, checks your balance, and forwards the rest untouched: tools, images, response formats, temperature, whatever your client sends.

curl https://velaron.ai/v1/chat/completions \
  -H "Authorization: Bearer sk_••••••••" \
  -H "Content-Type: application/json" \
  -d '{ "model": "velaron/test", "messages": [{ "role": "user", "content": "hi" }] }'

Request#

modelstring · required

A model id from GET /v1/models, such as openai/gpt-4o, or the built-in velaron/test.

messagesarray · required

A non-empty array of OpenAI-style messages. Text content is counted by length; each image or file part counts as a flat 1,000 input tokens for the balance check, so one photo never looks like a book.

streamboolean

true for server-sent events. See Streaming.

max_tokens · max_completion_tokensinteger

The most output you want. When max_completion_tokens is present it wins. If your balance cannot cover it, Velaron.AI lowers it to what you can afford before the call goes out. See Pricing and billing.

anything elsepassed through

Forwarded to the provider unchanged, except for provider-routing fields (provider, providerOptions, provider_options, models, route, byok), which are removed because they could change what you are billed for.

Response#

The provider's JSON, verbatim, plus two headers: x-vels-credits-charged and x-vels-balance. Failed calls carry neither, because nothing was charged.

200
HTTP/1.1 200 OK
content-type: application/json
x-vels-credits-charged: 11
x-vels-balance: 4989
x-request-id: 7f1c…

{ "id": "chatcmpl-…", "object": "chat.completion", "model": "openai/gpt-4o",
  "choices": [{ "index": 0, "message": { "role": "assistant", "content": "…" }, "finish_reason": "stop" }],
  "usage": { "prompt_tokens": 300, "completion_tokens": 500, "total_tokens": 800 } }

The echo model#

velaron/test answers on every Velaron.AI server, even one with no AI provider connected. It replies with Velaron.AI test: followed by your last user message, and it is billed by length at $3 in and $15 out per million tokens, like a mid-priced model. It is the fastest way to prove a key works end to end and to watch the billing headers move.

Echo reply
{ "id": "kredit-echo-1758560000000", "object": "chat.completion", "model": "velaron/test",
  "choices": [{ "index": 0, "message": { "role": "assistant", "content": "Velaron.AI test: hi" }, "finish_reason": "stop" }] }

Before the call goes out#

The gateway checks, in this order, and stops at the first that fails:

  1. The key is valid and under 60 requests this minute.
  2. The balance is above zero. At zero or below the answer is 402 insufficient_credits.
  3. The body is JSON with model and a non-empty messages array.
  4. The model is a chat model with a known price. Unknown ids are 404 model_not_found.
  5. The balance covers the prompt plus at least 16 output tokens. If it does not, the call is refused with the number of credits it would need.

Only then is the request sent. If the provider cannot be reached, you get 502 provider_unreachable and nothing is charged. If the provider answers with an error of its own, its status and body are relayed to you unchanged, and nothing is charged either.