OpenRouter and Spro both expose an OpenAI-compatible API, so migration is mostly a find-and-replace: change the base URL, swap the API key, and remap model IDs.
Step-by-step
1. Change the base URL
# Before — OpenRouterclient = OpenAI( base_url="https://openrouter.ai/api/v1", api_key="<openrouter-key>",)
# After — Sproclient = OpenAI( base_url="https://spro.hridaai.com/v1", api_key="<spro-api-key>",)2. Remove OpenRouter-specific headers
OpenRouter uses extra headers like HTTP-Referer and X-Title for attribution. Spro doesn't need them — remove any extra_headers you pass:
# Remove theseclient.chat.completions.create( ..., extra_headers={ "HTTP-Referer": "https://yourapp.com", "X-Title": "Your App", },)3. Remap model IDs
OpenRouter model IDs use the author/model format — most map directly to Spro's provider-prefixed format:
| OpenRouter | Spro |
|---|---|
openai/gpt-4o | openai/gpt-4o |
anthropic/claude-sonnet-4 | anthropic/claude-sonnet-4 |
google/gemini-2.5-flash | google/gemini-2.5-flash |
meta-llama/llama-3.3-70b-instruct | groq/llama-3.3-70b-versatile |
z-ai/glm-5.3-flash | z-ai/glm-5.3-flash — or glm-5.3-flash for automatic routing |
Note
On Spro you can also drop the prefix entirely and let automatic routing pick the provider, or pin a hosting provider with its slug — e.g. together/glm-5.3-flash. See Models.
4. Migrate your routing config
OpenRouter's provider routing object isn't needed — Spro handles routing and failover automatically. Guardrails and cost policies replace OpenRouter's per-request settings — configure them once under Workspace → Guardrails (see Guardrails).
Coming from another gateway similar to OpenRouter? The same three steps apply — base URL, API key, model IDs. If that gateway uses OpenRouter-style author/model IDs, they'll usually carry over as-is.
Verify the migration
- Send a test request and confirm the response shape matches your expectations:
response = client.chat.completions.create( model="gpt-oss-20b", messages=[{"role": "user", "content": "Hello!"}],)print(response.choices[0].message.content)- Check your dashboard — the request should appear with token counts and latency.
- Enable guardrails and verify a violation appears when you send sensitive data:
response = client.chat.completions.create( model="gpt-oss-20b", messages=[{"role": "user", "content": "My SSN is 123-45-6789"}],)# With redaction enabled, the model sees "[REDACTED]" — check the dashboard logs