Base URL
https://api.vibgrate.com/relay/v1
Relay's endpoint shape is OpenAI-compatible (/relay/v1/..., not Vibgrate's usual /v1/<resource> API convention) specifically so existing OpenAI-client tooling can point at it with only a base-URL and key change.
Authentication
Authorization: Bearer <dsn-key>:<dsn-secret>
The credential is the same DSN key/secret pair vg login already provisions — there is no separate Relay-only credential to mint or rotate.
GET /relay/v1/models
Returns the current curated, priced model catalog. No upstream provider call is made to serve this — it works even if a specific upstream provider is degraded. Exactly one entry is flagged default.
curl https://api.vibgrate.com/relay/v1/models \
-H "Authorization: Bearer $VIBGRATE_RELAY_TOKEN"
POST /relay/v1/chat/completions
OpenAI chat-completions-shaped request and response.
curl https://api.vibgrate.com/relay/v1/chat/completions \
-H "Authorization: Bearer $VIBGRATE_RELAY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-5",
"messages": [{"role": "user", "content": "..."}],
"stream": true
}'
model— optional; falls back to the catalog default when omitted. See Model selection & routing — this is a one-time choice for the whole session, never a per-request auto-switch.stream— supported; usage accounting is read from the stream's finalusagechunk once it completes, so streaming never blocks on billing.max_tokens— used to compute the conservative cost estimate reserved before the request is served (see Pricing & credits); when omitted, Relay assumes a bounded fallback so an unbounded request can still be estimated.
Error responses
| Status | Meaning |
|---|---|
| 402 | insufficient_credit — the workspace balance can't cover the estimated cost. Response includes a top-up link and a correlation id. |
| 503 | No servable path for the requested model (no Workers AI mapping and no upstream key configured) — fails closed rather than serving a request nobody can bill upstream for. |
| 502 | The upstream provider call itself failed or returned a non-2xx response. The full reservation is released (settled at zero) before the error is returned — you are never charged for a failed request. |
See Troubleshooting & FAQ for how these surface inside VG Code and the panel.