Quick Start
Get your first AI API call routed through AI SpendOps in under 5 minutes.
Prerequisites
- An AI SpendOps account with an API key (
aso_k_...) - An API key for your AI provider (e.g. OpenAI
sk-...)
Step 1: Understand the URL format
The proxy URL follows this pattern:
https://proxy.aispendops.com/v1/{provider}/{provider-api-path}
Everything after /v1/{provider} is forwarded to the provider's upstream API as-is.
Step 2: Make your first request
Add two things to your existing API call:
- Change the base URL to
https://proxy.aispendops.com/v1/{provider} - Add the
X-ASO-API-Keyheader
curl https://proxy.aispendops.com/v1/openai/v1/chat/completions \
-H "Authorization: Bearer sk-your-openai-key" \
-H "X-ASO-API-Key: aso_k_yourkey.secret" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"messages": [{"role": "user", "content": "Hello, world!"}]
}'
You'll get back the exact same response as calling OpenAI directly, plus an X-ASO-Request-Id header for tracing.
Step 3: Add dimensions (optional)
Tag your requests with metadata for cost attribution:
curl https://proxy.aispendops.com/v1/openai/v1/chat/completions \
-H "Authorization: Bearer sk-your-openai-key" \
-H "X-ASO-API-Key: aso_k_yourkey.secret" \
-H "X-ASO-Dims: team=backend,app=chatbot,env=prod" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"messages": [{"role": "user", "content": "Hello, world!"}]
}'
Step 4: Use with your SDK
Most AI SDKs let you override the base URL. Here's the Python OpenAI SDK:
from openai import OpenAI
client = OpenAI(
api_key="sk-your-openai-key",
base_url="https://proxy.aispendops.com/v1/openai/v1",
default_headers={
"X-ASO-API-Key": "aso_k_yourkey.secret",
"X-ASO-Dims": "team=backend,app=chatbot",
},
)
response = client.chat.completions.create(
model="gpt-4.1",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
See SDK Integration for more examples.
What happens behind the scenes
- The proxy authenticates your
X-ASO-API-Key - Your request is forwarded to the provider unchanged
- The provider's response is returned to you unmodified
- Asynchronously (after response delivery), usage data is extracted and queued for processing
- Usage events are enriched with pricing and written to the analytics database
The async extraction means zero overhead on your response latency.
Next steps
- Authentication — API key format and error handling
- URL Format — Detailed URL routing guide
- Dimensions — Tag requests for cost attribution