API Reference

Request Headers

VectorAxis adds no proprietary fields to your request body — every capability is a plain HTTP header. That means you keep the stock OpenAI SDK and JSON body exactly as they are, and turn features on per request by adding a header. Pass them through the SDK’s extra_headers argument or set them directly on your HTTP client.

Credentials — one group required, mutually exclusive
HeaderWhat it does
Authorization: Bearer vk-<slug>Preferred. Pass the virtual key slug as a standard bearer token — set the OpenAI SDK’s api_key to the slug and it’s sent here automatically. Resolved in-process to provider + decrypted key.
x-virtual-keyThe virtual key slug as a dedicated header — an alternative to the bearer form. Takes precedence when both are present.
x-providerProvider id (e.g. OPENAI, ANTHROPIC, GROQ), normalised to SCREAMING_SNAKE_CASE. Use with x-api-key for the direct-credential path. See Providers.
x-api-keyYour raw provider API key. Use with x-provider. Never logged.
A virtual key auto-attaches org/workspace attribution, budget enforcement, and usage accounting; direct credentials don’t. See the note on Providers.
Caching
HeaderWhat it does
x-cache-modesimple (exact-match) or semantic. Caching is opt-in — omit this and the request is DISABLED. Ignored when stream: true. See Caching.
x-cache-ttlPer-request cache lifetime, in seconds.
x-cache-force-refreshtrue bypasses the cached entry and refreshes it with a fresh call. Only refreshes an already-enabled cache — it never turns caching on.
Retry & fallback
HeaderWhat it does
x-retry-countMax retries on a failing call, 0–5 (default 0). Exponential backoff. See Retry & Fallback.
x-retry-status-codesComma-separated HTTP codes that should trigger a retry, e.g. 429,503.
x-fallback-{n}-providerProvider for fallback attempt n (1–5), tried in order if the primary fails.
x-fallback-{n}-api-keyAPI key for fallback provider n.
x-fallback-{n}-modelOptional model override for fallback n.
Retry and fallback are disabled on streaming requests — a stream can’t be replayed mid-flight.
Routing, scoping & features
HeaderWhat it does
x-configSlug of a routing config to apply (weighted split, fallback chain, conditions).
x-guardrailSlug of a guardrail to enforce on the input/output phases; comma-separate to run several in order. Adds to whatever the virtual key already binds — it never replaces it, so this header cannot weaken a key’s policy. Omit it entirely and the key’s own guardrails still run.
x-organizationOrganisation id for log attribution and plan-limit scoping. Ignored when a virtual key supplies its own org (the key’s org is authoritative).
x-workspace-idWorkspace UUID. Scopes resource queries and is written to the log record.
x-metadataYour own key/value tags, echoed into logs and analytics for grouping and cost attribution.
x-prompt-slugUse a managed prompt by slug (alternative to the /v1/prompts/{slug}/completions path).
x-prompt-versionPin a specific prompt version or label; defaults to the published one.
Google Vertex AI overrides
HeaderWhat it does
x-vertex-projectOverride the GCP project resolved from the Vertex virtual key credential, per request.
x-vertex-regionOverride the region; use global for the multi-region endpoint.
x-vertex-modelMainly internal — carries the model id for Claude-on-Vertex, whose URL embeds the model in the path.

Response headers

On a non-streaming response, VectorAxis echoes back what actually happened (streaming responses omit these — they are committed before the per-request result is known):

HeaderWhat it does
x-cache-statusHIT / SEMANTIC_HIT / MISS / REFRESH / BYPASS / DISABLED.
x-retry-countRetries actually performed.
x-fallback-providerThe fallback provider that served the request, if any.
x-virtual-key-slugThe virtual key that was resolved.
x-guardrail-statusThe guardrail outcome, merged across every guardrail that applied (most severe wins) — PASS / BLOCK / REDACT / MONITOR / BYPASS.
Sending headers with the OpenAI SDK
python
from openai import OpenAI

client = OpenAI(base_url="https://api.vectoraxis.ai/v1", api_key="vk-1a2b3c4d5e6f7a8b")

client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}],
    extra_headers={
        "x-cache-mode": "semantic",
        "x-retry-count": "2",
        "x-fallback-1-provider": "ANTHROPIC",
        "x-fallback-1-api-key": "sk-ant-...",
        "x-guardrail": "pii-redact",
        "x-workspace-id": "6f1c...",
    },
)
Looking for the paths these headers attach to? See Endpoints.