# Table of Contents - [GMGN Agent API | GMGN Tutorial](#gmgn-agent-api-gmgn-tutorial) - [Unknown](#unknown) - [Unknown](#unknown) --- # GMGN Agent API | GMGN Tutorial For the complete documentation index, see [llms.txt](https://docs.gmgn.ai/index/llms.txt) . This page is also available as [Markdown](https://docs.gmgn.ai/index/gmgn-agent-api.md) . ### [](https://docs.gmgn.ai/index/gmgn-agent-api#i.-why-choose-gmgn-ai-agent) I. Why choose GMGN AI Agent? ⚡️ Real-time On-chain Data · Provides multi-chain real-time market quotes and liquidity pool status, enabling your AI Agent to capture market opportunities with zero latency 🔍 Comprehensive Exclusive Data · The out-of-the-box API eliminates the need for tedious low-level data parsing. It directly outputs advanced research metrics, instantly identifying Snipers, Insiders, Bundled wallets, and more 🛡️ Secure and Convenient Trading · Adopts the GMGN hosted wallet architecture where private keys are not stored locally, eliminating leakage risks at the source. IP whitelist automatically intercepts abnormal trading requests, and developers no longer need to manually construct complex on-chain transactions * * * ### [](https://docs.gmgn.ai/index/gmgn-agent-api#ii.-run-your-first-gmgn-ai-agent) II. Run Your First GMGN AI Agent Empower your AI Agent with on-chain capabilities — query quotes, fetch market data, and execute Swap transactions, all entirely through natural language. #### [](https://docs.gmgn.ai/index/gmgn-agent-api#quick-start-get-api-key-and-key-pair) Quick Start: Get API Key and Key Pair Before using, please complete the following preparations: * Generate a Key Pair: Use an asymmetric key generator to locally generate a key pair (**Public & Private Key**). Generation tutorial: [🔑 Generate Public Key](https://docs.gmgn.ai/index/generate-public-key) * Create an API Key: Go to 👉 [https://gmgn.ai/ai](https://gmgn.ai/ai) , upload your public key, and create your exclusive GMGN API Key. (_Note: Only IPv4 requests are supported; IPv6 is currently not supported._) The permissions required for using Skills are as follows: Skill Required Credentials Query (`gmgn-market` / `token` / `portfolio`) ✅ API Key Trading (`gmgn-swap`) ✅ API Key + Private Key * * * #### [](https://docs.gmgn.ai/index/gmgn-agent-api#id-1.-add-gmgn-skills-to-your-agent) 1\. Add GMGN Skills to Your Agent Copy and send the following prompt to OpenClaw, Claude Code, or other AI Agent tools: * * * #### [](https://docs.gmgn.ai/index/gmgn-agent-api#id-2.-configure-api-key-and-private-key) 2\. Configure API Key and Private Key Send the following prompt to your AI for global configuration. Once the Agent replies, fill in your **API Key and Private Key** as needed: > ⚠️ Note: Never commit your `.env` file to git (please add it to `.gitignore`), and absolutely never expose your private key in chats, logs, or screenshots. The private key used when executing a Swap must belong to the exact same key pair as the public key you uploaded when creating the API Key * * * #### [](https://docs.gmgn.ai/index/gmgn-agent-api#id-3.-try-it) 3\. Try It! Once configured, send the following prompt directly to test the query capabilities: * * * #### [](https://docs.gmgn.ai/index/gmgn-agent-api#usage) Usage: Once set up, you can execute tasks using just natural language: > * `"Buy 0.1 SOL of "` > > * `"Sell 50% of "` > > * `"Get the candlestick data for and analyze if it's worth buying"` > > * `"Check the contract security and pool status for "` > > * `"Check the recent trading activity of "` > > * `"Show the holders of "` > * * * ### [](https://docs.gmgn.ai/index/gmgn-agent-api#iii.-what-are-gmgn-mcp-and-skills) III. What are GMGN MCP & Skills? #### [](https://docs.gmgn.ai/index/gmgn-agent-api#introduction) Introduction GMGN MCP & Skills is an on-chain development suite built specifically for AI Agents. It enables Agents to natively read multi-chain market data, analyze tokens across multiple dimensions, manage wallet portfolios, and execute Swap transactions directly #### [](https://docs.gmgn.ai/index/gmgn-agent-api#flexible-integration-methods) Flexible Integration Methods * AI Skills — Built-in system-level commands like `/gmgn-token` and `/gmgn-market`. Agents can call them directly via natural language with zero API integration cost * CLI Toolkit — Provides the ready-to-use `npx gmgn-cli` terminal command, supporting formatted JSON or single-line JSON (`--raw`) output, perfectly suited for script processing #### [](https://docs.gmgn.ai/index/gmgn-agent-api#core-capabilities) Core Capabilities GMGN's underlying capabilities cover the most essential on-chain interaction scenarios: * 🪙 Token: Query basic info, real-time prices, contract security, liquidity pool status, and profiles of Top Holders and Traders * 📈 Market: Fetch precise candlestick data, supporting multiple resolutions from `1m` to `1d` * 🔥 Trending: Fetch the current trending tokens list * 💰 Portfolio: Query wallet holdings and token balances, and track historical transaction activity and PnL data * 🔄 Swap: Submit token exchange transactions via optimal routing, support custom slippage, and poll on-chain order status in real-time (requires private key configuration) * * * ### [](https://docs.gmgn.ai/index/gmgn-agent-api#iv.-supported-chains) **IV. Supported Chains** Integration for ETH and other new chains is currently in progress... Supported Chains Trading Base Tokens SOL SOL, USDC BSC BNB, USDC Base ETH, USDC > ⚠️ Security & Disclaimer: > > While using GMGN Skills, your AI Agent may make mistakes. Therefore, before authorizing the AI Agent to execute queries or on-chain asset trading commands (such as a `swap`), please ensure you manually verify key parameters like the token contract, amount, and slippage. Any unexpected risks caused by the AI model must be evaluated and borne solely by the user [PreviousGMGN.AI Tutorial](https://docs.gmgn.ai/index) [NextGenerate Public Key](https://docs.gmgn.ai/index/generate-public-key) Last updated 1 month ago * [I. Why choose GMGN AI Agent?](https://docs.gmgn.ai/index/gmgn-agent-api#i.-why-choose-gmgn-ai-agent) * [II. Run Your First GMGN AI Agent](https://docs.gmgn.ai/index/gmgn-agent-api#ii.-run-your-first-gmgn-ai-agent) * [III. What are GMGN MCP & Skills?](https://docs.gmgn.ai/index/gmgn-agent-api#iii.-what-are-gmgn-mcp-and-skills) * [IV. Supported Chains](https://docs.gmgn.ai/index/gmgn-agent-api#iv.-supported-chains) Copy Install GMGN skills by running: npx skills add GMGNAI/gmgn-skills Copy Create a .env file in the ~/.config/gmgn/ directory containing the GMGN_API_KEY variable. If trading features are needed, please also add the GMGN_PRIVATE_KEY variable. Open this file for me, remind me to paste the actual GMGN API Key and locally generated private key, and save it. Note: Please ensure this file is not committed to git. Copy Get the candlestick data for 6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN and analyze if it's worth buying. --- # Unknown \> For the complete documentation index, see \[llms.txt\](https://docs.gmgn.ai/index/llms.txt). Markdown versions of documentation pages are available by appending \`.md\` to page URLs; this page is available as \[Markdown\](https://docs.gmgn.ai/index/gmgn-agent-api.md). # GMGN Agent API ### I. Why choose GMGN AI Agent? ⚡️ Real-time On-chain Data\\ · Provides multi-chain real-time market quotes and liquidity pool status, enabling your AI Agent to capture market opportunities with zero latency 🔍 Comprehensive Exclusive Data \\ · The out-of-the-box API eliminates the need for tedious low-level data parsing. It directly outputs advanced research metrics, instantly identifying Snipers, Insiders, Bundled wallets, and more 🛡️ Secure and Convenient Trading \\ · Adopts the GMGN hosted wallet architecture where private keys are not stored locally, eliminating leakage risks at the source. IP whitelist automatically intercepts abnormal trading requests, and developers no longer need to manually construct complex on-chain transactions \*\*\* ### II. Run Your First GMGN AI Agent Empower your AI Agent with on-chain capabilities — query quotes, fetch market data, and execute Swap transactions, all entirely through natural language. #### Quick Start: Get API Key and Key Pair Before using, please complete the following preparations: \* Generate a Key Pair: Use an asymmetric key generator to locally generate a key pair (\*\*Public & Private Key\*\*). Generation tutorial: \[🔑 Generate Public Key\](https://docs.gmgn.ai/index/generate-public-key) \* Create an API Key: Go to 👉 , upload your public key, and create your exclusive GMGN API Key. (\*Note: Only IPv4 requests are supported; IPv6 is currently not supported.\*) The permissions required for using Skills are as follows: | Skill | Required Credentials | | --------------------------------------------- | ----------------------- | | Query (\`gmgn-market\` / \`token\` / \`portfolio\`) | ✅ API Key | | Trading (\`gmgn-swap\`) | ✅ API Key + Private Key | \*\*\* #### 1. Add GMGN Skills to Your Agent Copy and send the following prompt to OpenClaw, Claude Code, or other AI Agent tools: \`\`\` Install GMGN skills by running: npx skills add GMGNAI/gmgn-skills \`\`\` \*\*\* #### 2. Configure API Key and Private Key Send the following prompt to your AI for global configuration. Once the Agent replies, fill in your \*\*API Key and Private Key\*\* as needed: \`\`\` Create a .env file in the ~/.config/gmgn/ directory containing the GMGN\_API\_KEY variable. If trading features are needed, please also add the GMGN\_PRIVATE\_KEY variable. Open this file for me, remind me to paste the actual GMGN API Key and locally generated private key, and save it. Note: Please ensure this file is not committed to git. \`\`\` > ⚠️ Note: Never commit your \`.env\` file to git (please add it to \`.gitignore\`), and absolutely never expose your private key in chats, logs, or screenshots. The private key used when executing a Swap must belong to the exact same key pair as the public key you uploaded when creating the API Key \*\*\* #### 3. Try It! Once configured, send the following prompt directly to test the query capabilities: \`\`\` Get the candlestick data for 6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN and analyze if it's worth buying. \`\`\` \*\*\* #### Usage: Once set up, you can execute tasks using just natural language: > \* \`"Buy 0.1 SOL of "\` > \* \`"Sell 50% of "\` > \* \`"Get the candlestick data for and analyze if it's worth buying"\` > \* \`"Check the contract security and pool status for "\` > \* \`"Check the recent trading activity of "\` > \* \`"Show the holders of "\` \*\*\* ### III. What are GMGN MCP & Skills? #### Introduction GMGN MCP & Skills is an on-chain development suite built specifically for AI Agents. It enables Agents to natively read multi-chain market data, analyze tokens across multiple dimensions, manage wallet portfolios, and execute Swap transactions directly #### Flexible Integration Methods \* AI Skills — Built-in system-level commands like \`/gmgn-token\` and \`/gmgn-market\`. Agents can call them directly via natural language with zero API integration cost \* CLI Toolkit — Provides the ready-to-use \`npx gmgn-cli\` terminal command, supporting formatted JSON or single-line JSON (\`--raw\`) output, perfectly suited for script processing #### Core Capabilities GMGN's underlying capabilities cover the most essential on-chain interaction scenarios: \* 🪙 Token: Query basic info, real-time prices, contract security, liquidity pool status, and profiles of Top Holders and Traders \* 📈 Market: Fetch precise candlestick data, supporting multiple resolutions from \`1m\` to \`1d\` \* 🔥 Trending: Fetch the current trending tokens list \* 💰 Portfolio: Query wallet holdings and token balances, and track historical transaction activity and PnL data \* 🔄 Swap: Submit token exchange transactions via optimal routing, support custom slippage, and poll on-chain order status in real-time (requires private key configuration) \*\*\* ### \*\*IV. Supported Chains\*\* Integration for ETH and other new chains is currently in progress... | Supported Chains | Trading Base Tokens | | ---------------- | ------------------- | | SOL | SOL, USDC | | BSC | BNB, USDC | | Base | ETH, USDC | > ⚠️ Security & Disclaimer: > > While using GMGN Skills, your AI Agent may make mistakes. Therefore, before authorizing the AI Agent to execute queries or on-chain asset trading commands (such as a \`swap\`), please ensure you manually verify key parameters like the token contract, amount, and slippage. Any unexpected risks caused by the AI model must be evaluated and borne solely by the user --- # Unknown \# GMGN Tutorial ## GMGN Tutorial - \[GMGN.AI Tutorial\](https://docs.gmgn.ai/index/gmgn.ai-tutorial.md): Fast Trade, Fast Copy Trade, Fast AFK Automation. Discover faster, Trading in seconds🚀 On-chain at the speed of light. Click to trade. - \[GMGN Agent API\](https://docs.gmgn.ai/index/gmgn-agent-api.md) - \[Generate Public Key\](https://docs.gmgn.ai/index/generate-public-key.md): Generate a Public Key to Create Your API Key and Unlock GMGN's Featured Skills - \[GMGN Update Announcement\](https://docs.gmgn.ai/index/gmgn-update-announcement.md) - \[Featured Icon Definition\](https://docs.gmgn.ai/index/featured-icon-definition.md) - \[Quick Start\](https://docs.gmgn.ai/index/quick-start.md) - \[GMGN Telegram Bot List\](https://docs.gmgn.ai/index/gmgn-telegram-bot-list.md) - \[Q&A\](https://docs.gmgn.ai/index/q-a.md) - \[Safety Tip\](https://docs.gmgn.ai/index/safety-tip.md) - \[MEME\](https://docs.gmgn.ai/index/meme.md): MEME page is our first partition page, so let me introduce you to Pump.fun and Moonshot - \[NEW PAIR\](https://docs.gmgn.ai/index/new-pair.md) - \[TRENDING\](https://docs.gmgn.ai/index/trending.md): The hottest token of the moment - \[DISCOVER\](https://docs.gmgn.ai/index/discover.md) - \[HOLDING\](https://docs.gmgn.ai/index/holding.md): On the holding page. You can view all your positions and limit orders - \[FOLLOW: Monitor Square/ Follow/ Watchlist\](https://docs.gmgn.ai/index/follow-monitor-square-follow-watchlist.md) - \[ALERT: Sniper New, Following, Limit Orders\](https://docs.gmgn.ai/index/alert-sniper-new-following-limit-orders.md): New token FOMO Alert - \[Wallet detail page\](https://docs.gmgn.ai/index/wallet-detail-page.md) - \[Token page: Chart - multicharts, Activity, Trading system\](https://docs.gmgn.ai/index/token-page-chart-multicharts-activity-trading-system.md) - \[Transaction/Limit Order failure\](https://docs.gmgn.ai/index/transaction-limit-order-failure.md) - \[GMGN Fees & Settings\](https://docs.gmgn.ai/index/gmgn-fees-settings.md) - \[Wallet Alert on Telegram\](https://docs.gmgn.ai/index/wallet-alert-on-telegram.md): Use GMGN follows Smart Money and receive transaction notification of the wallets you follow through Telegram Alert Bot - \[Zero-Latency Wallet Tracking Bot\](https://docs.gmgn.ai/index/zero-latency-wallet-tracking-bot.md) - \[GMGN TG Alert Channel&Bot\](https://docs.gmgn.ai/index/gmgn-tg-alert-channel-bot.md) - \[GMGN TG Sniper Bot - SOL\](https://docs.gmgn.ai/index/gmgn-tg-sniper-bot-sol.md): we also called it GMGN TG Sniper Bot - \[GMGN TG Swap Bot - ETH\](https://docs.gmgn.ai/index/gmgn-tg-swap-bot-eth.md) - \[TG Wallet: Connect TG, Multi-Wallet system\](https://docs.gmgn.ai/index/tg-wallet-connect-tg-multi-wallet-system.md): SOL chain already supports multiple wallet system, use it now! - \[TG Wallet: Import & Export private key, Deposit, Withdraw\](https://docs.gmgn.ai/index/tg-wallet-import-export-private-key-deposit-withdraw.md) - \[Cooking\](https://docs.gmgn.ai/index/cooking.md): Track trending news and cooking your coin instantly, GMGN charges 0 token launch fees - \[Trenches Hotkeys\](https://docs.gmgn.ai/index/trenches-hotkeys.md): With custom Trenches hotkeys, you can swiftly browse token Twitter info, website videos, precisely lock onto targets in the Trenches, and execute the entire quick buy process - \[X Tracker\](https://docs.gmgn.ai/index/x-tracker.md): Monitor Trends in Real-time. Accurately track Tweet, Reply, Retweet, Quote, Update Bio from Master, Trader, KOL. Support Quick Buy. Try it now! - \[SnipeX\](https://docs.gmgn.ai/index/snipex.md): Monitor Twitter for new token contracts, auto-buy in millisecond, and hunt for the next 100X GEM - \[Wallet Radar\](https://docs.gmgn.ai/index/wallet-radar.md): Supports custom scanning of multiple tokens to quickly discover shared holding addresses and high-profit active addresses, with instant Track & Copy Trade - \[Copy Trade: Copy smart money, automatically earn SOL!\](https://docs.gmgn.ai/index/copy-trade-copy-smart-money-automatically-earn-sol.md) - \[Auto Trading: Migrated Snipe\](https://docs.gmgn.ai/index/auto-trading-migrated-snipe.md): Auto buy when token is migrated to DEX officially - \[Auto Trading: Migrated Sell\](https://docs.gmgn.ai/index/auto-trading-migrated-sell.md): Auto sell when token is migrated to DEX officially - \[Auto Trading: Dev Sell\](https://docs.gmgn.ai/index/auto-trading-dev-sell.md): Auto sell when the token creator sells part of his holdings in a single transaction - \[Auto Trading: Quick Buy & Take-Profit / Stop-Loss\](https://docs.gmgn.ai/index/auto-trading-quick-buy-take-profit-stop-loss.md): GMGN Auto Trading helps you quickly buy at market price, and presetting take-profit and stop-loss is ideal for rapidly fluctuating market conditions, like sniping new tokens. - \[Trailing Take Profit\](https://docs.gmgn.ai/index/trailing-take-profit.md): Are you struggling with selling too early? Trailing Take Profit (TTP) can help you solve this problem! It intelligently adjusts the profit price to maximize profits. When the price rises, it will hold - \[Trailing Stop Loss\](https://docs.gmgn.ai/index/trailing-stop-loss.md) - \[Auto Buy: Auto Buy & Limit buy\](https://docs.gmgn.ai/index/auto-buy-auto-buy-limit-buy.md): GMGN can help you buy and sell quickly, speed is fast! Private nodes achieve quick transaction in seconds, without opening the website window and waiting - \[Auto Sell: Auto sell & Take-profit/Stop-loss\](https://docs.gmgn.ai/index/auto-sell-auto-sell-take-profit-stop-loss.md): GMGN can help you sell quickly by creating Limit Sell Orders manually or automatically. - \[Invite @GMGNAI\\\_BOT\](https://docs.gmgn.ai/index/invite-gmgnai\_bot.md) - \[Invite @Alert\\\_GMGNBOT\](https://docs.gmgn.ai/index/invite-alert\_gmgnbot.md) - \[Insider Traders,Snipers,First 70 Buyers\](https://docs.gmgn.ai/index/insider-traders-snipers-first-70-buyers.md): Monitor the holdings of insider traders, snipers, and the first 70 buyers. - \[Track Smart Money\](https://docs.gmgn.ai/index/track-smart-money.md) - \[Wallets Import Export\](https://docs.gmgn.ai/index/wallets-import-export.md): Real-time monitoring of smart money, KOL wallets, custom nickname tagging, with support for batch import and export - \[How to become a Degen\](https://docs.gmgn.ai/index/how-to-become-a-degen.md) - \[CA Security Checks\](https://docs.gmgn.ai/index/ca-security-checks.md): CA Security Checks : LP burned, Honeypot, Renounced, Mintable - \[Referral Link\](https://docs.gmgn.ai/index/referral-link.md): Partner with GMGN for trading commision rebates and generate your exclusive referral link. The more trade volume you invite, the higher the rebate percentage. - \[🤝🏻 Cooperation-Referral:💰Refer friends to earn rebate-30% rebates, easily earn over $8000 monthly\](https://docs.gmgn.ai/index/cooperation-referral-refer-friends-to-earn-rebate-30-rebates-easily-earn-over-usd8000-monthly.md) - \[🤝🏻 Cooperation-Referral:📸Share transaction profits\](https://docs.gmgn.ai/index/cooperation-referral-share-transaction-profits.md) - \[🤝🏻 Cooperation-Referral:🌈Invite Bots to Telegram group to earn trading commissions automatically\](https://docs.gmgn.ai/index/cooperation-referral-invite-bots-to-telegram-group-to-earn-trading-commissions-automatically.md) - \[🤝🏻 Cooperation-API:📈Integrate GMGN price chart\](https://docs.gmgn.ai/index/cooperation-api-integrate-gmgn-price-chart.md) - \[🤝🏻 Cooperation-API:🕹Integrate GMGN Solana Trading API\](https://docs.gmgn.ai/index/cooperation-api-integrate-gmgn-solana-trading-api.md): Welcome to integrate GMGN's Solana trading API for fast quantitative trading. - \[🤝🏻 Cooperation-API:🕹Integrate GMGN ETH/Base/BSC Trading API\](https://docs.gmgn.ai/index/cooperation-api-integrate-gmgn-eth-base-bsc-trading-api.md): Welcome to integrate GMGN's ETH/Base trading API for fast quantitative trading. - \[Get the available routing for ETH/Base/BSC transactions\](https://docs.gmgn.ai/index/cooperation-api-integrate-gmgn-eth-base-bsc-trading-api/get-the-available-routing-for-eth-base-bsc-transactions.md) - \[Get the recommended slippage value of ETH/Base/BSC token\](https://docs.gmgn.ai/index/cooperation-api-integrate-gmgn-eth-base-bsc-trading-api/get-the-recommended-slippage-value-of-eth-base-bsc-token.md) - \[Get the recommended gas price for ETH/Base/BSC chain\](https://docs.gmgn.ai/index/cooperation-api-integrate-gmgn-eth-base-bsc-trading-api/get-the-recommended-gas-price-for-eth-base-bsc-chain.md) - \[Swap transaction simulation (ETH/Base/BSC)\](https://docs.gmgn.ai/index/cooperation-api-integrate-gmgn-eth-base-bsc-trading-api/swap-transaction-simulation-eth-base-bsc.md) - \[🤝🏻 Cooperation-API: 🔄Data crawling IP whitelist\](https://docs.gmgn.ai/index/cooperation-api-data-crawling-ip-whitelist.md) - \[🤝🏻 Cooperation-Script:💵How to Quickly Create an Automated Script for Trading with GMGN Bot\](https://docs.gmgn.ai/index/cooperation-script-how-to-quickly-create-an-automated-script-for-trading-with-gmgn-bot.md) - \[Meme Coin Trading\](https://docs.gmgn.ai/index/meme-coin-trading.md) - \[Delete APP account\](https://docs.gmgn.ai/index/delete-app-account.md) - \[Contact us\](https://docs.gmgn.ai/index/contact-us.md) - \[GMGN LOGO\](https://docs.gmgn.ai/index/gmgn-logo.md): Including PNG/SVG images - \[GMGN Vulnerability Bounty Program\](https://docs.gmgn.ai/index/gmgn-vulnerability-bounty-program.md) - \[GMGN MEME TRADING GUIDE\](https://docs.gmgn.ai/index/gmgn-meme-trading-guide.md) ---