Skip to Content
kosemdocs
GuidesLLM GatewayProviders

DeepSeek

Add DeepSeek's API as a provider, call DeepSeek models such as deepseek-v4-pro and preserve their reasoning in tool calls.

Connect DeepSeek's API using your API key to serve DeepSeek models such as deepseek-v4-pro. Adding a provider requires Owner or LLM Gateway Admin on the organization, or on a project for a project-scoped provider.

Add DeepSeek

  1. Create an API key on DeepSeek's platform.
  2. In your organization, click LLM Gateway, then Providers, then Add a provider, then DeepSeek 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.

What kosem uses

  • API: Chat Completions at https://api.deepseek.com. kosem translates calls with Anthropic's Messages or OpenAI's Responses to it.
  • Type, for the API: providerTypes/deepseek, with no settings.
  • Models to start with: deepseek-v4-pro and deepseek-flash.
  • Prices: DeepSeek's list prices, including cache hits, for usage and spend limits.

Reasoning and tool calls

DeepSeek models reason before responding unless turned off, returning their reasoning in reasoning_content. DeepSeek rejects tool-calling requests whose message history omits reasoning from 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.

kosem forwards DeepSeek-specific fields as sent: thinking turns reasoning on or off, and reasoning_effort accepts low, high or max. 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="deepseek",
    messages=[{"role": "user", "content": "Which is larger, 9.11 or 9.8?"}],
    reasoning_effort="high",
    extra_body={"thinking": {"type": "enabled"}},
)
print(response.choices[0].message.content)

If a call fails

ErrorWhat it meansWhat to do
400, reasoning_content … must be passed backThe tool-calling request history omitted previous model reasoningPreserve each full assistant message (including reasoning_content)

On this page