Skip to main content

LlamaIndex Tools Integration: AnyAPI

AnyAPI is one key and one USD wallet in front of hundreds of data and scraping APIs: Reddit, Instagram, TikTok, YouTube, LinkedIn, Google search and maps, Amazon, and clean JSON from pages that block bots. There is no subscription; you are billed per request in USD.

This package exposes AnyAPI to LlamaIndex as a single AnyAPIToolSpec.

Install

pip install llama-index-tools-anyapi

Set ANYAPI_API_KEY, or pass api_key= to the tool spec. Get a key at getanyapi.com.

Usage

from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.anyapi import AnyAPIToolSpec

agent = FunctionAgent(
    tools=AnyAPIToolSpec().to_tool_list(),
    llm=OpenAI(model="gpt-4.1"),
)

print(await agent.run("What is trending on Reddit right now?"))

The tools also work on their own:

spec = AnyAPIToolSpec()
spec.search_apis("trending posts on reddit", limit=3)
spec.get_api("reddit.trending_posts")  # read the strict input schema
spec.run_api("reddit.trending_posts", {"limit": 2})

Every tool has an awaitable twin (asearch_apis, aget_api, arun_api, and so on) backed by AsyncAnyAPI, so await tool.acall(...) talks to AnyAPI asynchronously rather than running the blocking client on a thread.

A runnable script is in examples/basic_usage.py.

The five tools

AnyAPI publishes hundreds of SKUs. One tool per SKU would exhaust any agent's context, so this spec ships the AnyAPI MCP server's discovery-then-run loop instead.

Tool Charges? What it does
search_apis no ranked search over the catalog, descriptions kept, schemas omitted
list_apis no browse summaries, optionally filtered by category
get_api no one API in full: strict input schema, output schema, per-lane USD pricing, 30-day latency
run_api YES execute one SKU with a normalized input payload
get_balance no remaining wallet balance in USD

Search and browse results carry no input schema. Call get_api for an API before your first run_api on it and build the input from the schema it returns: every input schema is strict, so an invented field name fails the call.

Prices

Every static price is published in both denominations and neither is derived from the other. maxUsd is what one request is billed; maxPer1kUsd is the same price per 1,000 requests. Quote the per-1k figure to a person, and never multiply a price yourself. A per-call charge comes back as costUsd on the run result.

There is no quote tool. get_api already publishes pricing.from.maxUsd, the most a first-choice run is billed, and pricing.failoverMaxUsd, the ceiling for any run of that API, so an agent can bound its spend before calling.

Departures from the AnyAPI MCP server

The tool descriptions are the MCP server's own wording, because it already encodes what agents get wrong. Three things differ here:

  • there is no quote tool, for the reason above;
  • search results carry no heavy marker;
  • the MCP server names its tools anyapi_search_apis, anyapi_get_api and so on, and the shared wording is written that way. Here the tool spec is the namespace, so the tools are search_apis, list_apis, get_api, run_api and get_balance, and the anyapi_ prefix is stripped from the descriptions when they are bound, so every tool a description names is one you can call.

License

MIT. See the LICENSE file at the root of the repository.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_tools_anyapi-0.2.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_tools_anyapi-0.2.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_tools_anyapi-0.2.0.tar.gz.

File metadata

  • Download URL: llama_index_tools_anyapi-0.2.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for llama_index_tools_anyapi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5e6af19b1d69179c8e0cb2b5b639a51b991babc67d4dac3123a5f2171f1b1f48
MD5 0f7ba89068ff736977111ce4a56c2ac2
BLAKE2b-256 459100138632bb8547244797939aa54492be4e850289abe47e1987441f9d4002

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_index_tools_anyapi-0.2.0.tar.gz:

Publisher: release-llama-index-tools-anyapi.yml on getanyapi-com/integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llama_index_tools_anyapi-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_tools_anyapi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ead85ff99afb0f2e4014be6272241a2ea355cc0e8bdf90ff69189392f6908452
MD5 624a31445379a4d5417975e58a40cbac
BLAKE2b-256 f403287bc8eccd4125fbef677efb12af557a57bedb9838d65711d3aeabe2ef2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_index_tools_anyapi-0.2.0-py3-none-any.whl:

Publisher: release-llama-index-tools-anyapi.yml on getanyapi-com/integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page