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. Four things differ here:

  • there is no quote tool, for the reason above;
  • search results carry no heavy marker;
  • search requires a query;
  • 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.1.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.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llama_index_tools_anyapi-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 56767779c4f3ef443f507a2ee0c59d7b3011a7b0d56b079061c31449324cf8bf
MD5 2c3f805aa25debb170553f42aecac787
BLAKE2b-256 2459693876b204e094a42ad32ffa0ec97745edf27f681ef0817089716e41b4f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_index_tools_anyapi-0.1.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_tools_anyapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67ccbc487f4f67fee345cc96de730e97dad2922c67d2ae814d11745a068553f3
MD5 0e89ee850953827341f3a22c7929b4de
BLAKE2b-256 e9fb155933f3a20176a4748419996cc38ea5a7722ce834192e3c337c7b30fa80

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_index_tools_anyapi-0.1.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

0.2.0

2 files

This release

0.1.0 This release

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