Tool calling

The proxy accepts OpenAI tools / function definitions. Many Gonka hosts already emit native tool calls. When they do not, and SIMULATE_TOOL_CALLS is enabled on the server, the proxy rewrites the request into a structured prompt and parses JSON back into tool_calls.

You do not flip that flag yourself. From a client, send a normal tools payload.

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Flash-0731",
    messages=[{"role": "user", "content": "What's the weather in Berlin?"}],
    tools=[{
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get current weather for a location",
            "parameters": {
                "type": "object",
                "properties": {"location": {"type": "string"}},
                "required": ["location"],
            },
        },
    }],
)
print(response.choices[0].message.tool_calls[0].function.arguments)

Loop

  1. Model returns tool_calls
  2. You run the function
  3. You send a role: tool message with tool_call_id
  4. Repeat until content is a final answer

DeepSeek + tools

If reasoning tokens leak into content, tool parsers in Cursor / OpenCode break. Turn on DeepSeek reasoning compatibility in Settings.

Not the same as MCP

type: "function" is your client-side tools. type: "mcp" is a remote server the proxy calls. See MCP. { "type": "web_search" } is also consumed by the proxy — see Web search. { "type": "deep_research" } is the research loop — see Deep research.