4 minutos
How the Token API Powers Custom GPTs
Overview
The Token API is a pre-indexed blockchain data service that provides real-time access to token balances, metadata, prices, liquidity, and volume across multiple chains. Developers use its REST endpoints to build wallets, trading dashboards, DeFi analytics, and AI systems without maintaining their own indexing stack. Custom GPTs can connect directly to the Token API’s OpenAPI schema.
The Token API enables developers to build Custom GPTs to reason over live blockchain data inside ChatGPT that can reason over and respond with live blockchain data directly inside ChatGPT.
What the Token API Enables in Custom GPTs
When a Custom GPT is wired to the Token API, it gains access to a machine-readable schema and authenticated endpoints. Developers can use this to:
- Query real-time onchain data: Balances, token prices, liquidity, and transaction history.
- Automate domain-specific tasks: Portfolio tracking, accounting, reconciliation, and market analysis.
- Power AI agents with verifiable blockchain context: Use the same data sources dapps rely on.
Because the Token API provides a machine-readable schema and authenticated requests, it serves as a structured data layer that enables GPT-5 agents to combine natural language reasoning with live onchain data from The Graph.
When to Use the Token API for Custom GPTs
Use the Token API when your GPT needs repeatable, domain-specific behavior grounded in blockchain data. This is most effective when the GPT performs the same type of task frequently or enforces a workflow you define. For one-off or exploratory questions, standard ChatGPT prompts are sufficient.
Choosing a Use Case
Start with a clear, narrow objective, then expand as needed. Common patterns include:
- Accounting GPT: Onchain accounting, tax tagging, and portfolio reconciliation.
- Trading GPT: Liquidity, pricing, and volume analysis for trading strategies.
- Protocol Tracking GPT: Real-time monitoring of transaction activity and liquidity pools.
A focused initial goal such as “Retrieve token balances and prices for a wallet” makes it easier to configure reliable behavior before adding complex workflows.
Requirements
| Requirement | Description |
|---|---|
| ChatGPT 5 | Custom GPT creation requires GPT-5 tier or Pro. |
| Token API Subscription | Sign up at The Graph Market |
| Token API Key | Available in your dashboard as the Authentication JWT. |
Setting Up a Custom GPT
Below is an explanatory outline of what happens during setup. This section provides conceptual understanding.
Create Custom GPT
- Visit chat.openai.com/gpts in your browser. 2, Click Create (top right).
- Under Configure (in the top left panel), set up your GPT’s personality and scope.
Configure Your GPT
You define the GPT’s role, scope, and metadata so it knows what it is designed to do. This includes:
- Name and Description: Helps users discover your GPT.
- For example: Name: Token Tracker GPT Description: An onchain analytics assistant that retrieves live token balances, prices, and liquidity data using The Graph’s Token API.
- Instructions: Tells the GPT what tasks it should perform using the Token API.
- For example: You are a blockchain data assistant retrieving onchain token data from The Graph’s Token API. Use endpoints to fetch balances, liquidity, and price history across EVM chains. Present results in tables with token symbols, prices, and USD values.
- Knowledge: Optional context files such as wallet references, accounting rules, or code snippets.
- New Action: At the bottom, click “Create new action” to connect your GPT to the Token API.
Connect the Token API
To enable live blockchain queries inside ChatGPT, you connect the GPT to the Token API through:
Authentication
- Set Authentication to API Key → Bearer.
- Open The Graph Market and copy your Authentication JWT from your dashboard.
- Paste the token into the ChatGPT prompt where the field shows [HIDDEN].
Schema
- Above the Schema box, click Import from URL.
- Paste: https://token-api.thegraph.com/openapi
- Click Import. You’ll now see endpoints like:
getV1EvmTokensgetV1EvmDexesgetV1EvmBalances
- Click Test on one (for example
getV1EvmDexes) to verify connection.
Privacy
- At the bottom, under Privacy, paste: https://pinax.network/en/legal/privacy
Privacy
You can attach a privacy policy URL such as: https://pinax.network/en/legal/privacy
Example Prompt Patterns
These examples help illustrate how a GPT reasons over Token API data.
Wallet and Portfolio
Get the total USD balance for a wallet across multiple chains, returning token name, symbol, balance, and price.
Trading Analysis
Compare USDC and DAI liquidity across Uniswap and Curve. Return the top 5 pools by TVL.
Accounting
List all ERC-20 transfers for this address in the last 30 days. Group by token and total incoming/outgoing volume.
Best Practices
| Tip | Why It Matters |
|---|---|
| Scope your GPT narrowly first | Simplifies debugging and validates schema integration. |
| Use clear role instructions | Helps the GPT choose the right endpoints and avoid assumptions. |
| Name endpoints explicitly | Improves routing accuracy when fetching balances, prices, or DEX data. |
| Combine with code | Enables custom parsing or logic for complex workflows. |
| Add Subgraph or Substream context | Provides richer analytics when combined with Token API data. |
FAQs & Resources
- Builders Office Hours (October 23, 2025)
- Watch the full session: https://x.com/i/broadcasts/1mrGmBzBarNJy