Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent-skills.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ it asks which email to tie the account to and mints a key — no dashboard trip.
</Step>
<Step title="Ask for data">
Ask your agent for third-party data — "get the top posts in r/golang", "scrape this
TikTok profile" — and it will discover the right API, check the per-request USD
TikTok profile" — and it will discover the right API, check its published USD
price, and run it.
</Step>
</Steps>
Expand Down
20 changes: 15 additions & 5 deletions cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,21 @@ customer-safe USD offer returned by discovery; they never expose an internal
accounting unit or upstream provider.

Static discovery pricing is nested. `pricing.from` is either a flat offer
(`model`, `unit: "request"`, `maxUsd`) or a linear offer (`model`, `unit`,
`baseUsd`, `perUnitUsd`, `maxUsd`). `pricing.failoverMaxUsd` is the greatest
fallback ceiling. The optional `failover` boolean reports whether AnyAPI currently
has an alternate route. Use the displayed unit when estimating a linear call, or
run `anyapi describe <sku>` to inspect the complete offer before execution.
(`model`, `unit: "request"`, `maxUsd`, `maxPer1kUsd`) or a linear offer (`model`,
`unit`, `baseUsd`, `perUnitUsd`, `maxUsd`, `maxPer1kUsd`). `pricing.failoverMaxUsd`
is the greatest fallback ceiling, published beside its per-1,000-request twin
`pricing.failoverMaxPer1kUsd`. The optional `failover` boolean reports whether AnyAPI
currently has an alternate route. Use the displayed unit when estimating a linear
call, or run `anyapi describe <sku>` to inspect the complete offer before execution.

Every maximum arrives in two denominations: `maxUsd` for one request and
`maxPer1kUsd` for 1,000 of them. **Per 1,000 requests is the denomination AnyAPI
quotes customers in**, because most of the catalog costs a fraction of a cent per call
and per-request figures cannot be compared by eye. Read the published per-1k field
instead of multiplying `maxUsd`, which drifts in floating point (`0.0966 * 1000` is
`96.60000000000001` in most languages). `baseUsd` and `perUnitUsd` have no per-1k
twin, because they are charged per billable item inside one call, and the `costUsd` of
a completed run and the balance from `anyapi balance` stay per request.

## Gateway and CLI responsibilities

Expand Down
32 changes: 32 additions & 0 deletions index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,38 @@ while `pricing.failoverMaxUsd` is the greatest fallback ceiling. Linear offers n
their billable `unit` and include `baseUsd`, `perUnitUsd`, and `maxUsd`, so you can
budget before making a call. Simple lookups are flat per request.

### Every static price in two denominations

Every static discovery offer publishes its maximum twice:

| Field | What it means |
|---|---|
| `pricing.from.maxUsd` | The most one request can be billed |
| `pricing.from.maxPer1kUsd` | That same maximum per 1,000 requests |
| `pricing.failoverMaxUsd` | The greatest fallback ceiling for one request |
| `pricing.failoverMaxPer1kUsd` | That same fallback ceiling per 1,000 requests |

Lane-level `pricing` objects carry `maxPer1kUsd` too.

**Per 1,000 requests is the denomination AnyAPI quotes customers in.** Most of the
catalog costs a fraction of a cent per call, and per-request figures at that scale
cannot be compared by eye. When you show a catalog price to a person, read
`maxPer1kUsd` and label it `/1k req` - for example `$96.60/1k req` rather than
`$0.0966 per request`.

Read the published per-1k field instead of multiplying `maxUsd` yourself. AnyAPI
derives it with exact fixed-point arithmetic, while a floating-point multiplication
drifts: in most languages `0.0966 * 1000` is `96.60000000000001`, and live catalog
prices land on that case.

`baseUsd` and `perUnitUsd` have **no** per-1k twin. They are charged per billable
item inside a single call, so a per-1,000-request version of them would describe
nothing you can be billed.

Amounts that state what one specific call costs stay per request and are never
scaled to 1,000: a price quote's `maxCostUsd` and `minCostUsd`, the `costUsd` on a
completed run, and your wallet balance. Report those exactly as returned.

## For AI agents

If you are an AI agent (or are setting one up), AnyAPI's whole catalog is available
Expand Down
41 changes: 30 additions & 11 deletions mcp-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,11 @@ and `structuredContent` with these shapes:
"from": {
"model": "flat",
"unit": "request",
"maxUsd": 0.003
"maxUsd": 0.0009,
"maxPer1kUsd": 0.9
},
"failoverMaxUsd": 0.003
"failoverMaxUsd": 0.0036,
"failoverMaxPer1kUsd": 3.6
},
"failover": true,
"relevance": 1
Expand All @@ -320,11 +322,25 @@ and `structuredContent` with these shapes:
so browsing and searching stay token-cheap. Reach for `list_apis` when you want to
enumerate rather than search.

This API's `pricing.from.model` is `flat`, so its maximum is per request. `failover`
is the gateway's authoritative routing fact; do not infer it from lanes. A linear
offer instead carries `unit`, `baseUsd`, `perUnitUsd`, and `maxUsd`. For example,
an API billed per result reports `unit: "result"`; the actual successful charge is
the base plus the per-unit amount, capped at `maxUsd`.
This API's `pricing.from.model` is `flat`, so `maxUsd` is what one request is billed.
`failover` is the gateway's authoritative routing fact; do not infer it from lanes. A
linear offer instead carries `unit`, `baseUsd`, `perUnitUsd`, `maxUsd`, and
`maxPer1kUsd`. For example, an API billed per result reports `unit: "result"`; the
actual successful charge is the base plus the per-unit amount, capped at `maxUsd`.

