Docs

Agents

Helmcode supports tool calling (function calling) on every language model: deepseek-v4-flash, qwen3.6, and gemma4. Since the API is OpenAI-compatible, agent frameworks built for OpenAI — the Agents SDK, LangChain, LlamaIndex, your own loop — run against Helmcode with the same code, just a different base URL and key.

Defining tools

Pass a tools array; the model decides when to call them and returns the arguments.

from openai import OpenAI
client = OpenAI(base_url="https://api.helmcode.com/v1", api_key="sk-your-key-here")

tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get the current weather for a city",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}]

resp = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[{"role": "user", "content": "What's the weather in Madrid?"}],
    tools=tools,
)
call = resp.choices[0].message.tool_calls[0]
print(call.function.name, call.function.arguments)  # get_weather {"city": "Madrid"}

The agent loop

  1. Send the user message with your tools.
  2. If the model returns tool_calls, execute them in your code.
  3. Append the results as role: "tool" messages and call the model again.
  4. Repeat until the model answers without a tool call.
messages.append(resp.choices[0].message)
messages.append({
    "role": "tool",
    "tool_call_id": call.id,
    "content": '{"temp_c": 28, "sky": "clear"}',
})
final = client.chat.completions.create(model="deepseek-v4-flash", messages=messages, tools=tools)
print(final.choices[0].message.content)

For complex multi-step agents, deepseek-v4-flash is the flagship. qwen3.6 is fast and cheap for high-volume loops. gemma4 uses XML-format tool calls, but most SDKs handle that for you.