>_ OpenAI Tools / Function Calling

Drop-in tool definitions for the TerminalFeed API. Paste, wire up the handler, ship.

FREE 27 TOOLS OPENAI / ANTHROPIC / GEMINI NO SIGNUP

This page gives you ready-to-use function-calling definitions for every TerminalFeed endpoint. Free-tier tools (24 of 27) require no auth. The three premium tools (tf_pro_briefing, tf_pro_macro, tf_pro_crypto_deep) accept a bearer token funded with USDC on Base. See /developers/agent-payments for the auth flow.

The catalog is live. The authoritative source is /api/llm-tools, which returns the full set in OpenAI format, Anthropic format, and a raw schema-agnostic listing. Fetch it once on agent boot and you stay current as new tools land. The snippets below are pre-rendered subsets of the same catalog.

Quick Start

Three lines: paste the tools array into your model call, paste the universal handler, route tool calls back to the model. The handler is one function for all 27 tools because every TerminalFeed tool maps to a simple HTTP GET or POST.

1. Pull the live tool catalog

# Python
import requests
catalog = requests.get("https://terminalfeed.io/api/llm-tools").json()
openai_tools     = catalog["openai"]      # OpenAI Chat Completions / Responses API
anthropic_tools  = catalog["anthropic"]   # Anthropic Messages API
raw_catalog      = catalog["raw"]         # schema-agnostic, includes urls + auth + tier
// JavaScript / Node
const catalog = await fetch("https://terminalfeed.io/api/llm-tools").then(r => r.json());
const openaiTools    = catalog.openai;
const anthropicTools = catalog.anthropic;
const rawCatalog     = catalog.raw;

If you'd rather pin a static copy of the schemas instead of fetching at runtime, the snippets below are stable and safe to paste verbatim. They cover the most common tools. New tools added to TerminalFeed will appear in /api/llm-tools automatically.

Tool Definitions (OpenAI Format)

Pre-rendered OpenAI Chat Completions / Responses API tool definitions. Every TerminalFeed tool name is prefixed with tf_ so it never collides with tools from other vendors in the same agent.

