A stable multi-step loop
Function calling against a strict schema: bad arguments are rejected and re-requested instead of silently executed.
Schema-strict function calling, SSE streams that survive step seven, and one key per agent so cost stays traceable. The loop still runs on your server; DataGo handles model routing, retries, and quotas.
Not because the model is not smart enough. Usually three mundane things: invalid tool arguments, a stream that drops halfway, and costs you only notice when the invoice arrives. All reliability, not IQ.
Function calling against a strict schema: bad arguments are rejected and re-requested instead of silently executed.
SSE streams deltas per step — tool name, arguments, result — so the UI never needs to poll.
One key per agent plus step and token ceilings, so one rogue agent cannot drain the others.
Three steps, executed inside your own infrastructure.
Send the JSON schema of tools you already have. The model may only pick from that list, never invent one.
The model returns a tool_call; your code runs the DB query or API call. DataGo never touches your systems.
Tool output goes back as role=tool. Step limits and budgets keep the loop under control.
Prices come straight from the catalog when the page loads. Estimates use typical tokens for one agent step.
| Model | Role | Input / 1M | Output / 1M | Estimate / request |
|---|---|---|---|---|
openai/gpt-6-luna |
Most schema-compliant and cheapest — default for high-volume agents | Rp675 | Rp2.250 | Rp1,71 |
glm/glm-5.3-flash |
Fast for lightweight agents and intent classification | Rp1.575 | Rp4.500 | Rp3,69 |
qwen/qwen3.8-max |
Deeper reasoning for complex multi-step planning | Rp3.150 | Rp9.450 | Rp17,96 |
Estimates use the token counts shown in the header. Prices update automatically whenever the catalog changes.
Browse all agent modelsTwo-step pattern: send the tool list, execute the tool_call, then send the result back.
import json, os
from openai import OpenAI
client = OpenAI(
base_url="https://api.datago.id/v1",
api_key=os.environ["DATAGO_API_KEY"],
)
tools = [{
"type": "function",
"function": {
"name": "get_order_status",
"description": "Look up an order status by order id",
"parameters": {
"type": "object",
"properties": {"order_id": {"type": "string"}},
"required": ["order_id"],
},
},
}]
r = client.chat.completions.create(
model="openai/gpt-6-luna",
messages=[{"role": "user", "content": "Has order INV-2041 shipped?"}],
tools=tools,
tool_choice="auto",
)
call = r.choices[0].message.tool_calls[0]
print(call.function.name, json.loads(call.function.arguments))
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.datago.id/v1",
apiKey: process.env.DATAGO_API_KEY,
});
const tools = [{
type: "function",
function: {
name: "get_order_status",
description: "Look up an order status by order id",
parameters: {
type: "object",
properties: { order_id: { type: "string" } },
required: ["order_id"],
},
},
}];
const r = await client.chat.completions.create({
model: "openai/gpt-6-luna",
messages: [{ role: "user", content: "Has order INV-2041 shipped?" }],
tools,
tool_choice: "auto",
});
const call = r.choices[0].message.tool_calls[0];
console.log(call.function.name, JSON.parse(call.function.arguments));
curl https://api.datago.id/v1/chat/completions \
-H "Authorization: Bearer $DATAGO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-6-luna",
"messages": [{"role": "user", "content": "Has order INV-2041 shipped?"}],
"tool_choice": "auto",
"tools": [{
"type": "function",
"function": {
"name": "get_order_status",
"description": "Look up an order status by order id",
"parameters": {
"type": "object",
"properties": {"order_id": {"type": "string"}},
"required": ["order_id"]
}
}
}]
}'
→ Always cap iterations: a step counter plus max_tokens. An uncapped loop is the fastest way to burn balance.
Usually the schema is too loose or the description is vague. Tighten required and enum, then validate server-side before executing — if it fails, send the error back and ask the model to retry.
Stream it. Each delta carries a slice of the tool call, so the UI can show the tool name when it starts and the result when it finishes, with no polling.
Yes. The model can return multiple tool_calls in one response; run them in parallel and send every result back in a single role=tool message.
Create a separate API key per agent in the dashboard and set step/token ceilings in your app. Per-key usage tells you which agent is expensive.
One key, one endpoint, tool calling docs already written. Start with one tool, not ten.