Docs
View as Markdown

AI agents

These docs are built to be read by machines as easily as by people. An agent should never have to guess: there is a map, a full copy, a Markdown version of every page and a machine-readable API description.

What to give your agent#

ResourceURLUse it for
Indexhttps://onekey.dev/llms.txtA short map of the docs with links. Start here.
Everythinghttps://onekey.dev/llms-full.txtThe whole docs, every endpoint, in one file. Paste or attach this if the agent cannot browse.
One page/docs/<page>.mdAny page as clean Markdown, e.g. /docs/quickstart.md.
One endpoint/docs/api/<platform>/<endpoint>.mdEverything about a single endpoint.
OpenAPI/openapi.jsonGenerate clients, or let tools import every endpoint.
Live catalogGET https://api.onekey.dev/v1/platformsCurrent endpoints, prices and parameters. No key, no cost.

On every docs page, Copy page for AI copies its Markdown and View as Markdown opens the raw text.

Point your tool at Onekey#

  • Claude (chat or Claude Code): paste the system prompt below, or just say "read https://onekey.dev/llms.txt and use it to call the Onekey API".
  • Cursor: add https://onekey.dev/llms-full.txt as a documentation source (Settings, then Indexing & Docs), and put the system prompt in a project rule.
  • ChatGPT and others: attach llms-full.txt, or paste the prompt and give the model your key through your tool's secret handling.
  • Anything with HTTP: import /openapi.json.
  • MCP clients (Claude Code, Claude Desktop, Cursor): connect the hosted MCP server with your key, and the agent gets eleven tools to find and call endpoints, including universal search and the reports. Step-by-step guides for n8n, LangChain, the Vercel AI SDK and Claude Code are on their own pages.

A ready-to-paste system prompt#

text
You can call the Onekey API for public data from many platforms.

Base URL: https://api.onekey.dev
Auth: send header "x-api-key" with the key from the environment variable ONEKEY_KEY. Never print or log the key.
Call shape: GET /v1/{platform}/{endpoint}?{params}
Discover endpoints (free, no key): GET /v1/platforms. Read parameter names from it; do not guess them.
Docs index: https://onekey.dev/llms.txt. Full docs: https://onekey.dev/llms-full.txt.

Rules:
1. Every response is {success, data, metadata, error}. Check "success" before using "data".
2. Branch on error.code, not error.message. Never retry 400, 401, 402, 404, 405 or 422.
3. Retry 429 after the Retry-After seconds, and retry 500/502 with exponential backoff (max 4 tries).
4. Each endpoint costs a flat number of credits (metadata.credits_charged). Cache hits are free. Do not repeat identical calls in a loop.
5. If metadata.stale is true the data is a little old; say so if freshness matters.
6. A 402 means the account is out of credits: stop and tell the user.

Why it is agent friendly#

  • One shape for every platform, so an agent's parsing code does not change between sources.
  • Errors have stable codes and clear retry guidance.
  • Costs are flat and printed on every endpoint page and in every response.
  • Free discovery: /v1/platforms and /v1/account cost nothing.
  • One query in words, or a report on a brand, a creator or a topic: an agent can call universal search or a report instead of assembling the calls itself. Both report what they did and what each part cost.
  • Agents that should react to change do not have to poll: a monitor calls your webhook when the data moves.