DocsMore docs

Tool calling (function calling)

Use tool calling with abliteration.ai to let models invoke external functions. OpenAI-compatible tools parameter with full examples in curl, Python, JavaScript, Java, and Go.

Let models call your functions via the OpenAI-compatible tools parameter. Works with existing SDKs — just switch the base URL.

Updated Feb 28, 2026More docs

Quick start

Base URL
curl https://api.abliteration.ai/v1/chat/completions \
  -H "Authorization: Bearer $ABLIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "abliterated-model",
    "messages": [
      { "role": "user", "content": "Look up the status of order 123." }
    ],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_order_status",
          "description": "Lookup an order status by id.",
          "parameters": {
            "type": "object",
            "properties": { "order_id": { "type": "string" } },
            "required": ["order_id"]
          }
        }
      }
    ]
  }'

Service notes

How tool calling works

#

Tool definition schema

#
Tool definition
{
  "type": "function",
  "function": {
    "name": "get_weather",
    "description": "Get the current weather for a given location.",
    "parameters": {
      "type": "object",
      "properties": {
        "location": {
          "type": "string",
          "description": "City and state, e.g. San Francisco, CA"
        },
        "unit": {
          "type": "string",
          "enum": ["celsius", "fahrenheit"]
        }
      },
      "required": ["location"]
    }
  }
}

Response with tool_calls

#
Example response
{
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": null,
        "tool_calls": [
          {
            "id": "call_abc123",
            "type": "function",
            "function": {
              "name": "get_order_status",
              "arguments": "{\"order_id\": \"123\"}"
            }
          }
        ]
      },
      "finish_reason": "tool_calls"
    }
  ]
}

Sending tool results back

#
curl https://api.abliteration.ai/v1/chat/completions \
  -H "Authorization: Bearer $ABLIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "abliterated-model",
    "messages": [
      { "role": "user", "content": "Look up the status of order 123." },
      {
        "role": "assistant",
        "content": null,
        "tool_calls": [{
          "id": "call_abc123",
          "type": "function",
          "function": {
            "name": "get_order_status",
            "arguments": "{\"order_id\": \"123\"}"
          }
        }]
      },
      {
        "role": "tool",
        "tool_call_id": "call_abc123",
        "content": "{\"status\": \"shipped\", \"tracking\": \"1Z999AA10\"}"
      }
    ]
  }'

Multiple tools

#
Multiple tools example
{
  "model": "abliterated-model",
  "messages": [
    { "role": "user", "content": "What's the weather in NYC and order status for 456?" }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get current weather for a location.",
        "parameters": {
          "type": "object",
          "properties": {
            "location": { "type": "string" }
          },
          "required": ["location"]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "get_order_status",
        "description": "Lookup an order status by id.",
        "parameters": {
          "type": "object",
          "properties": {
            "order_id": { "type": "string" }
          },
          "required": ["order_id"]
        }
      }
    }
  ]
}

Forcing a specific tool call

#
tool_choice example
{
  "model": "abliterated-model",
  "messages": [
    { "role": "user", "content": "Tell me about order 789." }
  ],
  "tools": [ ... ],
  "tool_choice": {
    "type": "function",
    "function": { "name": "get_order_status" }
  }
}

Best practices

#

Common errors & fixes