For the complete documentation index, see llms.txt. This page is also available as Markdown.

Chat With Tool Calling

Chat with Tool Calling

post

The Infron supports OpenAI-compatible function calling, allowing models to call tools and functions. This follows the same specification as the OpenAI Function Calling API.

Header parameters
AuthorizationstringRequiredExample: sk-lZxz
Body
modelstringRequired
tool_choicestring · enumOptionalExample: autoPossible values:
streambooleanOptional
Responses
200Success
application/json
idstringRequired
modelstringRequired
objectstringRequired
createdintegerRequired
request_idstringRequired
post/v1/chat/completions
POST /v1/chat/completions HTTP/1.1
Host: llm.onerouter.pro
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 526

{
  "model": "openai/gpt-5.4",
  "messages": [
    {
      "role": "user",
      "content": "What is the weather like in San Francisco?"
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get the current weather in a given location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The city and state, e.g. San Francisco, CA"
            },
            "unit": {
              "type": "string",
              "enum": [
                "celsius",
                "fahrenheit"
              ],
              "description": "The unit for temperature"
            }
          },
          "required": [
            "location"
          ]
        }
      }
    }
  ],
  "tool_choice": "auto",
  "stream": false
}
200Success
{
  "id": "chatcmpl-DL1tfXWqe8PTi4YHVFxFLW0SA5uou",
  "model": "openai/gpt-5.4",
  "object": "chat.completion",
  "created": 1773904551,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": null,
        "tool_calls": [
          {
            "id": "call_udj4IpfC2snQz0fA3z8jXjcZ",
            "type": "function",
            "function": {
              "name": "get_weather",
              "arguments": "{\"location\":\"San Francisco, CA\",\"unit\":\"fahrenheit\"}"
            }
          }
        ]
      },
      "finish_reason": "tool_calls",
      "logprobs": null
    }
  ],
  "request_id": "0d1d1c8188a246838bf6d0ce13123bf3",
  "usage": {
    "prompt_tokens": 166,
    "completion_tokens": 25,
    "total_tokens": 191,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0,
      "audio_tokens": 0,
      "video_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 0,
      "image_tokens": 0,
      "audio_tokens": 0
    }
  }
}

Last updated