DEV Community

RouterBase for RouterBase

Posted on

Kimi K3.1 Pro is now available on RouterBase: a Python starting point

Kimi K3.1 Pro and Kimi K3.1 Pro Highspeed are now available on RouterBase. Both list a 1,048,576-token context window, text and image inputs, and support for tools and reasoning parameters. Highspeed is the faster-output option.

For a simple text request, install the openai Python package, set ROUTERBASE_API_KEY in your environment, and use RouterBase's OpenAI-compatible chat-completions endpoint:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["ROUTERBASE_API_KEY"],
    base_url="https://routerbase.com/v1",
)
response = client.chat.completions.create(
    model="moonshotai/kimi-k3.1-pro",
    messages=[{"role": "user", "content": "Explain how a Python dictionary works."}],
)
print(response.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode

To select Highspeed, use moonshotai/kimi-k3.1-pro-highspeed as the model ID. Keep the period in k3.1; the website's URL uses a different spelling.

The example sends one text message. Image input and tools require their own request fields. If you already have an OpenAI-compatible client, review its default parameters when adding either model.

Explore the new additions at RouterBase.

Top comments (0)