Every API is a typed method under its platform namespace (
client.google.search(...),
client.amazon.reviews(...)), and there is a generic escape hatch to call any API by slug.
AnyAPI generates those execution methods from the gateway’s OpenAPI document. The
catalog, search, and describe methods are separate tolerant readers of the live
discovery API; SDK generation does not update them.
Install
Authenticate
Construct a client with your AnyAPI key. When you omit it, both SDKs readANYAPI_API_KEY from the environment, so you never have to hardcode a secret.
Need a key? Grab one from the dashboard or mint one
from the terminal - see the Quickstart.
Your first call
Call any API as a typed method under its platform namespace.res.output is the
normalized result, and the cost of the call in real US dollars is on res.costUsd
(TypeScript) / res.cost_usd (Python).
In Python, input keyword arguments mirror the wire API verbatim (camelCase where the
API uses it). Output models are Pythonic: attributes are snake_case with a wire alias
(
item.reviews_count reads the wire reviewsCount), and model_dump(by_alias=True)
reproduces the wire shape.Call any API by slug
Every typed method has a generic counterpart. Pass the API’s slug and input torun to call any API in the catalog with full typing.
Discover APIs
Browse by category, run a ranked search, then describe one result to retrieve its schemas:pricing.from, pricing.failoverMaxUsd, failover, lane order, and health as
gateway-published facts. failover reports whether AnyAPI currently has an alternate
route. Do not derive it from the lane count or recompute pricing from individual lanes.
Async (Python)
The TypeScript SDK is promise-based, so every method is alreadyawait-able. In Python,
use AsyncAnyAPI for an async client backed by the same typed surface.
Not found vs error
A successful call always resolves. For most APIs the payload is wrapped in afound
flag: output.found is false when the upstream had no matching entity, which is a
successful answer, not an error. Use unwrap to get the data or raise
ResultNotFoundError when the result is empty.
ResultNotFoundError subclasses NotFoundError, so catching NotFoundError catches
both an HTTP 404 and an empty result; catch ResultNotFoundError to handle only empty
results. A few APIs (such as reddit.search) return their data object directly as
output with no found wrapper, and unwrap returns it as-is without throwing.
Pagination
Paginated APIs expose an iterator that yields items across pages and follows the cursor for you. Call.pages() on it to walk whole result pages instead, and read each page’s
costUsd / cost_usd.
Trim the response
Shape the response to save context and bandwidth.fields, maxItems /
max_items, and summary trim what comes back, but they do NOT change the price.
timeoutMs and maxRetries (plus an
AbortSignal via signal) in TypeScript, and timeout / max_retries inside options
in Python.
Errors and retries
Every failure raises anAnyAPIError subclass mapped from the HTTP status. Only 429 and
network failures retry, with jittered exponential backoff that honors Retry-After;
timeouts are never retried. The default maxRetries / max_retries is 2 (up to 3
attempts), and you can set it on the client or per request.
Direct REST error bodies retain the existing error message and also include a stable
machine-readable code when one is available. Use code to distinguish cases such as
invalid_input, provider_rate_limited, and unclassified_upstream_response without
parsing the message text. Existing clients that only read error remain compatible.
Configure the client with
new AnyAPI({ timeoutMs, maxRetries }) in TypeScript or
AnyAPI(max_retries=...) in Python. Every error carries a status and request id
(requestId / request_id).
Agent signup
Bootstrap a capped starter key with no account, for autonomous agents. A human funds it later by claiming it at the returned URL. See Let your agent onboard itself for the full flow.Learn more
- TypeScript package:
@getanyapi/sdkon npm - Python package:
getanyapion PyPI - Source and issues:
getanyapi-com/sdks - Browse every API in the API Reference.