Finance5 min readBy Purrkey team

How to get DefiLlama token prices for 50 IDs in one call

Get current USD prices for up to 50 token IDs in one DefiLlama call and see which IDs are missing

On this page

You have 40 token positions to value before a daily rebalance and one call to fetch current USD prices for the batch. Collect the CoinGecko IDs and chain address IDs from your portfolio, send them as one array to defillama.coins.prices, then split the response into rows that carry a price and identifiers that come back in missing

The worksheet below is the deliverable: one row per identifier, with the price and the fields that tell you how much weight the number can carry. No run has been executed for this article, so the values in the tables are placeholders showing the shape

Example input and worksheet design

An invented example with two identifiers. Replace them with the IDs from your own portfolio:

Agent prompt
coingecko:ethereum
coingecko:bitcoin

The agent fills a table with one row per identifier. Values here are placeholders showing the shape

coin_idpricesymboltimestampconfidencedecimalsstatus
coingecko:ethereum(number)(text or null)(integer or null)(number or null)(integer or null)priced or missing

Status is the only column you write yourself. Priced means the identifier appears under coins, missing means it appears in the missing array

Build the array of identifiers

coins is required. It is an array of 1 to 50 unique strings, each up to 128 characters and each matching ^[a-z0-9-]+:[A-Za-z0-9._-]+$, which covers the two forms the tool documents: a CoinGecko ID form and a chain address form

You gather those strings from a portfolio, a watchlist or a chain explorer before the call. The colon is part of the pattern, so a bare ticker or a bare contract address will not pass validation. Chain and id segments are written in lowercase, while the address segment allows uppercase letters, digits, dots, underscores and hyphens

Read the fields that drive the decision

coins in the response is an object keyed by the identifier you sent. Each value has price as a number, then symbol, timestamp, confidence and decimals, each of which can be null. missing is an array of the identifiers no price came back for

The price drives the valuation. A row with a number in price can enter the rebalance calculation. A row listed in missing cannot, and that position needs another source before the batch is closed

The other four fields are context. A null symbol or null decimals says nothing about whether the price is usable, because the price came back. Record confidence next to the number rather than filtering on it: the contract types it as a number or null and does not state the scale it uses. The same applies to timestamp, which is an integer or null

Keep the batch inside 50 unique identifiers

The cap sits on the call itself: 1 to 50 items, unique, so 40 positions fit in one call with 10 slots spare. Duplicates break the uniqueness rule and malformed strings break the pattern, and either one rejects the payload. Failed executions are not charged, which means a rejected batch costs nothing and also returns nothing, so validate the list before you send it

Two consequences for a daily rebalance. A 60-position book needs two calls, and the split is yours to choose: 50 and 10, or two even halves. Repeating the refresh through the day multiplies calls rather than growing the array, since the cap applies per call and does not carry over

The agent prompt

Agent prompt
Set up https://purrkey.app/SKILL.md, then use Purrkey to fetch current USD
prices for the 40 token positions listed below in one call to
defillama.coins.prices. Check the current inputs and price of
defillama.coins.prices before running anything. Send the identifiers as
the coins array: 1 to 50 unique strings, each written as coingecko:{id}
or {chain}:{address}. If the list is longer than 50, split it into
batches of 50 or fewer and run each batch as its own call. Return a table
with coin_id, price, symbol, timestamp, confidence, decimals and status,
where status is "priced" when the identifier appears under coins and
"missing" when it appears in the missing array. Leave price empty for
missing identifiers and do not estimate them.

coingecko:ethereum
coingecko:bitcoin

Add your own identifiers under the two example lines, or replace the list entirely. Keep the first run to a small batch so you can see how the response maps to your worksheet before the daily schedule depends on it

Estimated tool cost

Price read through the Purrkey catalog on November 17, 2026: $0.0005 per call, unitPriceMicros 500. The published rule text reads "Fixed per-call price under the published tool contract; failed executions are not charged." The endpoint is POST /v1/runs, and the totals below assume each call is charged at the listed price

StepFormulaUnit pricePlanned quantityTotal
Price 40 positions oncecalls x price$0.0005 per call1$0.0005
Refresh 40 positions hourly for a daycalls x price$0.0005 per call24$0.012

Model fees for the agent are not counted. The batch size does not change the per-call price, so a 10-identifier refresh and a 50-identifier refresh settle at the same $0.0005

Next action

Open the DefiLlama prices tool page, confirm the current price, and send one batch with the identifiers from your own position list

Get started by giving this to your agent

  • Claude Code
  • Codex
  • Gemini CLI
  • Cursor
  • GitHub Copilot
Set up https://purrkey.app/SKILL.md, then use Purrkey to show me what I can do with DefiLlama.
Explore DefiLlama tools and pricing

FAQ

How many token IDs can I price in one DefiLlama call?

The coins array takes 1 to 50 unique identifiers, so 40 positions fit in a single call with room for 10 more. A longer list has to be split into separate batches, and each batch is a separate call and a separate charge.

What format do the coin identifiers take?

Each string is written as coingecko:<id> or <chain>:<address> and must match the pattern ^[a-z0-9-]+:[A-Za-z0-9._-]+$, with a maximum length of 128 characters. Duplicates and malformed strings are rejected.

What does the missing array in the response mean?

It lists the identifiers no price came back for. Those positions cannot be valued from this call and need another source, while identifiers that appear under coins carry a price.

How much does it cost to price 40 tokens?

One call at $0.0005 prices the batch. Refreshing the same 40 identifiers hourly for a day is 24 calls, $0.012 at the same per-call price.

What happens if I send duplicate or malformed identifiers?

The input schema rejects the array, and failed executions are not charged. A rejected payload costs nothing and returns nothing.

Which fields come back for each priced token?

Each entry under coins has a price, plus symbol, timestamp, confidence and decimals. The last four can be null, and a null value does not mean the price is missing.

Can I pass routing options such as source or allowFallbacks?

Those options were removed from the current contract, so do not build a payload around them. Only coins is required to price a list.

Next step

Try this with DefiLlama

The tool directory lists every endpoint with its current price. Inspect the inputs there, then let your agent run a small batch before scaling up.

See DefiLlama tools

Share this article