Run Your First AI Agent#
Give your AI agent onchain capabilities — check prices, query market data — through natural language.
Preparation: Have an AI Agent#
This guide uses Claude Code, but OnchainOS supports all major agents. (Cursor, OpenClaw, etc.)
Step 1: Add OnchainOS to Your Agent#
Choose one of the following methods:
Option A: Skills (Recommended)#
Tell your agent:
Install OnchainOS skills by running: npx skills add okx/onchainos-skillsYour agent will install the skills and remind you to restart afterwards. Click the GitHub link for more information.
Option B: MCP Server#
Tell your agent:
Add an MCP server called onchainos-mcp with:
URL https://web3.okx.com/api/v1/onchainos-mcp
Header OK-ACCESS-KEY: "d573a84c-8e79-4a35-b0c6-427e9ad2478d"
Remind me to restart after I added the MCPOr manually add to your config file:
{
"mcpServers": {
"okxprice": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://web3.okx.com/api/v1/onchainos-mcp",
"--header",
"OK-ACCESS-KEY:d573a84c-8e79-4a35-b0c6-427e9ad2478d"
],
"env": {
"OK_ACCESS_KEY": "d573a84c-8e79-4a35-b0c6-427e9ad2478d"
}
}
}
}
Step 2: Try It Out!#
Ask your agent:
What is the current price of OKB?Your agent will return something like:
OKB is currently trading at $80.34.Step 3: Set Up Your Own API Keys#
The built-in sandbox keys are for testing only and may be subject to rate limits. For stable production usage, set up your own API credentials:
- Go to the OKX Developer Portal.
- Generate your API Key, Secret Key, and Passphrase.
Tell your agent:
Create a .env file with these variables: OKX_API_KEY, OKX_SECRET_KEY, and OKX_PASSPHRASE. Add .env to .gitignore.
And open it, tell me what to do next, and remind me to save after I filled out the passkeys.Your agent will create the file and open it — paste your keys there.
Never commit .env to git (add it to .gitignore) and never expose these
credentials in logs, screenshots, or chat messages
Your agent is now onchain — start exploring!
Having Trouble?#
If something went wrong, try following the full installation guide: