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 name | Best for | Context / max output |
|---|---|---|
deepseek/deepseek-v4-pro | Coding agents, multi-step tool use, hard problems | 1M / 384K |
deepseek/deepseek-v4-flash | Fast and cheap: chat, n8n flows, extraction, sub-agents | 1M / 384K |
deepseek/deepseek-chat | Legacy name, retired by DeepSeek on 2026-07-24 | – |
deepseek/deepseek-reasoner | Legacy name, retired by DeepSeek on 2026-07-24 | – |
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 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."}
]
}'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)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.
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 answerTurning 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_contentback. If you do, DeepSeek ignores it. - With tools: keep the
reasoning_contentof earlier assistant turns in the history. DeepSeek returns400if 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:
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
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
| Symptom | Fix |
|---|---|
403 | The model isn't enabled on your account. Check Available models on the Kura dashboard page |
Error mentioning deepseek-chat / deepseek-reasoner | Those names were retired. Use deepseek/deepseek-v4-flash or deepseek/deepseek-v4-pro |
400 in a tool loop | Earlier assistant messages lost their reasoning_content. Append the assistant message unchanged |
| Long pause before the first word | That's the model thinking. Stream the response, or lower reasoning_effort |
| Empty content with JSON mode | Mention "json" and give an example in the prompt, and raise max_tokens |