Skip to main content
Codex competes most directly with CoinGecko’s OnChain DEX API (the /onchain/* endpoints, powered by GeckoTerminal): pool, token, trade, and OHLCV data addressed by contract address. That’s where this guide focuses. CoinGecko’s classic market data API (coin-ID slugs like bitcoin, CEX tickers, derivatives, NFTs, treasury holdings, global aggregates) is a separate surface. Codex covers parts of it, doesn’t cover others, and we call out which is which lower down on the page.
If you only use CoinGecko for CEX tickers, derivatives, NFTs, treasury holdings, global market cap aggregates, or coin-ID lookups against non-DEX endpoints, Codex isn’t a drop-in replacement. See Gaps below for the specifics.If you use the /onchain/* endpoints (or simple/token_price and coins/{id}/contract/{address} with contract addresses), this guide is for you. Every CoinGecko field you rely on has a Codex equivalent, most Codex responses carry extra fields CoinGecko doesn’t expose (safety signals, launchpad state, multi-timeframe stats), and you pick up entire surfaces CoinGecko has no answer for: live trade streams, wallet PnL and discovery, launchpad lifecycle events, and prediction markets.

Mental model

CoinGecko’s OnChain DEX API is a REST surface where the network is a URL path segment (/onchain/networks/eth/..., /onchain/networks/solana/...) and every resource (token, pool, OHLCV, trades, holders) has its own endpoint with its own response shape. Codex is a single GraphQL Supergraph: one endpoint (https://graph.codex.io/graphql), one auth header, one query language, and the network is a numeric networkId parameter on each field. What that means in practice:
  • Network is a parameter, not a URL. You stop building /onchain/networks/${chain}/tokens/${address} strings. Pass { address, networkId: 1 } to a Codex field and any of 80+ networks routes through the same query.
  • Token and pair IDs are explicit strings. Codex addresses every token by "<address>:<networkId>" and every pair by the same shape. Once your network-slug → networkId map is in place (eth → 1, solana → 1399811149, base → 8453, …), everything composes cleanly.
  • You compose data in one request. GraphQL lets you fetch token metadata, current price, holders, recent trades, and OHLCV bars in a single round trip instead of three or four sequential REST calls.
  • Real-time is first-class. Most CoinGecko integrations poll on intervals. Codex gives you WebSocket subscriptions and webhooks for live prices, trades, holders, and balances.
If you also touch the coin-ID-based market data endpoints (/simple/price?ids=..., /coins/{id}), there’s a one-time slug-to-address translation step covered in Coin IDs vs contract addresses below. If you’ve never used GraphQL, Learn GraphQL is a 10-minute primer that’s enough to follow the rest of this guide.

Authentication

CoinGecko uses one of two API key headers depending on plan: x-cg-demo-api-key for the free demo tier or x-cg-pro-api-key for paid plans (which also flips the base URL to pro-api.coingecko.com). Codex uses a single Authorization header with a key from the dashboard.
CoinGecko
Codex
For browser-facing apps, generate a short-lived JWT with createApiTokens and pass it as Bearer <token>. See Authentication for the full pattern.

Endpoint mapping

OnChain DEX API: tokens

The most-used CoinGecko OnChain endpoints. Codex addresses tokens by address:networkId where CoinGecko addresses them by {network}/{address}, but the data behind each endpoint is the same shape.

OnChain DEX API: pools and pairs

CoinGecko market data (coin-ID based)

These endpoints sit on the CoinGecko market data side rather than the OnChain DEX side. Most DEX-focused integrations don’t hit them, but if yours does, here’s the mapping.

Utilities

Coin IDs vs contract addresses

This only matters if your integration touches CoinGecko’s coin-ID-based endpoints (/simple/price?ids=..., /coins/{id}, /coins/{id}/market_chart). CoinGecko addresses tokens by slug (bitcoin, ethereum, pepe); Codex takes a contract address plus a networkId. The OnChain DEX endpoints already use contract addresses, so they translate cleanly. The cleanest path is to keep a small static mapping for the head tokens you reference by ID (BTC, ETH, USDC, USDT, SOL, etc.), and use filterTokens(phrase: ...) at runtime for the long tail. If you currently call GET /coins/list to maintain a coin-ID map, replace it with that filter at the point of use.

Side-by-side examples

1. Token price by contract address

For a live price feed instead of polling, subscribe to onPricesUpdated. If you’re calling /simple/price?ids=... instead, see Coin IDs vs contract addresses for the slug-to-address translation step.

2. Pool detail

CoinGecko’s /onchain/networks/{network}/pools/{pool} returns a pool snapshot. Codex returns the same shape plus stats over multiple timeframes in a single query.

3. OHLCV chart

Codex’s resolution set is 1S, 5S, 15S, 30S, 1, 5, 15, 30, 60, 240, 720, 1D, 7D (1-second up to weekly), one step longer than CoinGecko’s longest bar (day). Sub-minute bars are only retained for the last 24 hours. Layer in onBarsUpdated for live chart updates, and see the Charts recipe for a full Lightweight Charts integration.
For trending tokens (rather than pools), use filterTokens with the same ranking attribute. See Discover Tokens.

Real-time data

CoinGecko offers WebSocket streams on higher tiers, but most CoinGecko integrations are built on polling. Moving to Codex usually means replacing polling loops with WebSocket subscriptions (for user-facing dashboards and trading UIs) or webhooks (for server-side alerts and queues).

Gaps

Things CoinGecko covers that Codex doesn’t, and what to do about them:
  • CEX tickers, exchange metadata, and order-book data (/coins/{id}/tickers for centralized exchanges, /exchanges, /exchanges/list, /exchanges/{id}, /exchanges/{id}/tickers, /exchanges/{id}/volume_chart, /exchanges/{id}/volume_chart/range). Codex is onchain-only. Keep CoinGecko for CEX coverage or pair with an exchange-data provider.
  • Derivatives and futures (/derivatives, /derivatives/exchanges, /derivatives/exchanges/{id}, /derivatives/exchanges/list). Codex doesn’t cover perps or futures venues.
  • NFTs (/nfts/*, NFT floor prices, collection data, trending NFTs from /search/trending). Codex is a fungible-token API. Pair with a dedicated NFT provider (Reservoir, OpenSea, Alchemy NFT).
  • Treasury holdings and entity data (the current entity-based surface: /entities/list, /{entity}/public_treasury/{coin_id}, /public_treasury/{entity_id}, /public_treasury/{entity_id}/{coin_id}/holding_chart, /public_treasury/{entity_id}/transaction_history, plus the legacy /companies/public_treasury/{coin_id} shape). No equivalent.
  • Global market data aggregates (/global, /global/decentralized_finance_defi, /global/market_cap_chart). Codex doesn’t produce “total crypto market cap” rollups.
  • Historical supply timeseries (/coins/{id}/circulating_supply_chart, /total_supply_chart, and their /range variants). Codex exposes current supply on token.info, not historical curves.
  • Crypto news (/news). Out of scope.
  • Fiat exchange rates beyond USD (/exchange_rates, /simple/supported_vs_currencies). Codex returns USD pricing only; pair with an FX provider for other quote currencies.
  • Hand-curated categories (/coins/categories, /coins/categories/list, /onchain/categories, /onchain/categories/{id}/pools, trending categories from /search/trending). Codex doesn’t classify tokens or pools into curated categories.

What you pick up

Things Codex offers that CoinGecko doesn’t:
  • Full trade history with real-time streaming. Per-trade fields are roughly comparable between the two APIs (maker address, token-in/token-out amounts, USD price at execution, transaction hash). The differentiator is depth and delivery: Codex retains every swap per token and per pair and pushes new ones live via onTokenEventsCreated or onEventsCreated, where CoinGecko’s onchain trade endpoints cap at the last 300 trades over 24 hours with no streaming surface.
  • Wallet analytics. balances, detailedWalletStats, walletChart, and filterWallets let you build portfolio screens, PnL summaries, and “smart money” discovery flows. None of this is in CoinGecko.
  • Launchpad lifecycle data. First-class support for pump.fun, LetsBonk, Believe, and other launchpads, including bonding-curve state, graduation, and migration events. See Launchpads.
  • Prediction markets. Polymarket and Kalshi event, market, trade, and trader data via the filterPredictionEvents family (Growth or Enterprise plan). See Prediction Markets.
  • Liquidity locks. liquidityLocks surfaces locked-LP context that CoinGecko doesn’t track.
  • Webhooks. Push real-time data to your servers without holding open a WebSocket. Configure via createWebhooks.
  • One query, many shapes. GraphQL lets you combine token metadata, price, holders, recent trades, pair stats, and chart data into a single request. Three-or-four-call sequences collapse to one.
  • Built for AI agents. A docs MCP server, prebuilt Codex Skills for Claude/Cursor/Codex CLI, and pay-per-query access via MPP.

AI migration prompt

Most CoinGecko integrations spread across many call sites: a price service, a chart loader, a token search, a trending feed, polling loops, maybe a few /onchain calls for pool data. Hand the prompt below to an IDE agent (Claude Code, Cursor, Codex CLI, or similar), run it from the repo root, and it will discover every CoinGecko touchpoint, propose a plan, and execute the migration with your approval.
Pair this prompt with our Codex Skills and docs MCP server so the agent can look up Codex queries on demand instead of guessing at field names.

Getting help

  • Browse the API Reference for the full schema.
  • Skim the Recipes for end-to-end examples that solve specific product problems.
  • Ask in our community if you hit a wall during migration.