Skip to content

Features

Features

Advanced features available across providers.

Web Search

Enable real-time web search to ground model responses with current information. Available for OpenAI, Anthropic, Perplexity, and xAI.

OpenAI

Uses dedicated search models (gpt-4o-search-preview). Auto-selects the search variant when enabled.

json
{
  "provider": "openai",
  "model": "gpt-4o",
  "messages": [{ "role": "user", "content": "Latest AI news" }],
  "webSearch": {
    "enabled": true,
    "allowedDomains": ["techcrunch.com", "arxiv.org"],
    "userLocation": { "country": "BE", "city": "Antwerp" }
  }
}

Anthropic

Uses Anthropic's web_search tool. Returns citations in the response.

json
{
  "provider": "anthropic",
  "model": "claude-sonnet-4-5",
  "messages": [{ "role": "user", "content": "What happened today?" }],
  "webSearch": {
    "enabled": true,
    "maxUses": 5,
    "allowedDomains": ["reuters.com"],
    "blockedDomains": ["reddit.com"]
  }
}

xAI (X Search)

Searches X (Twitter) with handle filtering, date ranges, and media understanding.

json
{
  "provider": "xai",
  "model": "grok-4-1-fast-reasoning",
  "messages": [{ "role": "user", "content": "What is @elonmusk tweeting about?" }],
  "webSearch": {
    "enabled": true,
    "xSearch": {
      "allowedHandles": ["elonmusk"],
      "fromDate": "2025-01-01",
      "enableImageUnderstanding": true
    }
  }
}

Perplexity

Perplexity models have web search built-in. Use recencyFilter to limit results by time range. Citations are always included in responses.

json
{
  "provider": "perplexity",
  "model": "sonar-pro",
  "messages": [{ "role": "user", "content": "Latest developments in AI" }],
  "webSearch": {
    "enabled": true,
    "recencyFilter": "week",
    "allowedDomains": ["arxiv.org", "techcrunch.com"]
  }
}
Citations: When web search is used, the response includes a citations array with URL, title, and excerpt for each source used. Perplexity always returns citations regardless of web search settings.

Thinking Mode

Enable extended thinking for complex reasoning tasks. The model will use additional tokens to "think through" the problem. Available for Gemini and Anthropic.

json
{
  "provider": "gemini",
  "model": "gemini-2.5-flash",
  "messages": [{ "role": "user", "content": "Solve this step by step: ..." }],
  "thinkingMode": {
    "enabled": true,
    "budget": 8192
  }
}

The budget parameter is optional and limits the thinking token count.

Structured Output

Force models to respond in structured JSON format. Three modes available:

responseFormat: "json"

Model outputs valid JSON without a specific schema.

json
{
  "provider": "openai",
  "model": "gpt-4.1-mini",
  "messages": [{ "role": "user", "content": "List 3 colors as JSON" }],
  "responseFormat": "json"
}

responseFormat: "json_schema"

Model output must conform to the provided JSON schema.

json
{
  "provider": "openai",
  "model": "gpt-4.1-mini",
  "messages": [{ "role": "user", "content": "Classify this sentiment" }],
  "responseFormat": "json_schema",
  "jsonSchema": {
    "name": "sentiment",
    "schema": {
      "type": "object",
      "properties": {
        "label": { "type": "string", "enum": ["positive", "negative", "neutral"] },
        "confidence": { "type": "number" }
      },
      "required": ["label", "confidence"]
    }
  }
}

Tool Calling

Let models call functions defined by your application. CanaryLLM passes tool definitions through to the provider and returns tool call results back to you — your client executes the function and sends the result in a follow-up request. Available for Anthropic, OpenAI, and LMStudio.

Tool Definition

json
{
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get current weather for a location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": { "type": "string", "description": "City name" }
          },
          "required": ["location"]
        }
      }
    }
  ],
  "toolChoice": "auto"
}

Agentic Loop

The typical tool calling flow is a loop until the model stops calling tools:

  1. Send messages + tool definitions to the API
  2. Model responds with toolCalls and finishReason: "tool_calls"
  3. Execute each function locally with the provided arguments
  4. Append the assistant message (with toolCalls) and tool result messages (role "tool") to the conversation
  5. Send the updated conversation back — repeat until finishReason: "stop"

toolChoice Options

ValueBehavior
"auto"Model decides whether to call tools (default)
"none"Model will not call any tools
"required"Model must call at least one tool
{ type: "function", function: { name } }Model must call the specified function

Vision & PDF Input

Send images or PDF documents as part of your messages using multipart content arrays.

Image input

json
{
  "provider": "openai",
  "model": "gpt-4o",
  "messages": [{
    "role": "user",
    "content": [
      { "type": "text", "text": "What's in this image?" },
      { "type": "image", "data": "<base64>", "mimeType": "image/png" }
    ]
  }]
}

PDF input

json
{
  "provider": "anthropic",
  "model": "claude-sonnet-4-5",
  "messages": [{
    "role": "user",
    "content": [
      { "type": "text", "text": "Summarize this document" },
      { "type": "document", "data": "<base64>", "mimeType": "application/pdf" }
    ]
  }]
}