Skip to Content
kosemdocs
GuidesLLM GatewayProviders

Kimi

Add Moonshot AI's Kimi API as a provider, call Kimi models such as kimi-k3.1-pro and set their reasoning effort.

Connect Moonshot AI's Kimi API using your API key to serve Kimi models such as kimi-k3.1-pro. Adding a provider requires Owner or LLM Gateway Admin on the organization, or on a project for a project-scoped provider.

Add Kimi

  1. Create an API key on the Kimi API Platform.
  2. In your organization, click LLM Gateway, then Providers, then Add a provider, then Kimi under Model providers.
  3. Paste the key into API key, select which projects can create models with this provider, click Test and click Add provider.

See Add a provider for adding a project provider, sharing and key rotation.

Keys from Kimi's China platform (platform.moonshot.cn) and Kimi For Coding don't work here: this provider calls only the international API.

What kosem uses

  • API: Chat Completions at https://api.moonshot.ai/v1. kosem translates calls with Anthropic's Messages or OpenAI's Responses to it.
  • Type, for the API: providerTypes/moonshotai, with no settings.
  • Models to start with: kimi-k3.1-pro, kimi-k3 and kimi-k3.1-pro-highspeed.
  • Prices: Kimi's list prices, including cache reads and writes, for usage and spend limits.

Reasoning and tool calls

Kimi models return their reasoning in reasoning_content and build on reasoning returned in earlier turns.

  • Agents and translated calls: kosem passes each model's reasoning back only to that model.
  • Direct Chat Completions calls: preserve each full assistant message (including reasoning_content), such as by appending response.choices[0].message.

K3 models always reason and accept reasoning_effort (low, high or max). Kimi K2.6 reasons unless thinking turns it off, and doesn't accept reasoning_effort. kosem forwards these fields as sent; with OpenAI's SDK, pass thinking in extra_body:

import os

from openai import OpenAI

client = OpenAI(
    base_url=f"https://api.kosem.ai/v1/projects/{os.environ['KOSEM_PROJECT']}/llm/openai/v1",
    api_key=os.environ["KOSEM_API_KEY"],
)
response = client.chat.completions.create(
    model="kimi",
    messages=[{"role": "user", "content": "Outline a test plan for a payments API."}],
    reasoning_effort="low",
)
print(response.choices[0].message.content)

If a call fails

ErrorWhat it meansWhat to do
400 about thinkingK3 models don't accept thinkingSend reasoning_effort instead
400 about tool_choiceKimi K2.6 and K2.7 Code reject requiredOmit tool_choice, or send auto

On this page