title: "Function Calling with Chinese AI Models: DeepSeek, GLM & Kimi"
published: true
tags: function-calling, tool-use, deepseek, glm, kimi
canonical_url: https://aiwave.live/blog/function-calling-chinese-ai-models
description: "Function calling support across DeepSeek V4, GLM-5, and Kimi K3. Format comparison and working Python examples for each model."
Function calling (also called tool use) lets LLMs execute structured actions: query databases, call APIs, trigger workflows. All three major Chinese model providers support it through OpenAI-compatible APIs.
Available through AIWave with model names deepseek-chat, glm-4-plus, kimi-k3.
All three accept the same tools parameter format as OpenAI:
{
"model": "deepseek-chat",
"messages": [...],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather for a city",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string"},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
},
"required": ["city"]
}
}
}
]
}
The model returns a tool_calls array with the function name and arguments. Your code executes the function, then sends the result back.
from openai import OpenAI
import json
client = OpenAI(api_key="***", base_url="https://aiwave.live/v1")
def get_weather(city, unit="celsius"):
# Your actual API call here
return {"temp": 22, "condition": "sunny"}
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather for a city",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string"},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
},
"required": ["city"]
}
}
}
}]
messages = [{"role": "user", "content": "What's the weather in Tokyo?"}]
response = client.chat.completions.create(
model="deepseek-chat",
messages=messages,
tools=tools
)
# Extract and execute function call
tool_call = response.choices[0].message.tool_calls[0]
args = json.loads(tool_call.function.arguments)
result = get_weather(args["city"])
# Send result back
messages.append(response.choices[0].message)
messages.append({"role": "tool", "tool_call_id": tool_call.id, "content": json.dumps(result)})
final = client.chat.completions.create(
model="deepseek-chat",
messages=messages
)
print(final.choices[0].message.content)
| DeepSeek V4 | GLM-5 | Kimi K3 | |
|---|---|---|---|
| Format | OpenAI-compatible | OpenAI-compatible | OpenAI-compatible |
| Multi-function | Supported | Supported | Supported |
| Parallel calls | Supported | Supported | Limited |
| Complex schemas | Good | Good | Adequate |
All three work with the same code above. Switch models by changing the model parameter.
Function calling is available on all AIWave models. The $0.20 starter credit covers hundreds of tool-calling turns to prototype your agent.