[
  {
    "type": "function",
    "function": {
      "name": "tf_briefing",
      "description": "One-call world-state snapshot from TerminalFeed. Composed from BTC ticker, Crypto Fear & Greed Index, recent earthquakes (USGS), top Hacker News story count, and ISS crew. Cache TTL 60s. No auth. Use when the agent needs a quick global pulse before deciding what to investigate.",
      "parameters": { "type": "object", "properties": {}, "required": [] }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "tf_btc_price",
      "description": "Live Bitcoin price in USD with 24h change, high, low, and volume. Source: Binance with CoinCap fallback. Cache TTL 15s. No auth. Use for crypto trading decisions or when the agent needs a fresh BTC quote.",
      "parameters": { "type": "object", "properties": {}, "required": [] }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "tf_fear_greed",
      "description": "Crypto Fear & Greed Index value (0-100) with classification label. Source: Alternative.me. Cache TTL 5min. No auth. Use as a sentiment signal for crypto trading decisions.",
      "parameters": { "type": "object", "properties": {}, "required": [] }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "tf_crypto_movers",
      "description": "Top 15 cryptocurrencies sorted by 24h price change. Includes price, market cap, and percentage move. Cache TTL 30s. No auth. Use to surface notable crypto market moves.",
      "parameters": { "type": "object", "properties": {}, "required": [] }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "tf_predictions",
      "description": "Active Polymarket prediction markets sorted by 24h volume. Each market includes question, outcomes, and volume. Cache TTL 60s. No auth. Use for market-implied probabilities on world events (elections, sports, macro).",
      "parameters": { "type": "object", "properties": {}, "required": [] }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "tf_earthquakes",
      "description": "Recent earthquakes magnitude 2.5+ from USGS. Returns count and most recent quake details. Cache TTL 2min. No auth. Use for disaster monitoring or when the agent needs current seismic activity.",
      "parameters": { "type": "object", "properties": {}, "required": [] }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "tf_service_status",
      "description": "Operational status of GitHub, Cloudflare, Discord, OpenAI, Vercel, npm, Reddit, Atlassian, Anthropic. Cache TTL 60s. No auth. Use to know if a dependency is up or to explain a recent outage.",
      "parameters": { "type": "object", "properties": {}, "required": [] }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "tf_economic_data",
      "description": "Latest FRED economic indicators: Fed funds rate, CPI, unemployment rate, GDP growth. Cache TTL 1h. No auth. For deeper macro use tf_pro_macro (premium).",
      "parameters": { "type": "object", "properties": {}, "required": [] }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "tf_forex",
      "description": "Foreign exchange rates with USD as base for 16 major currencies. Source: Frankfurter (ECB-based). Cache TTL 5min. No auth.",
      "parameters": { "type": "object", "properties": {}, "required": [] }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "tf_weather",
      "description": "Current weather for any coordinates. Returns temperature (Fahrenheit), weather code, wind speed (mph), and humidity. Source: Open-Meteo. Cache TTL 10min per location. No auth.",
      "parameters": {
        "type": "object",
        "properties": {
          "lat": { "type": "number", "description": "Latitude in decimal degrees, e.g. 34.05 for Los Angeles." },
          "lon": { "type": "number", "description": "Longitude in decimal degrees, e.g. -118.24 for Los Angeles." }
        },
        "required": ["lat", "lon"]
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "tf_pro_briefing",
      "description": "PREMIUM. Composed world-state briefing: BTC + Fear & Greed + earthquakes + Hacker News + ISS + Polymarket. Optional ?include= filter and ?history=24h. Costs 1 credit ($0.02 USDC). Requires Authorization: Bearer tf_live_<64-char-hex>.",
      "parameters": {
        "type": "object",
        "properties": {
          "include": { "type": "string", "description": "Comma-separated section filter, e.g. \"crypto,news\". Optional." },
          "history": { "type": "string", "description": "Set to \"24h\" to include 24-hour historical context. Optional." }
        }
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "tf_pro_macro",
      "description": "PREMIUM. Composed macro snapshot: FRED (7 series) + forex (4 USD pairs) + commodities (gold, oil, nat gas) + indices (SPY, DIA, QQQ, VIX). Optional ?history=30d. Costs 2 credits ($0.04 USDC). Requires Authorization: Bearer tf_live_<64-char-hex>.",
      "parameters": {
        "type": "object",
        "properties": {
          "history": { "type": "string", "description": "Set to \"30d\" to include 30-day historical series. Optional." }
        }
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "tf_pro_crypto_deep",
      "description": "PREMIUM. Deep crypto snapshot: top 50 coins + Binance top 20 + mempool.space network + Etherscan gas. Optional ?coins= filter and ?history=30d. Costs 2 credits ($0.04 USDC). Requires Authorization: Bearer tf_live_<64-char-hex>.",
      "parameters": {
        "type": "object",
        "properties": {
          "coins": { "type": "string", "description": "Comma-separated symbols to filter, e.g. \"BTC,ETH,SOL\". Optional." },
          "history": { "type": "string", "description": "Set to \"30d\" to include 30-day historical series. Optional." }
        }
      }
    }
  }
]

The full 27-tool catalog (including tf_stocks, tf_hackernews, tf_github_trending, tf_steam, tf_disaster_alerts, tf_cyber_threats, tf_humans_in_space, tf_launches, tf_internet_pulse, tf_ai_stats, plus all premium and payment tools) lives at /api/llm-tools. Fetching at runtime is recommended.

Universal Handler

One function dispatches every tool call. The handler maps the model's tool_name to a TerminalFeed URL, attaches the bearer token only on premium tools, and returns the JSON body as a string the model can read.

import os, json, requests

BASE = "https://terminalfeed.io"

# Maps tool name -> (HTTP method, path, requires bearer)
TF_TOOL_MAP = {
    "tf_briefing":            ("GET",  "/api/briefing",         False),
    "tf_btc_price":           ("GET",  "/api/btc-price",        False),
    "tf_stocks":              ("GET",  "/api/stocks",           False),
    "tf_crypto_movers":       ("GET",  "/api/crypto-movers",    False),
    "tf_fear_greed":          ("GET",  "/api/fear-greed",       False),
    "tf_forex":               ("GET",  "/api/forex",            False),
    "tf_earthquakes":         ("GET",  "/api/earthquake",       False),
    "tf_disaster_alerts":     ("GET",  "/api/disaster-alerts",  False),
    "tf_hackernews":          ("GET",  "/api/hackernews",       False),
    "tf_predictions":         ("GET",  "/api/predictions",      False),
    "tf_service_status":      ("GET",  "/api/service-status",   False),
    "tf_weather":             ("GET",  "/api/weather",          False),
    "tf_launches":            ("GET",  "/api/launches",         False),
    "tf_humans_in_space":     ("GET",  "/api/humans-in-space",  False),
    "tf_github_trending":     ("GET",  "/api/github-trending",  False),
    "tf_cyber_threats":       ("GET",  "/api/cyber-threats",    False),
    "tf_economic_data":       ("GET",  "/api/economic-data",    False),
    "tf_steam":               ("GET",  "/api/steam",            False),
    "tf_internet_pulse":      ("GET",  "/api/internet-pulse",   False),
    "tf_ai_stats":            ("GET",  "/api/ai-stats",         False),
    "tf_pro_briefing":        ("GET",  "/api/pro/briefing",     True),
    "tf_pro_macro":           ("GET",  "/api/pro/macro",        True),
    "tf_pro_crypto_deep":     ("GET",  "/api/pro/crypto-deep",  True),
    "tf_pro_sentiment":       ("GET",  "/api/pro/sentiment",    True),
    "tf_payment_buy_credits": ("POST", "/api/payment/buy-credits", False),
    "tf_payment_confirm":     ("POST", "/api/payment/confirm",  False),
    "tf_payment_balance":     ("GET",  "/api/payment/balance",  True),
    "tf_payment_history":     ("GET",  "/api/payment/history",  True),
}

def call_tf_tool(name: str, args: dict | None = None, bearer: str | None = None) -> str:
    """Invoke any TerminalFeed tool by name. Returns a JSON string for the model."""
    args = args or {}
    if name not in TF_TOOL_MAP:
        return json.dumps({"error": f"unknown tool: {name}"})
    method, path, needs_bearer = TF_TOOL_MAP[name]
    headers = {}
    if needs_bearer:
        token = bearer or os.environ.get("TF_BEARER_TOKEN")
        if not token:
            return json.dumps({"error": "missing bearer token for premium tool"})
        headers["Authorization"] = f"Bearer {token}"
    url = BASE + path
    try:
        if method == "GET":
            r = requests.get(url, params=args, headers=headers, timeout=10)
        else:
            r = requests.post(url, json=args, headers=headers, timeout=10)
        return r.text
    except Exception as e:
        return json.dumps({"error": str(e)})
const BASE = "https://terminalfeed.io";

// Maps tool name -> { method, path, needsBearer }
const TF_TOOL_MAP = {
  tf_briefing:            { method: "GET",  path: "/api/briefing",        needsBearer: false },
  tf_btc_price:           { method: "GET",  path: "/api/btc-price",       needsBearer: false },
  tf_stocks:              { method: "GET",  path: "/api/stocks",          needsBearer: false },
  tf_crypto_movers:       { method: "GET",  path: "/api/crypto-movers",   needsBearer: false },
  tf_fear_greed:          { method: "GET",  path: "/api/fear-greed",      needsBearer: false },
  tf_forex:               { method: "GET",  path: "/api/forex",           needsBearer: false },
  tf_earthquakes:         { method: "GET",  path: "/api/earthquake",      needsBearer: false },
  tf_disaster_alerts:     { method: "GET",  path: "/api/disaster-alerts", needsBearer: false },
  tf_hackernews:          { method: "GET",  path: "/api/hackernews",      needsBearer: false },
  tf_predictions:         { method: "GET",  path: "/api/predictions",     needsBearer: false },
  tf_service_status:      { method: "GET",  path: "/api/service-status",  needsBearer: false },
  tf_weather:             { method: "GET",  path: "/api/weather",         needsBearer: false },
  tf_launches:            { method: "GET",  path: "/api/launches",        needsBearer: false },
  tf_humans_in_space:     { method: "GET",  path: "/api/humans-in-space", needsBearer: false },
  tf_github_trending:     { method: "GET",  path: "/api/github-trending", needsBearer: false },
  tf_cyber_threats:       { method: "GET",  path: "/api/cyber-threats",   needsBearer: false },
  tf_economic_data:       { method: "GET",  path: "/api/economic-data",   needsBearer: false },
  tf_steam:               { method: "GET",  path: "/api/steam",           needsBearer: false },
  tf_internet_pulse:      { method: "GET",  path: "/api/internet-pulse",  needsBearer: false },
  tf_ai_stats:            { method: "GET",  path: "/api/ai-stats",        needsBearer: false },
  tf_pro_briefing:        { method: "GET",  path: "/api/pro/briefing",    needsBearer: true  },
  tf_pro_macro:           { method: "GET",  path: "/api/pro/macro",       needsBearer: true  },
  tf_pro_crypto_deep:     { method: "GET",  path: "/api/pro/crypto-deep", needsBearer: true  },
  tf_pro_sentiment:       { method: "GET",  path: "/api/pro/sentiment",   needsBearer: true  },
  tf_payment_buy_credits: { method: "POST", path: "/api/payment/buy-credits", needsBearer: false },
  tf_payment_confirm:     { method: "POST", path: "/api/payment/confirm", needsBearer: false },
  tf_payment_balance:     { method: "GET",  path: "/api/payment/balance", needsBearer: true  },
  tf_payment_history:     { method: "GET",  path: "/api/payment/history", needsBearer: true  },
};

export async function callTfTool(name, args = {}, bearer = null) {
  const spec = TF_TOOL_MAP[name];
  if (!spec) return JSON.stringify({ error: `unknown tool: ${name}` });

  const headers = { "Content-Type": "application/json" };
  if (spec.needsBearer) {
    const token = bearer || process.env.TF_BEARER_TOKEN;
    if (!token) return JSON.stringify({ error: "missing bearer token for premium tool" });
    headers["Authorization"] = `Bearer ${token}`;
  }

  let url = BASE + spec.path;
  let init = { method: spec.method, headers };
  if (spec.method === "GET") {
    const qs = new URLSearchParams(args).toString();
    if (qs) url += `?${qs}`;
  } else {
    init.body = JSON.stringify(args);
  }

  try {
    const r = await fetch(url, init);
    return await r.text();
  } catch (e) {
    return JSON.stringify({ error: String(e) });
  }
}

End-to-End Example: OpenAI Chat Completions

A complete agent loop using the OpenAI Python SDK. The model picks a TerminalFeed tool, the handler runs it, the result is fed back, and the model writes the final answer.

import json, requests
from openai import OpenAI

client = OpenAI()  # reads OPENAI_API_KEY from env

# 1. Pull the live tool catalog from TerminalFeed
tools = requests.get("https://terminalfeed.io/api/llm-tools").json()["openai"]

# 2. Ask the model a question that needs live data
messages = [
    {"role": "system", "content": "You are a market analyst. Use TerminalFeed tools to get live data before answering."},
    {"role": "user",   "content": "What's the current Bitcoin price and crypto market sentiment?"},
]

resp = client.chat.completions.create(
    model="gpt-4o",
    messages=messages,
    tools=tools,
    tool_choice="auto",
)

# 3. Run any tool calls the model requested (using the handler from above)
msg = resp.choices[0].message
messages.append(msg)

if msg.tool_calls:
    for tc in msg.tool_calls:
        result = call_tf_tool(tc.function.name, json.loads(tc.function.arguments or "{}"))
        messages.append({
            "role": "tool",
            "tool_call_id": tc.id,
            "content": result,
        })

    # 4. Let the model write the final answer with the tool results in context
    final = client.chat.completions.create(model="gpt-4o", messages=messages, tools=tools)
    print(final.choices[0].message.content)
else:
    print(msg.content)

Anthropic Format

The same catalog is also rendered for the Anthropic Messages API. Pull catalog.anthropic from /api/llm-tools instead, then pass it as the tools argument to client.messages.create(). The universal handler above works without changes; route on content_block.name instead of tool_calls[i].function.name.

import json, requests
from anthropic import Anthropic

client = Anthropic()  # reads ANTHROPIC_API_KEY from env

tools = requests.get("https://terminalfeed.io/api/llm-tools").json()["anthropic"]

resp = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=1024,
    tools=tools,
    messages=[{"role": "user", "content": "What's the current Bitcoin price?"}],
)

# Walk the response for any tool_use blocks, run them, and feed back tool_result blocks.
for block in resp.content:
    if block.type == "tool_use":
        result = call_tf_tool(block.name, block.input)
        # Continue the conversation with a tool_result block...

Gemini and Other Function-Calling LLMs

The OpenAI tool format is a near-superset of Google Gemini's function_declarations shape. To convert: drop the outer { "type": "function", "function": {...} } wrapper and use the inner object directly. The name, description, and parameters fields are identical. Mistral, Cohere, and DeepSeek-R1 all accept the OpenAI format unchanged.

Tool Reference

Tool nameEndpointAuthCost
tf_briefing/api/briefingnonefree
tf_btc_price/api/btc-pricenonefree
tf_stocks/api/stocksnonefree
tf_crypto_movers/api/crypto-moversnonefree
tf_fear_greed/api/fear-greednonefree
tf_forex/api/forexnonefree
tf_earthquakes/api/earthquakenonefree
tf_disaster_alerts/api/disaster-alertsnonefree
tf_hackernews/api/hackernewsnonefree
tf_predictions/api/predictionsnonefree
tf_service_status/api/service-statusnonefree
tf_weather/api/weather?lat=&lon=nonefree
tf_launches/api/launchesnonefree
tf_humans_in_space/api/humans-in-spacenonefree
tf_github_trending/api/github-trendingnonefree
tf_cyber_threats/api/cyber-threatsnonefree
tf_economic_data/api/economic-datanonefree
tf_steam/api/steamnonefree
tf_internet_pulse/api/internet-pulsenonefree
tf_ai_stats/api/ai-statsnonefree
tf_pro_briefing/api/pro/briefingbearer1 credit ($0.02)
tf_pro_macro/api/pro/macrobearer2 credits ($0.04)
tf_pro_crypto_deep/api/pro/crypto-deepbearer2 credits ($0.04)
tf_pro_sentiment/api/pro/sentimentbearer2 credits ($0.04)
tf_payment_buy_credits/api/payment/buy-creditsnonefree
tf_payment_confirm/api/payment/confirmnonefree
tf_payment_balance/api/payment/balancebearerfree
tf_payment_history/api/payment/historybearerfree

Notes

Tool descriptions tell the LLM when to pick a tool. The TerminalFeed catalog tunes them for that purpose: each description names the data source, cache TTL, and a concrete reason an agent should reach for it. If you tighten or rewrite the descriptions, your model's tool-selection accuracy can drop. Re-test before shipping a custom version.

Premium tools share one bearer token across tf_pro_* calls. The token is funded with USDC on Base mainnet via tf_payment_buy_credits and tf_payment_confirm. The same token is redeemable on tensorfeed.ai. Keep the token in an env var, not in source.

Rate limits: 100,000 free-tier requests per day across all endpoints, 1 request per 30 seconds per endpoint recommended (responses are server-cached, so faster polling returns the same data). Premium tools are gated by your credit balance, not a rate limit.

See Also

/developers · main API docs
/developers/agent-payments · USDC payment flow for premium tools
/api/llm-tools · live tool catalog (OpenAI + Anthropic + raw)
/openapi.json · OpenAPI 3 spec for every endpoint
/llms.txt · AI-discovery file
/api/mcp · Model Context Protocol endpoint (Claude Desktop, Cursor, Windsurf)

Contact

Questions, integration help, or framework requests: [email protected]