Send your first completion with curl. Replace <gateway-host> with your deployment FQDN and rp_... with your virtual key.
curlPOST /v1/chat/completions
curl https://<gateway-host>/v1/chat/completions \
-H "content-type: application/json" \
-H "x-routeplane-api-key: rp_..." \
-H "x-routeplane-provider: openai,anthropic" \
-d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello"}]}'
The x-routeplane-provider header above declares a fallback chain, try OpenAI first, fall back to Anthropic. Drop it to use the key's default provider.
Use any OpenAI SDK
Because the surface is OpenAI-compatible, you point the SDK's base_url at Routeplane and pass the virtual key. Custom x-routeplane-* headers go through the SDK's default-headers option.
pythonopenai SDK
from openai import OpenAI
client = OpenAI(
base_url="https://<gateway-host>/v1",
api_key="rp_...", # your Routeplane virtual key
default_headers={"x-routeplane-provider": "openai,anthropic"},
)
resp = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
Note. The OpenAI SDK sends the key as a bearer token by default; Routeplane reads it from
x-routeplane-api-key. Most SDKs let you set that header explicitly via default_headers, or send the key in both places during migration.