Every static offer publishes its maximum twice: `maxUsd` for one request and
`maxPer1kUsd` for 1,000 of them, with `failoverMaxPer1kUsd` as the twin of
`failoverMaxUsd`. Lane-level `pricing` objects carry `maxPer1kUsd` too.
**Per 1,000 requests is the denomination AnyAPI quotes customers in**, because most of
the catalog costs a fraction of a cent per call and per-request figures cannot be
compared by eye. Surface `$0.90/1k req` rather than `$0.0009 per request`, and read the
published field instead of multiplying `maxUsd`, which drifts in floating point
(`0.0966 * 1000` is `96.60000000000001` in most languages).

`baseUsd` and `perUnitUsd` have no per-1k twin, because they are charged per billable
item inside one call. Amounts that state what a specific call costs stay per request
and are never scaled to 1,000: a price quote's `maxCostUsd` and `minCostUsd`, the
`costUsd` `run_api` returns, and the `balanceUsd` from `get_balance`.

```json
// get_api {"sku_id": "reddit.search"} → structuredContent (schemas abridged)
Expand All @@ -339,9 +355,11 @@ the base plus the per-unit amount, capped at `maxUsd`.
"from": {
"model": "flat",
"unit": "request",
"maxUsd": 0.003
"maxUsd": 0.0009,
"maxPer1kUsd": 0.9
},
"failoverMaxUsd": 0.003
"failoverMaxUsd": 0.0036,
"failoverMaxPer1kUsd": 3.6
},
"failover": true,
"description": "Search Reddit posts across all subreddits by query.",
Expand All @@ -350,7 +368,8 @@ the base plus the per-unit amount, capped at `maxUsd`.
"pricing": {
"model": "flat",
"unit": "request",
"maxUsd": 0.003
"maxUsd": 0.0009,
"maxPer1kUsd": 0.9
}
}
],
Expand All @@ -374,7 +393,7 @@ the base plus the per-unit amount, capped at `maxUsd`.
{
"output": { "posts": [ { "title": "…", "url": "…", "score": 123 } ] },
"provider": "AnyAPI",
"costUsd": 0.003,
"costUsd": 0.0009,
"items": 25,
"replayed": false
}
Expand Down
9 changes: 9 additions & 0 deletions n8n.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ ceiling, and `failover` reports whether AnyAPI currently has an alternate route.
does not calculate these values from `lanes`, and input and output schemas pass through as
opaque JSON Schema objects.

Each static maximum is published in two denominations: `maxUsd` for one request and
`maxPer1kUsd` for 1,000 of them, with `failoverMaxPer1kUsd` beside `failoverMaxUsd`.
**Per 1,000 requests is the denomination AnyAPI quotes customers in**, because most of
the catalog costs a fraction of a cent per call and per-request figures cannot be
compared by eye. Read the published per-1k field rather than scaling `maxUsd` yourself,
which drifts in floating point (`0.0966 * 1000` is `96.60000000000001` in most
languages). `baseUsd` and `perUnitUsd` have no per-1k twin, because they are charged per
billable item inside one call, and the `costUsd` on a completed run stays per request.

## Response budget options (Run API)

**Run API** has three optional controls under **Options** that shrink the response payload so a
Expand Down
11 changes: 11 additions & 0 deletions quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,17 @@ Browse and search results report `provider: "AnyAPI"` and nested USD `pricing`.
fallback ceiling, and `failover` reports whether AnyAPI currently has an alternate
route.

Each of those maximums arrives in two denominations. `pricing.from.maxUsd` and
`pricing.failoverMaxUsd` are what one request can be billed;
`pricing.from.maxPer1kUsd` and `pricing.failoverMaxPer1kUsd` are the same ceilings per
1,000 requests. **Per 1,000 requests is the denomination AnyAPI quotes customers in**,
because most of the catalog costs a fraction of a cent per call and per-request figures
cannot be compared by eye. Show `$96.60/1k req` rather than `$0.0966 per request`, and
read the published per-1k field instead of multiplying `maxUsd`, which drifts in
floating point (`0.0966 * 1000` is `96.60000000000001` in most languages). `baseUsd`
and `perUnitUsd` have no per-1k twin, because they are charged per billable item inside
one call. The `costUsd` on a completed run and your wallet balance stay per request.

These values come from the gateway. The gateway owns input validation, provider
selection, route and lane order, failover, pricing, health semantics, and billing.
Do not infer failover from the number of lanes or recompute `pricing.from` from lane
Expand Down
10 changes: 10 additions & 0 deletions sdks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ Treat `pricing.from`, `pricing.failoverMaxUsd`, `failover`, lane order, and heal
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.

Discovery publishes each static maximum in two denominations: `maxUsd` is what one
request can be billed and `maxPer1kUsd` is that same maximum per 1,000 requests, with
`failoverMaxPer1kUsd` as the twin of `failoverMaxUsd`. **Per 1,000 requests is the
denomination AnyAPI quotes customers in**, because most of the catalog costs a fraction
of a cent per call and per-request figures cannot be compared by eye. Display the
published per-1k field rather than multiplying `maxUsd`, which drifts in floating point
(`0.0966 * 1000` is `96.60000000000001` in most languages). `baseUsd` and `perUnitUsd`
have no per-1k twin, because they are charged per billable item inside one call, and
`costUsd` and the wallet balance stay per request.

## Async (Python)

The TypeScript SDK is promise-based, so every method is already `await`-able. In Python,
Expand Down
Loading