plaingateway
Features

Tool calling

Let a model call your functions, then send back the results.

A tool call has three steps: you send tools, the model answers with a call, and you send the call's result back.

1. Send the tools

sh
curl https://api.plaingateway.com/api/v1/chat/completions \
  -H "Authorization: Bearer $PLAINGATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "openai/gpt-5.6-luna", "messages": [{"role": "user", "content": "Weather in Paris?"}], "tools": [{"type": "function", "function": {"name": "get_weather", "description": "Current weather for a city", "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}}]}'

tool_choice is auto (the default), none, required, or {"type": "function", "function": {"name": "get_weather"}}.

2. Read the call

The answer has finish_reason: "tool_calls" and the call in the message:

json
{"role": "assistant", "content": null, "tool_calls": [{"id": "call_1", "type": "function", "function": {"name": "get_weather", "arguments": "{\"city\": \"Paris\"}"}}]}

3. Send the result

Run the function, then send the whole conversation again with the assistant message and a tool message:

json
"messages": [
  {"role": "user", "content": "Weather in Paris?"},
  {"role": "assistant", "content": null, "tool_calls": [{"id": "call_1", "type": "function", "function": {"name": "get_weather", "arguments": "{\"city\": \"Paris\"}"}}]},
  {"role": "tool", "tool_call_id": "call_1", "content": "18 C, cloudy"}
]

Send the same tools again. The model then answers in text.

Other API shapes

On /messages, use Anthropic's tools, tool_use and tool_result blocks. On /responses, use function tools and function_call_output items. The gateway translates tool calls between shapes when the host serves another shape. On a translated /responses host, only function tools work.