Virtual keys
A virtual key is a safe stand-in for a real provider API key. Your application carries a VectorAxis API key instead of a provider secret, and VectorAxis swaps in the real credential at request time. It’s the single place to store keys securely, cap spend, throttle usage, and switch providers, without ever exposing a raw key to your code.
- Secrets stay out of your app. The real provider key lives encrypted in the vault; your code only ever sees its VectorAxis API key, which you can rotate at any time.
- Budgets & guardrails per key. Give each team, customer, or environment its own key with its own spend cap and rate limits, so a runaway script can’t blow the bill.
- One slug, many controls. Restrict which models a key may use, set an expiry, attach metadata for reporting, and watch usage, all on the key, with no app changes.
- Provider freedom. Each key points at a provider of your choice (OpenAI, Anthropic, and more), or lets the platform supply access on your behalf.
| Mode | What it means |
|---|---|
| BYOK | Bring your own key. You provide your provider’s API key; VectorAxis encrypts and stores it, then uses it for this key’s requests. You’re billed by the provider directly. |
| PLATFORM | VectorAxis supplies provider access from its own accounts and draws down a prepaid credit balance you top up. No provider account needed. See Platform keys. |
Most providers take a single API key. Google Vertex AI is the exception: its credential is a service-account JSON plus a project and region, which the key stores alongside the secret. A TypeSafe AI key is a single API key too, but it only works on System One (/v1/systemone), not on chat completions.
Every key has two parts:
- The slug, vk-{16 hex characters}, is the key’s permanent identifier. It appears in the dashboard, logs and routing configs, and never changes.
- The API key, {slug}.{secret}, is the credential. It is shown once, when the key is created or rotated. VectorAxis stores only a hash of the secret, so it can’t be displayed again. If you lose it, rotate the key.
Use the API key anywhere you’d normally put a provider API key:
- As the api_key in any OpenAI-compatible SDK. It travels as Authorization: Bearer vk-….… and resolves to your real credential.
- Or on the x-virtual-key header of a direct API call.
from openai import OpenAI
client = OpenAI(
base_url="https://api.vectoraxis.ai/v1",
api_key="vk-1a2b3c4d5e6f7a8b.Xk3pQ9vN2mR7tY1wZ8bC4dF6gH0jK5lM3nP7qS9uV2w", # your VectorAxis API key
)
client.chat.completions.create(model="gpt-4o-mini", messages=[...])Lifecycle states
Every key is always in one of four states. This is what decides whether a request is allowed through.
| State | What it means | Moves to |
|---|---|---|
| ACTIVE | Working normally: requests are served. | DISABLED, EXHAUSTED, or EXPIRED |
| DISABLED | Manually paused (e.g. you suspect it leaked). Requests are refused. | back to ACTIVE when you re-enable it |
| EXHAUSTED | Hit its spend cap. Requests are refused until budget frees up. | back to ACTIVE when the credit counter resets |
| EXPIRED | Past its expiry date. Terminal. It can’t be reactivated. | - |
Rate limits: throttle usage
Cap how fast a key can be used so one team or script can’t starve everyone else or trip a provider’s limits. A request over the limit is refused with 429 Too Many Requests. Leave a limit unset to not enforce it.
| Field | What it does | Accepted values | Default |
|---|---|---|---|
| rate_limit_rpm | Requests per minute. Checked before the call; the request over the limit is rejected. | a whole number of requests | unlimited |
| rate_limit_rpd | Requests per day (resets at midnight UTC). Checked before the call. | a whole number of requests | unlimited |
| rate_limit_tpm | Tokens per minute. Checked after each call (tokens are only known once the model responds), so it caps sustained throughput. | a whole number of tokens | unlimited |
Credit budgets: cap spend
Put a hard dollar ceiling on a key. VectorAxis tracks the running cost of every request against the cap; when it’s reached, the key flips to EXHAUSTED and further requests are refused, so a bug or abuse can’t run up an unbounded bill.
| Field | What it does | Accepted values | Default |
|---|---|---|---|
| credit_limit_usd | The spend ceiling. Reaching it moves the key to EXHAUSTED. | a dollar amount | no cap |
| credit_alert_threshold_usd | A softer line that raises a warning (not a block) when spend crosses it: an early heads-up before the cap. | a dollar amount | no alert |
| credit_reset_policy | Whether (and how often) the spend counter resets, restoring an exhausted key to ACTIVE. | MONTHLY / WEEKLY / NEVER | NEVER |
What a key may do, and how it’s labelled
| Field | What it does | Accepted values | Default |
|---|---|---|---|
| model_allowlist | Limit the key to specific models. A request for any other model is rejected before it reaches the provider. | a list of model ids | any model the provider supports |
| provider_whitelist | Limit which providers the key may reach. | a list of provider ids | the key’s own provider(s) |
| expires_at | An automatic end date; after it, the key becomes EXPIRED (terminal). | a date/time | never expires |
| note | A free-text description for humans: what the key is for. | any text | empty |
| metadata | Your own key/value tags, echoed into logs and analytics for grouping and cost attribution. | flat key→value pairs | none |
Tool results your agents send back
Every tool result in a request on a key is scanned for injected instructions before the model reads it. The key decides what a match does: MONITOR records it (the default), REDACT strips the matched text, BLOCK refuses the request with a 422. Choose it under Tool results when you create or edit a key, or set it with PUT /v1/virtual-keys/{slug}/tool-scan. What your agent has to handle for each is in Tools on the chat API.
Rotating an API key
Rotate a key from the rotate action in the Virtual Keys list, or with POST /v1/virtual-keys/{slug}/rotate (workspace or org admin).
- The old API key stops working immediately. There is no grace period, so update every service that uses the key straight after rotating.
- The new API key is shown once, in the rotation response.
- Nothing else changes. The slug, usage, credit balance, rate limits and guardrails stay as they were. Requests that reach the key through a routing config don’t send the key, so rotation doesn’t affect them.
- Legacy keys. Keys created before API keys existed are marked legacy. Their slug still works as the credential until you rotate them for the first time. From then on the slug alone is rejected.
Moving & auditing keys
- Transfer between workspaces. Move a key, and its remaining credit balance, to another workspace in the same organization with POST /v1/virtual-keys/{slug}/transfer. Requires a workspace (or org) admin; an expired key can’t be moved.
- Full audit trail. Every change to a key (create, update, disable, enable, rotate, tool scan setting, delete) is recorded with who did it and when, so you always have a history for security and compliance reviews.