Sari la conținut

razorBridge AI Gateway

Acest conținut nu este încă disponibil în limba selectată.

razorBridge AI Gateway is the model API: an endpoint you can point an application at. It speaks the OpenAI chat-completions protocol, authenticates with a key you create yourself, and bills per token against the same credit balance as your AI Blades. Nothing is deployed or scaled on your side: there is no endpoint to provision and no model to load.

Use AI Gateway when you want to consume a model. Use a AI Blade when you want to train, fine-tune, or run something AI Gateway does not offer.

AI Gateway AI Blade
Unit of work One request One machine, for a stretch of time
Billed on Tokens used Wall-clock runtime
Charged As each call completes When the blade stops
Credential An AI Gateway key (rb-gate-…) The web app or an API session, then SSH
Idle cost None The blade keeps billing

Both draw on one balance and one ledger — see Credits and billing.

An AI Gateway key belongs to an account, not to a person, so any application holding it spends that account’s credits. Keys are shown once, at creation, and stored only as a hash: if you lose one, revoke it and make another.

A key can be narrowed in two ways:

  • Allowed models. A key can be restricted to a list of model ids. A request for anything else is refused with HTTP 403. This is set when the key is created through the API; the web app’s create form only asks for a name.
  • Budget cap. A key can carry a maximum lifetime spend in euros, after which its requests fail with HTTP 402. Ask KlusAI to set this — it is not yet self-serve.

Model ids are aliases in the form klusai/<name> — for example klusai/fast. The authoritative list for your account comes from the models endpoint (below); it changes as routes are added, so read it rather than hard-coding a catalogue.

In the web app, open Inference → API keys → Create API Key, give it a name, and choose Create Key. (The first time you open Inference, the page asks you to choose Continue to workspace before anything else appears.) The full key is revealed once, with a warning that it will not be shown again. It begins with rb-gate-.

The same page lists your keys with when each was last used, and Revoke turns one off. Revoking is immediate and permanent; requests using that key start failing with HTTP 401.

Keys can also be created, listed and revoked through the API — see /gate/keys, which is also where a model restriction is set.

The base URL is the AI Gateway root, /v1/gate; the SDK appends /chat/completions itself.

import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.razorbridge.eu/v1/gate",
api_key=os.environ["RB_GATE_KEY"],
)
response = client.chat.completions.create(
model="klusai/fast",
messages=[{"role": "user", "content": "Explain backpropagation in simple terms"}],
)
print(response.choices[0].message.content)
Terminal window
export RB_GATE_KEY="rb-gate-…"
Terminal window
curl https://api.razorbridge.eu/v1/gate/chat/completions \
-H "Authorization: Bearer $RB_GATE_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "klusai/fast",
"messages": [{"role": "user", "content": "Hello!"}]
}'

The response is the provider’s OpenAI-shaped JSON, returned in one piece. Streamed responses are not available: a request with "stream": true is refused with HTTP 400.

In the web app, Inference → Playground lets you pick a model, type a prompt and choose Run prompt. It uses your signed-in session rather than a AI Gateway key, so it works before you have created one — and it is billed like any other call. Integration on the same menu shows ready-to-paste curl, Python and JavaScript examples.

Terminal window
curl https://api.razorbridge.eu/v1/gate/models \
-H "Authorization: Bearer $RB_GATE_KEY"

The response includes an OpenAI-style model list, so the SDK’s client.models.list() works against the same base URL. The web app shows the same list under Inference → Models & pricing.

GET /v1/gate/usage lists your most recent calls with the model, prompt and completion token counts, and the cost in euros of each; Inference → Usage & receipts is the web app’s view. Every call also appears in the credit ledger with the source inference, so Credits reconciles against it.

Before a call runs, the most it could cost is held from your available credit; the actual cost is deducted as it completes. A call your available credit cannot cover returns HTTP 402 rather than running and leaving a debt.