Getting started
Quick start
VectorAxis exposes an OpenAI-compatible API and Anthropic’s Messages API. You only need to change your base URL and use a VectorAxis virtual key. The rest of your code stays identical. Four steps and you’re live.
1
Create a virtual key
In the dashboard, go to Virtual keys → New key. Choose a provider (e.g. OpenAI), paste your provider API key, and optionally set a credit budget or rate limits. Copy the API key it shows you (vk-….…). It’s shown only once, and it’s what your app will use instead of the real key. No provider account of your own? Create a PLATFORM key and draw on prepaid credits instead. Full detail on the Virtual keys page.
2
Point your SDK at VectorAxis
Replace your provider base URL with the gateway URL and set api_key to your VectorAxis API key. The SDK sends it as Authorization: Bearer and VectorAxis routes to the right provider.
Python
from openai import OpenAI
client = OpenAI(
base_url="https://api.vectoraxis.ai/v1",
api_key="vk-1a2b3c4d5e6f7a8b.Xk3pQ9vN2mR7tY1wZ8bC4dF6gH0jK5lM3nP7qS9uV2w", # your VectorAxis API key
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}],
)Using the Claude SDK? Its base URL is the gateway without /v1, and the key is an Anthropic virtual key (details in Claude SDK):
Python
import anthropic
client = anthropic.Anthropic(
base_url="https://api.vectoraxis.ai",
api_key="vk-c7d4e1f2a3b95a8b.Rq8mT2vX5nL9pW3kY7cJ1hF4dS6gB0zN2aE8uV5tQ1c", # an Anthropic virtual key
)
message = client.messages.create(
model="claude-haiku-4-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)Or with plain HTTP:
Bash
curl https://api.vectoraxis.ai/v1/chat/completions \
-H "Authorization: Bearer vk-1a2b3c4d5e6f7a8b.Xk3pQ9vN2mR7tY1wZ8bC4dF6gH0jK5lM3nP7qS9uV2w" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello!"}]}'To stream the reply as it’s generated, set stream: true. The response is a Server-Sent Events stream of OpenAI-format chunks, exactly as with OpenAI:
Python
stream = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Write a haiku about gateways."}],
stream=True,
)
for chunk in stream:
# The final chunk carries token usage and has an empty choices list.
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)Bash
curl -N https://api.vectoraxis.ai/v1/chat/completions \
-H "Authorization: Bearer vk-1a2b3c4d5e6f7a8b.Xk3pQ9vN2mR7tY1wZ8bC4dF6gH0jK5lM3nP7qS9uV2w" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello!"}],"stream":true}'Streaming has a few differences from a normal call. See Streaming.
3
Add gateway features via headers
Every VectorAxis capability is activated by a request header, with no SDK changes required. Turn on caching, retries, and a fallback provider in one call:
Python
response = client.chat.completions.create(
model="gpt-4o",
messages=[...],
extra_headers={
"x-cache-mode": "semantic", # serve similar queries from cache
"x-retry-count": "3", # retry transient failures
"x-fallback-1-provider": "ANTHROPIC", # fail over to Anthropic
"x-fallback-1-api-key": "sk-ant-...",
"x-guardrail": "pii-redact", # redact PII on the way out
},
)See every header on the Request headers reference.
4
View logs and cost in the dashboard
Every request is logged automatically. Open Logs to inspect latency, tokens, cost, cache status, and the full request/response bodies; open Analytics for cost and latency trends across all traffic. (Attribution to an org/workspace is automatic when you call with a virtual key.)
Where to next? Spread traffic with Routing configs, cut cost with Caching, enforce safety with Guardrails, or wire up your IDE via Coding agents.