INhillstribe docsDashboard →

DeepSeek on Kura

DeepSeek V4 gives strong coding and agent performance with a 1M-token context, at a fraction of the price of other frontier models. On Kura it works with your existing key: just set the model name.

Models

Model nameBest forContext / max output
deepseek/deepseek-v4-proCoding agents, multi-step tool use, hard problems1M / 384K
deepseek/deepseek-v4-flashFast and cheap: chat, n8n flows, extraction, sub-agents1M / 384K
deepseek/deepseek-chatLegacy name, retired by DeepSeek on 2026-07-24–
deepseek/deepseek-reasonerLegacy name, retired by DeepSeek on 2026-07-24–
If your code still uses deepseek/deepseek-chat or deepseek/deepseek-reasoner, switch to deepseek/deepseek-v4-flash (for chat) or deepseek/deepseek-v4-pro (for reasoner).

Both V4 models support streaming, tool calls, JSON output and thinking mode.

Quick example

curl
curl https://kura.hillstribe.tech/v1/chat/completions \
  -H "Authorization: Bearer $KURA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-v4-pro",
    "messages": [
      {"role": "system", "content": "You are a senior Python engineer."},
      {"role": "user", "content": "Write a function that validates a Nepali mobile number."}
    ]
  }'
Python
import os
from openai import OpenAI

client = OpenAI(base_url="https://kura.hillstribe.tech/v1", api_key=os.environ["KURA_API_KEY"])

r = client.chat.completions.create(
    model="deepseek/deepseek-v4-pro",
    messages=[{"role": "user", "content": "Explain Big-O of quicksort in 3 lines."}],
)
msg = r.choices[0].message
print(msg.content)
Vercel AI SDK · npm i ai @ai-sdk/openai-compatible
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";

const kura = createOpenAICompatible({
  name: "kura",
  baseURL: "https://kura.hillstribe.tech/v1",
  apiKey: process.env.KURA_API_KEY,
});

const { text } = await generateText({
  model: kura("deepseek/deepseek-v4-pro"),
  prompt: "Give me 3 names for a trekking app.",
});

Thinking mode

DeepSeek V4 thinks before it answers, and thinking is on by default. The chain of thought comes back in a separate field, reasoning_content, next to content. When streaming, it arrives in delta.reasoning_content before the answer starts.

Python: read the thinking and the answer while streaming
stream = client.chat.completions.create(
    model="deepseek/deepseek-v4-flash",
    messages=[{"role": "user", "content": "Is 9.11 bigger than 9.9?"}],
    stream=True,
)
for chunk in stream:
    if not chunk.choices:
        continue
    d = chunk.choices[0].delta
    thinking = getattr(d, "reasoning_content", None)
    if thinking:
        print(thinking, end="")        # chain of thought
    if d.content:
        print(d.content, end="")       # final answer

Turning thinking down or off

To make replies faster and cheaper, send DeepSeek's thinking or reasoning_effort fields. Kura passes them through to DeepSeek. With the OpenAI Python SDK, put them in extra_body:

client.chat.completions.create(
    model="deepseek/deepseek-v4-flash",
    messages=[...],
    extra_body={"thinking": {"type": "disabled"}},   # or {"reasoning_effort": "low" | "high" | "max"}
)

While it's thinking, DeepSeek ignores temperature, presence_penalty and frequency_penalty. Sending them won't cause an error.

Conversation history

  • Plain chat (no tools): you don't need to send reasoning_content back. If you do, DeepSeek ignores it.
  • With tools: keep the reasoning_content of earlier assistant turns in the history. DeepSeek returns 400if it's missing from a tool-calling turn. The easy way is to append the whole assistant message you got back, unchanged (see the agent loop below).

Tool calling (function calling)

This is how an agent harness works: you describe tools, the model asks for one, you run it and send the result back, and you repeat until the model answers. Here is a complete loop you can run:

agent.py
import json, os
from openai import OpenAI

client = OpenAI(base_url="https://kura.hillstribe.tech/v1", api_key=os.environ["KURA_API_KEY"])
MODEL = "deepseek/deepseek-v4-pro"

def get_weather(city: str) -> dict:
    return {"city": city, "temp_c": 18, "sky": "clear"}   # call a real API here

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

messages = [{"role": "user", "content": "Should I carry a jacket in Pokhara today?"}]

for _ in range(10):                                   # safety limit
    r = client.chat.completions.create(model=MODEL, messages=messages, tools=TOOLS)
    msg = r.choices[0].message
    # Keep the full assistant message, including reasoning_content and tool_calls.
    messages.append(msg.model_dump(exclude_none=True))
    if not msg.tool_calls:
        print(msg.content)
        break
    for call in msg.tool_calls:
        args = json.loads(call.function.arguments)
        result = FUNCS[call.function.name](**args)
        messages.append({"role": "tool", "tool_call_id": call.id, "content": json.dumps(result)})

The same loop works with any model on Kura. Change MODEL to deepseek/deepseek-v4-flash for cheaper sub-tasks, or to anthropic/claude-sonnet-5-5 to compare.

LangChain

pip install langchain-openai
import os
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    base_url="https://kura.hillstribe.tech/v1",
    api_key=os.environ["KURA_API_KEY"],
    model="deepseek/deepseek-v4-pro",
)
print(llm.invoke("Summarise the plot of Muna Madan in two lines.").content)

JSON output

Set response_format to {"type": "json_object"}. DeepSeek also needs the word "json" and an example of the shape somewhere in your prompt. Set max_tokenshigh enough that the JSON isn't cut off.

r = client.chat.completions.create(
    model="deepseek/deepseek-v4-flash",
    response_format={"type": "json_object"},
    messages=[
        {"role": "system", "content": 'Extract the order as json, e.g. {"item": "momo", "qty": 2}'},
        {"role": "user", "content": "I'd like three plates of chowmein please"},
    ],
)
data = json.loads(r.choices[0].message.content)

Context caching (automatic)

DeepSeek caches repeated prompt prefixes on its side, such as a long system prompt, tool definitions or a document you ask several questions about. You don't need to change anything. Cached input tokens cost much less, and you can see them in the response as usage.prompt_cache_hit_tokens. To get the most hits, keep the start of your prompt identical between requests and put the changing parts at the end.

Use DeepSeek in your tools

Want DeepSeek in Hermes, Claude Code, OpenCode, Aider, Cline, Continue or n8n? See Agent harnesses for copy-paste configs.

Troubleshooting

SymptomFix
403The model isn't enabled on your account. Check Available models on the Kura dashboard page
Error mentioning deepseek-chat / deepseek-reasonerThose names were retired. Use deepseek/deepseek-v4-flash or deepseek/deepseek-v4-pro
400 in a tool loopEarlier assistant messages lost their reasoning_content. Append the assistant message unchanged
Long pause before the first wordThat's the model thinking. Stream the response, or lower reasoning_effort
Empty content with JSON modeMention "json" and give an example in the prompt, and raise max_tokens