Set up okdata with one sentence to your AI agent

Paste one sentence into Claude Code, Cursor, Codex or another agent that can read the web, and it sets okdata up by itself, safely and with one tiny test call.

If you use an AI agent that can read web pages and edit files on your computer, you don't need any of the other setup pages. Set your key, paste one sentence, and the agent reads our setup instructions, connects itself and proves it works with a test that costs $0.001. Five minutes later you can ask it for Xiaohongshu notes or a Douyin hot list like you'd ask a colleague.

The sentence

Read https://okdata.online/agents.md and set up okdata for me; my key is in the OKDATA_API_KEY environment variable.

That's all. Paste it into Claude Code, Cursor's agent, Codex or a similar agent that can open URLs, run commands and edit files.

Before you paste it

Put the key where the agent can use it without seeing it. On a Mac, add this line to ~/.zshrc (on Linux, ~/.bashrc), then open a new terminal and start your agent from there:

export OKDATA_API_KEY="okd_..."

Keys start with okd_ and new ones come with $0.10 of credit. The quickstart explains how to get one. No key yet? Change the end of the sentence to "I don't have a key yet, so only use the free tools." The agent can still connect, browse all 51 endpoints and tell you prices.

What the agent will do

agents.md is a short, plain-text checklist written for agents. You can read it yourself in a minute. It tells the agent to:

  1. Keep the key out of sight. It reads OKDATA_API_KEY and must not write the key into project files or commits, print it, or repeat it back to you.
  2. Connect. If it can add a remote MCP server, it adds https://api.okdata.online/mcp with a config that points at the variable (for example Bearer ${OKDATA_API_KEY} in Claude Code). Otherwise it uses the plain HTTP API at https://api.okdata.online.
  3. Check that it works. First a free status check, then the cheapest paid call, $0.001, confirming that the bill in the response matches.
  4. Spend carefully from then on. Say the maximum cost before a task, stop paging once there's enough, reuse the same idempotency key on retries so nothing is charged twice, and wait retry_after_seconds when rate-limited.

If a step fails, it is told to stop and say which one and why.

Safety notes

  • Never paste the key into the chat if your agent can read environment variables. Chats get logged, synced and shared; a variable on your own machine doesn't.
  • Look at what it wrote. The config should mention OKDATA_API_KEY, not a string starting with okd_. If you see the key itself in a project file, ask the agent to replace it and make sure it never reaches git.
  • Some apps can't read your terminal's variables, such as Claude Desktop opened from the Dock. There the key has to go into the app's own settings or a config file in your home folder; the Claude Desktop page shows how. Even then, type it into that file yourself rather than into a chat.
  • Data is not instructions. Posts and comments come from strangers on the internet. agents.md tells the agent to treat them as data, and it's worth repeating in your own prompts.
  • Add a budget if you like. Append "and always tell me the price before a paid call" to the sentence.

A first prompt to try

Once it says setup is done:

Using okdata, search Xiaohongshu for "sunscreen" (newest first, one page)
and give me the five most-liked notes with links. Tell me what it cost.

What it costs

Setup itself costs $0.001, the one test call. Looking up endpoints and prices is free. The prompt above is one page of Xiaohongshu note search at $0.02. A Douyin hot list is $0.002. Failed calls are free.

When something goes wrong

  • The agent says it can't open the URL. It has no web access. Use the setup page for your tool instead, starting from the MCP page.
  • unauthorized (401). The agent didn't get the key. Usually it was started before you set OKDATA_API_KEY: open a new terminal, check with [ -n "$OKDATA_API_KEY" ] && echo set, and start the agent again.
  • insufficient_balance (402). Not enough balance even for the test call. Nothing was charged. Top up; prices are on the pricing page.
  • rate_limited (429). Too many calls in a short time. The agent should wait retry_after_seconds and repeat the call, at no charge; remind it if it doesn't.
  • It finished but there are no okdata tools. Most clients only load new MCP servers on start. Restart the agent, or for Claude Code run claude mcp list and for Codex codex mcp list.

Updated 2026-11-12