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: Set Your API Keys#
- 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.
Note
Never commit
.env to git (add it to .gitignore) and never expose these credentials in logs, screenshots, or chat messagesStep 2: Add OnchainOS to Your Agent#
Choose one of the two integration 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.
Option B: MCP Server#
Tell your Claude Code:
Add an MCP server called dex-mcp with URL https://web3.okx.com/api/v1/onchainos-mcp and header OK-ACCESS-KEY: "here you should type your okx-api-key"
Or manually add to your config file:
{
"mcpServers": {
"dex-mcp": {
"url": "https://web3.okx.com/api/v1/onchainos-mcp",
"headers": {
"OK-ACCESS-KEY": "your-okx-api-key"
}
}
}
}
Note
Restart your client after updating
Step 3: 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.Your agent is now onchain. Build from here!
