Use CrowdRouter with the OpenAI SDK

If your code already talks to an OpenAI-style API, you switch to CrowdRouter by changing three values. No new SDK, no new request format.

Beta documentation. The API is not open yet and the address below is the planned beta endpoint, which is not serving requests today. Join the beta waitlist and we will email you when your key is ready.

What changes

Your existing client, plus a CrowdRouter base URL, a CrowdRouter API key and a CrowdRouter model ID.

  • Base URL

    Where the client sends requests

    OpenAI
    https://api.openai.com/v1
    CrowdRouter
    https://api.crowdrouter.com/v1
  • API key

    Sent as a Bearer token

    OpenAI
    your OpenAI key
    CrowdRouter
    your CrowdRouter key (CROWDROUTER_API_KEY)
  • Model ID

    Which model answers

    OpenAI
    for example gpt-4o
    CrowdRouter
    qwen3.8-27b

Everything else in your code (messages, parameters, response handling) stays as it is.

Python

With the official openai package:

python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.crowdrouter.com/v1",
    api_key=os.environ["CROWDROUTER_API_KEY"],
)

reply = client.chat.completions.create(
    model="qwen3.8-27b",
    messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)

Streaming works the same way:

python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.crowdrouter.com/v1",
    api_key=os.environ["CROWDROUTER_API_KEY"],
)

reply = client.chat.completions.create(
    model="qwen3.8-27b",
    messages=[{"role": "user", "content": "Hello"}],
    stream=True,
)
for chunk in reply:
    print(chunk.choices[0].delta.content or "", end="")

JavaScript and TypeScript

With the official openai package for Node.js:

javascript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.crowdrouter.com/v1",
  apiKey: process.env.CROWDROUTER_API_KEY,
});

const reply = await client.chat.completions.create({
  model: "qwen3.8-27b",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(reply.choices[0].message.content);

curl

Any HTTP client works, because the request is the standard chat completions request:

bash
curl https://api.crowdrouter.com/v1/chat/completions \
  -H "Authorization: Bearer $CROWDROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.8-27b",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Tool calls

Tools are passed in the standard tools field, so existing function-calling code carries over:

python
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Current weather for a city",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}]

reply = client.chat.completions.create(
    model="qwen3.8-27b",
    messages=[{"role": "user", "content": "Weather in Oslo?"}],
    tools=tools,
)
print(reply.choices[0].message.tool_calls)

What is different from OpenAI

  • The beta serves chat completions. Other OpenAI endpoints are not available yet.
  • Model IDs are CrowdRouter's own. Today that is qwen3.8-27b; see Qwen3.8-27B.
  • A request parameter that is not supported is rejected with a clear error instead of being ignored. The full list is in the API documentation.
  • New input, repeated (cached) input and output are billed at separate rates: $0.20, $0.05 and $1.10 per million tokens. Pricing. Beta pricing is subject to change during the beta period.

Try it when your key is ready

Tell us what you plan to run and we will email you as beta access opens.

Join the beta waitlist