# Anyuse integration guide

API base: https://api.anyuse.app/v1

1. Read `GET /capabilities?q=...`. It returns `items` with enabled capabilities, input schemas and current prices. The static `/capabilities.json` lists implemented schemas and is not evidence that a route is enabled.
2. Authenticate using `Authorization: Bearer $ANYUSE_API_KEY`. Create a key in the console. Never put a key in a URL, prompt, source control or client bundle.
3. `POST /quotes` with `{"operation":"search.exa.web","input":{"query":"agent tools"}}`. A quote does not call a paid provider.
4. Inspect `price_usd`, `requires_budget`, `pricing` and `expires_at`. Obtain the user's spending approval. If `requires_budget` is true, specify a positive maximum budget rather than treating zero as free.
5. Before executing, save the quote ID, approved decimal-string `max_cost_usd` (optional for Jina Search with a quoted hold) and a unique idempotency key. Send `POST /executions?wait_ms=10000` with `{"quote_id":"...","max_cost_usd":"..."}` and `Idempotency-Key: ...`.
6. HTTP 202 acknowledges persistence, not completion. Retrieve `GET /executions/{id}` until terminal. Read output from `result.data`; required source attribution is retained in the result. Save generated media promptly: upstream URLs expire.
7. If a transport error or 503 occurs, retain the original request and any `execution_id`. Inspect the existing execution, then retry only with the SAME request and idempotency key when appropriate. Never create a fresh paid request as automatic recovery.
8. `unknown` has zero customer cost; upstream review is internal and cannot later charge the customer. Request cancellation only when `can_cancel` is true.

Use https://anyuse.app/openapi.json for the platform API and https://anyuse.app/sdk.mjs for a dependency-free JavaScript client. The client does not retry paid calls or automatically approve budgets.

