Last updated: 2026-04-20
Mistral Integration
Route Mistral API calls through SpendLil.
SpendLil proxies Mistral's API. Swap api.mistral.ai for mistral.gateway.spendlil.ai and add X-SpendLil-Key. Your existing Authorization header passes through unchanged — Mistral is OpenAI-compatible, so you can use the OpenAI SDK with the Mistral gateway.
URL Pattern
diff Before → After
- POST https://api.mistral.ai/v1/chat/completions
+ POST https://mistral.gateway.spendlil.ai/v1/chat/completions OpenAI SDK (Python)
python Use the OpenAI SDK with the Mistral gateway
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ['MISTRAL_API_KEY'],
base_url='https://mistral.gateway.spendlil.ai/v1',
default_headers={'X-SpendLil-Key': os.environ['SPENDLIL_KEY']},
)
response = client.chat.completions.create(
model='mistral-large-latest',
messages=[{'role': 'user', 'content': 'Hello'}],
)
print(response.choices[0].message.content) cURL
bash Direct HTTP request
curl https://mistral.gateway.spendlil.ai/v1/chat/completions \
-H "Authorization: Bearer $MISTRAL_API_KEY" \
-H "X-SpendLil-Key: $SPENDLIL_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mistral-large-latest",
"messages": [{"role": "user", "content": "Hello"}]
}' Cost Tracking
| Model | Input (per 1M tokens) | Output (per 1M tokens) |
|---|---|---|
| mistral-large | $2.00 | $6.00 |
| mistral-small | $0.20 | $0.60 |