Switch from OpenAI API to RouteScope
Minimal changes for moving an existing OpenAI SDK, curl request, or OpenAI-compatible client to RouteScope.
If your project already calls the OpenAI API, switching to RouteScope usually means changing three values: Base URL, API Key, and model name. The request format can stay OpenAI-compatible.
| Setting | OpenAI | RouteScope |
|---|---|---|
| Base URL | https://api.openai.com/v1 | https://api.routescope.ai/v1 |
| API Key | OpenAI key | RouteScope API Key starting with sk-... |
| Model | OpenAI model name | A model copied from Model Plaza or /v1/models |
Use the /v1 Base URL
OpenAI-compatible clients should use https://api.routescope.ai/v1. Do not use the website URL, and do not omit /v1.
Step 1: Create a RouteScope API Key
Create an API Key in the RouteScope console and copy the full sk-... value.
If you are not sure which models your account can call, check Model Plaza or call:
curl https://api.routescope.ai/v1/models \
-H "Authorization: Bearer sk-your-token"Step 2: Update your OpenAI SDK settings
JavaScript / TypeScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.ROUTESCOPE_API_KEY,
baseURL: "https://api.routescope.ai/v1",
});
const completion = await client.chat.completions.create({
model: "your-routescope-model",
messages: [{ role: "user", content: "Reply with RouteScope connected" }],
});
console.log(completion.choices[0]?.message?.content);If your application already reads OPENAI_API_KEY, you can keep that environment variable name. Set its value to the RouteScope API Key and change the Base URL.
Python
from openai import OpenAI
client = OpenAI(
api_key="sk-your-token",
base_url="https://api.routescope.ai/v1",
)
resp = client.chat.completions.create(
model="your-routescope-model",
messages=[{"role": "user", "content": "Reply with RouteScope connected"}],
)
print(resp.choices[0].message.content)curl
curl https://api.routescope.ai/v1/chat/completions \
-H "Authorization: Bearer sk-your-token" \
-H "Content-Type: application/json" \
-d '{
"model": "your-routescope-model",
"messages": [
{
"role": "user",
"content": "Reply with RouteScope connected"
}
]
}'Step 3: Keep the OpenAI-compatible paths
| Capability | RouteScope path |
|---|---|
| Model list | GET /v1/models |
| Chat completions | POST /v1/chat/completions |
| Image generation | POST /v1/images/generations |
| Image edits | POST /v1/images/edits |
For example, chat completions use https://api.routescope.ai/v1/chat/completions.
Step 4: Verify the request
After a successful request, open operation records and check:
| Item | What to verify |
|---|---|
| Model | It matches the RouteScope model you requested. |
| Token | It matches the API Key you created. |
| Status | The request succeeded, or the failure reason is clear. |
| Usage | Token usage and cost were recorded. |
Common issues
| Symptom | Fix |
|---|---|
401 or 403 | Check that the API Key is complete, enabled, and has quota and permission. |
404 or model not found | Copy a model name from Model Plaza or /v1/models. |
| Requests still go to OpenAI | Check whether an old Base URL remains in the SDK, proxy, or client. |
| Claude-native calls fail | Claude Messages uses https://api.routescope.ai/v1/messages; do not send it through an OpenAI SDK path. |
Last updated on