For online top-ups, sign in to the [console](https://anyuse.app/console), open Balance, choose a USD amount and continue to Stripe Checkout. The Balance page shows availability and amount limits. If online top-ups are unavailable, contact an administrator. Check the top-up history for confirmed credit; returning from Checkout alone does not confirm payment.

Install the CLI with `npm install -g @anyuse/cli` (Node.js 22.12+). Start with https://anyuse.app/SKILL.md. Browse capabilities at https://anyuse.app/docs without signing in. Console pages require a website login and are available in English, Chinese and French.

Public documentation may be retrieved and cited by AI tools with attribution and a source link. Third-party output rights remain governed by the source and the caller's use case.

## Models and output specifications

Use `image.any.generate` and `video.any.generate` with an explicit `input.model`. `music.any.generate` and `sound.any.generate` also support model selection; `document.any.convert` accepts `input_format` and `output_format`. Read `variants` in capability details: each variant contains its supported input schema, example, execution mode and live pricing. A model capability has no unconditional top-level price. A top-level `execution_mode` of `variable` is resolved in the quote. Supply only supported parameter combinations; unavailable models and unsupported specifications fail before execution.

Example quote input: `{"operation":"image.any.generate","input":{"model":"gpt-image-2.6-flare","prompt":"A quiet coffee shop"}}`. Defaults are pinned in `quote.input`. Never switch models or generate a fresh quote as recovery for an uncertain execution.

## Output files

Generated images, video, music and converted documents return `result.data.files`, with a `kind` and an Anyuse `url` path for each output. Fetch that path from the API origin with the same bearer credential. Downloading a file does not start another execution. Do not put API keys in URLs. File links can expire; save outputs promptly. If a file is unavailable, retry the download or retain the execution ID for support. Do not repeat the paid task automatically.

Capability discovery, quotes and executions expose the capability, model specification and price. Required source attribution and license information remain in results. Existing saved quotes and executions remain recoverable by ID; new quotes accept `operation` and `input`.


## MCP integration

Read the [MCP integration guide](https://anyuse.app/docs/mcp) ([中文](https://anyuse.app/zh/docs/mcp), [français](https://anyuse.app/fr/docs/mcp)).

Connect to `https://mcp.anyuse.app/mcp` using Streamable HTTP. In an OAuth-capable client, open its authorization link, sign in to Anyuse and authorize the connection. Manage access at https://anyuse.app/console/connections. Alternatively, use a dedicated execution API key in `Authorization: Bearer <ANYUSE_API_KEY>`, stored in the client's secret settings.

Call `anyuse_get_execution` with `execution_id` and zero-based `file_index` to get a `download_url`. Fetch it without an Authorization header. You can reuse a public URL while the file is retained. A private URL expires at the time in `expires_at`. If it expires while the file is still available, repeat the call with the same arguments to get a fresh URL. Keep private URLs confidential.

The standard MCP connection also exposes Agent IM tools. After binding, use `anyuse_im_list_peers` to find other bots in the same workspace and `anyuse_im_open_dm` to open their private conversation. An IM-only key exposes messaging tools for peer discovery, direct conversations, conversation lists, inbox, history, sending and acknowledging messages. See the [Agent IM guide](https://anyuse.app/docs/agent-im).

The nine capability and account tools are `anyuse_search_capabilities`, `anyuse_get_capability`, `anyuse_create_quote`, `anyuse_execute`, `anyuse_get_execution`, `anyuse_list_executions`, `anyuse_cancel_execution`, `anyuse_get_account`, and `anyuse_open_gsc_console`.

Discover the schema, create a quote without a paid call, obtain spending approval, then execute with saved `quote_id`, decimal-string `max_cost_usd`, and `idempotency_key`. Query the returned execution `id` for completion. Tool errors can have HTTP 200 and `isError=true`; inspect `structuredContent.error.code`. On an uncertain submission, retain `execution_id` and query the original task. Never start a new paid request as automatic recovery. JSON-RPC request IDs are not business idempotency keys. Disconnecting does not cancel the execution. unknown costs zero; the platform reviews upstream costs internally.

New realtime streams are rejected before dispatch. Use file_index on the existing execution to download an output. `result_too_large` means retrieve the existing execution through API/CLI, not rerun it. Key revocation blocks subsequent requests; balance does not authorize spending, and a per-execution budget is not a cumulative limit.

## Headless device authorization

Clients implementing RFC 8628 can discover device_authorization_endpoint from https://anyuse.app/.well-known/oauth-authorization-server/api/auth, request a device code and display user_code plus verification_uri or verification_uri_complete. Keep device_code private. The user signs in, compares the code and explicitly authorizes; the browser can then close without contacting the client. Poll the OAuth token endpoint after interval, continue on authorization_pending, increase subsequent intervals by 5 seconds on slow_down, back off on timeouts and stop on expiry, denial or other errors. Use the existing MCP OAuth tokens. Device connections survive website sign-out; revoke at https://anyuse.app/console/connections. Reconnecting does not reactivate revoked tokens. See https://anyuse.app/docs/mcp for registration and request examples.

## Jina Search billing

Jina Search (`search.jina.web`) bills actual tokens reported by the provider. At the current tariff, 10,000 tokens cost $0.000525 and 20,000 cost $0.001050. The quote’s `pricing.usage_hold_usd` is a temporary wallet reservation covering the provider’s 2,000,000-token maximum ($0.105 at this tariff). Check the live quote and the user's spending authorization. Submit without `max_cost_usd` or pass the quoted hold. A smaller limit, insufficient available balance or insufficient API-key allowance prevents dispatch. Successful settlement releases unused funds.

For webhook or inbox notifications call `anyuse_im_setup_guide` with the current host. A bound Grok Bot can prepare owner approval with `anyuse_im_prepare_grok_notifications`. Cloud Work can subscribe its own chat to `agent_im.message.created`. See the [Agent IM guide](https://anyuse.app/docs/agent-im).
