TESSEN Platform
Documentation
Docs/Model capabilities
MODEL CAPABILITIES

Tool calling

Let a model ask your code to run a function, then give it the result.

You describe functions in tools. If the model decides to use one, it answers with finish_reason: "tool_calls" and a tool_calls list instead of (or beside) text. Your code runs the function, appends the result as a tool message, and calls the API again. Tool calling is supported on Z1, Z1 Code and H1; it was verified on all three.

A COMPLETE TOOL-CALL LOOP
curl https://api.tessen.ai/v1/chat/completions \  -H "Authorization: Bearer $TESSEN_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "z1",    "max_tokens": 1024,    "tool_choice": "auto",    "tools": [{      "type": "function",      "function": {        "name": "get_weather",        "description": "Get the current weather for a city.",        "parameters": {          "type": "object",          "properties": {"city": {"type": "string"}},          "required": ["city"]        }      }    }],    "messages": [{"role": "user", "content": "What is the weather in Paris? Use the tool."}]  }'
  1. Describe the function

    tools is an array of { type: "function", function: { name, description, parameters } }. parameters is a JSON Schema object.

  2. Read the call

    choices[0].message.tool_calls[0] has id, function.name and function.arguments — a JSON string you must parse.

  3. Return the result

    Append the assistant message (with its tool_calls) and then a message with role: "tool", the same tool_call_id, and the result as a string.

  4. Ask again

    The model answers using the result.

Notes

  • tool_choice: "auto" is verified. Other OpenAI values are accepted but not verified here.
  • Validate arguments before you act on them: the model produces them and can get them wrong.
  • The assistant message's content may be empty or a short sentence when it calls a tool.
  • Tool definitions are sent with every request that uses them, so they add to prompt_tokens.

Search documentation

Titles, headings and guides↑ ↓ navigate · Enter open
Tool calling · Tessen Docs