Model guide
apifare tools for DeepSeek
DeepSeek is a model, not an app, so it gets apifare through the app or code that runs it. Either way it gets one prepaid key for every API it needs, under hard caps and a kill switch.
1 · Run DeepSeek in an MCP client
The quickest route: Cline can run DeepSeek models (choose DeepSeek as the provider) and speaks MCP: follow the Cline guide.
2 · Or hand DeepSeek apifare as tools over HTTP
If your own code calls DeepSeek through DeepSeek's OpenAI-compatible API, give the model two tools. When it asks for one, your code runs it against apifare with your token.
import json, os, requests
from openai import OpenAI
llm = OpenAI(
base_url="https://api.deepseek.com",
api_key=os.environ["DEEPSEEK_API_KEY"],
)
APIFARE = "https://apifare.com"
auth = {"authorization": "Bearer " + os.environ["APIPAY_TOKEN"]}
def tool(name, description, properties):
return {"type": "function", "function": {
"name": name, "description": description,
"parameters": {"type": "object", "properties": properties,
"required": list(properties)}}}
tools = [
tool("apifare_search", "Find a paid API capability by what it does",
{"q": {"type": "string"}}),
tool("apifare_call", "Call a capability by slug with its params",
{"slug": {"type": "string"}, "params": {"type": "object"}}),
]
def run(name, args):
if name == "apifare_search":
r = requests.get(APIFARE + "/v1/search",
params={"q": args["q"]}, headers=auth)
else:
r = requests.post(APIFARE + "/v1/call/" + args["slug"],
json=args["params"], headers=auth)
return r.json()
messages = [{"role": "user",
"content": "Search the web for today's top AI news"}]
while True:
msg = llm.chat.completions.create(
model="<model>", messages=messages, tools=tools,
).choices[0].message
if not msg.tool_calls:
print(msg.content)
break
messages.append(msg)
for call in msg.tool_calls:
result = run(call.function.name, json.loads(call.function.arguments))
messages.append({"role": "tool", "tool_call_id": call.id,
"content": json.dumps(result)})Set DEEPSEEK_API_KEY and APIPAY_TOKEN, then replace <model> with a tool-calling model from DeepSeek's model list.
3 · Stay in control
Set daily or monthly caps per agent, and keep the kill switch ready. Both are checked before a call is dispatched. When the balance runs out, apifare_call returns an HTTP 402 with a top-up link your app can show; the error catalog lists every stop and what unblocks it. Exact per-call prices are on /capabilities.
Endpoint and tool-calling format checked against DeepSeek's docs on 2026-09-12. Markdown version: /models/deepseek.md.
More model guides
Kimi · Qwen · OpenAI GPT · Gemini