CoinGecko

CoinGecko API: convert a BTC amount into a currency table

Turn a BTC amount into a USD, EUR and CNY reference table. Copy the task and run it with your OpenAny key, then use the result in a balance display or asset report.

Primary public API contract reviewed on November 9, 2026; authenticated execution was not tested for this revision.

You already know your BTC balance. Get its reference value in USD, EUR and CNY from one CoinGecko rate snapshot through OpenAny. Copy to agent copies the complete task and runs this case here with your own key.

  • Asset reports: add a multi-currency valuation beside a BTC amount you supply. The task does not look up your wallet or require a wallet address.
  • Balance displays: use the same rate snapshot to calculate reference values for different BTC amounts in your application.
  • Cross-currency comparisons: put USD, EUR and CNY values side by side, with the source and collection time attached to the report.

What you will get

For 0.01 BTC, your Agent returns a table like this. Illustrative values, not live quotes: the example rates are chosen to make the calculation clear.

Currency Illustrative rate per BTC Reference value for 0.01 BTC
USD 100,000 1,000.00 USD
EUR 90,000 900.00 EUR
CNY 700,000 7,000.00 CNY

The report should also include the data source, request ID and local collection time. Its actual amounts come from the response to your request.

Example report to use in an asset summary

This fixed example uses the illustrative rates above. Your Agent should produce the same report structure from its actual response and your chosen inputs.

report
BTC reference valuation
Status: Illustrative output only; not a live quote
BTC amount: 0.01 BTC

Currency   Rate per BTC       Reference value
USD        100,000 USD        1,000.00 USD
EUR         90,000 EUR          900.00 EUR
CNY        700,000 CNY        7,000.00 CNY

Intended data source: CoinGecko via OpenAny
Collected at: unknown (no live request)
Source updated at: unknown
Request ID: unavailable (no live request)
Actual charge: not measured

Summary: The illustrative 0.01 BTC amount is valued in three currencies using
one rate snapshot. These reference values exclude venue fees and slippage.

Use with your Agent

Choose your amount and currencies, then click Copy to agent. It copies the full instruction and fetches the rate table here. No code needed.

Make this example yours

Prepare a reference valuation report for 0.01 BTC in usd,eur,cny, including the source and collection time.

Task preview

Read https://openany.si/SKILL.md and follow its setup and credential-safety instructions.

Task: Use the associated CoinGecko BTC-to-Currency Exchange Rates API to build a reference-value table for 0.01 BTC in usd,eur,cny. Validate that the amount is a finite non-negative number and the currency selection has 1 to 10 currency codes, deduplicating repeated codes. Reuse the user's existing OpenAny key configuration; ask them to connect only if credentials are missing. Inspect the current contract and pricing first. If the request is billable, obtain approval for the current price within the user's budget before calling. Make at most one read-only request, with no path, query or body inputs. Select the requested codes from the returned rates object and multiply each numeric value by the BTC amount. Return a titled valuation report with the BTC amount and a table of currency, rate per BTC, reference value and unit, followed by the source, request ID and collection time. Include the actual charge only if returned; otherwise mark it unknown. Add a one-sentence summary without investment recommendations. Label the collection time as local and source update time as unavailable unless the response supplies it. Preserve enough precision for small crypto amounts; never round a positive reference value to zero. Keep missing rates unknown, not zero. Do not claim the guide's illustrative values are live results. Stop on missing credentials, unapproved or unclear pricing, errors or uncertain outcomes. Do not retry, recharge, trade or substitute providers.

Use these specific API offerings; inspect their current schemas, availability and pricing first:
- CoinGecko — BTC-to-Currency Exchange Rates; API ID: 989442b7-2820-493f-b11b-7a63db86195b; provider: coingecko; revision: 3; https://openany.si/apis/989442b7-2820-493f-b11b-7a63db86195b/

Guide: https://openany.si/guides/coingecko-btc-currency-table/
Ask for a budget and approval before billable requests. Never request credentials in chat. Do not substitute providers or execute other actions without approval. Preserve sources and timestamps; report missing data and actual results honestly.

Run on OpenAny

Copy to agent copies the task and runs it with your active key. Changing the table inputs reuses the fetched snapshot.

  1. Choose your amount and currencies. The defaults are 0.01 BTC and usd,eur,cny. The summary and both Copy to agent buttons update from the same inputs and copy the same complete task.
  2. Click Copy to agent. If you are signed out, sign in and return here with your inputs, then click again. Once signed in, this button copies the complete instruction, checks the current API and fetches one snapshot using an active key from your account. A paid call needs confirmation of its current price. A clipboard failure sends no API request. If you have no active key, create one in API Keys.
  3. Use the returned table. Copy the report into your asset summary or balance display. Keep the source, request ID if available and collection time with it. Missing currencies stay unknown, not zero.
  4. Continue with your Agent. Paste the copied instruction into your Agent if you want it to perform the task too; that makes a separate request. To avoid fetching twice, give it the completed report for follow-up work instead. An external Agent reuses its own local OpenAny setup; follow the connection guide only if needed, and never send a key in chat.

The amount and currency selection control local calculation, not the API request. One snapshot can support several calculations without another fetch. After a successful page run, changing the inputs recalculates the table locally. Clicking Copy to agent again copies the current task and fetches a new snapshot, which may incur a new charge.

Which API this uses

The task uses CoinGecko - BTC-to-Currency Exchange Rates on OpenAny. The provider and data platform are both coingecko; OpenAny supplies the access path, not a separate price feed.

If your Agent already uses OpenAny for models or other APIs, this task can use the same OpenAny API key and account balance. If BTC conversion is your only requirement and you already have a direct CoinGecko integration, keeping that integration is also reasonable.

Read the result correctly

Report item What it means
Rate per BTC Units of the selected currency for one BTC, not the reverse
Reference value Your BTC amount multiplied by that rate
Currency code Keep USD, EUR or CNY beside the number; a symbol alone can be ambiguous
Collection time When your Agent fetched the snapshot, not necessarily when the source updated it

These values are for reference, not executable trading quotes. They do not include a venue's fees, spread or slippage. Source update time is unavailable unless the response provides it.

Adapt this to your report or application

A different BTC balance: ask the Agent to recalculate 0.1 BTC from the saved snapshot. Only the multiplication changes; no new API request is needed.

A different display currency: ask it to select USD and JPY from that same response. An absent currency stays unknown.

Reusing a file does not refresh its rates. For a new snapshot, check pricing again and authorize a new fetch. Historical rates or a non-BTC base currency require a different operation.

Extend the report: the coin-price API can supply prices for several CoinGecko coin IDs; the historical-chart API can supply a price series for a selected coin. See the related APIs below for their required inputs. They are separate workflows, not additional calls in the copied BTC valuation task.

Pricing and limits

Item Scope
Catalog price Fixed USD 0 per call, checked October 29, 2026
Actual test charge Not measured; no authenticated business call was made
Request limit One read-only request per execution; paid calls need approval
Recalculating saved data Local only, no additional API call
Availability, freshness and failure billing Not verified by this tutorial

The page checks the current offering before each run. It asks for confirmation if the fixed price is nonzero and stops if the contract or billing model no longer fits this example. Your Agent checks pricing against your approved budget. Neither path authorizes top-ups.

Build it yourself

Prefer a script or your own application code? The rest of this guide covers the same task through the CLI. Agent users can skip this section.

API definition

Contract item Inspected definition
Method GET
OpenAny operation /v1/agent-apis/coingecko/api/v3/exchange_rates
Contract revision 3
Required API parameters None
Response data of interest rates, keyed by currency code

CoinGecko's exchange-rates reference documents the BTC-based rates object and its name, unit, value and type fields.

Set up the CLI

You need Node.js 22 or later, the current OpenAny CLI and an active OpenAny API key with access to the offering.

bash
npm install -g openany-cli@latest --registry=https://registry.npmjs.org/
openany --version
openany status --scenario call -j

If status reports a missing key, run openany setup --scenario call in your own terminal. Enter a key label, the key at the hidden prompt, then activate it. Keep credentials out of screenshots and source control.

1. Inspect the current offering

bash
openany inspect --id 989442b7-2820-493f-b11b-7a63db86195b --public -j

Confirm GET, no required inputs, and the current billing price and unit. Do not add the BTC amount or currency selection as query parameters: this operation takes no request inputs.

2. Fetch one snapshot

Once your key is configured and you approve the current request price:

bash
openany balance -j
openany run --id 989442b7-2820-493f-b11b-7a63db86195b -j -o btc-rates.json

The CLI checks the definition and account before sending the request. It does not enforce a maximum-spend flag in this command: the price and budget check above is your responsibility, not a CLI spending cap. It does not overwrite an existing output file: use a new filename for a new snapshot, and use the same filename in the processing command. Record the UTC time around the fetch as local collection time, not a provider update timestamp.

3. Read the saved response

CLI JSON wraps the service payload in body and includes status and requestId. For the documented payload, rates are at body.rates; the USD rate is at body.rates.usd.value. Inspect an unexpected response before adapting the parser rather than guessing where the data lives.

Illustrative fixture: this repeats the table's example values, not an API result. The example marker is not a service field; requestId is null.

json
{
  "example": "Illustrative fixture; not a network response",
  "status": 200,
  "requestId": null,
  "body": {
    "rates": {
      "usd": { "name": "US Dollar", "unit": "$", "value": 100000, "type": "fiat" },
      "eur": { "name": "Euro", "unit": "EUR", "value": 90000, "type": "fiat" },
      "cny": { "name": "Chinese Yuan", "unit": "CNY", "value": 700000, "type": "fiat" }
    }
  }
}

4. Build the table locally

The following btc-table.mjs program reads saved CLI output. It makes no network request, needs no key and leaves the original file unchanged. It accepts a BTC amount and up to ten comma-separated currency codes.

javascript
import { readFile } from 'node:fs/promises';

const [file, amountText = '0.01', selection = 'usd,eur,cny'] = process.argv.slice(2);
if (!file) throw new Error('Usage: node btc-table.mjs FILE AMOUNT CURRENCIES');
if (!/^(?:0|[1-9]\d*)(?:\.\d+)?$/.test(amountText)) {
  throw new Error('BTC amount must be a non-negative decimal number.');
}
const amount = Number(amountText);
if (!Number.isFinite(amount)) throw new Error('BTC amount must be finite.');
const codes = [...new Set(selection.toLowerCase().split(',').map(s => s.trim()))];
if (codes.length > 10 || codes.some(code => !/^[a-z]{2,10}$/.test(code))) {
  throw new Error('Choose 1 to 10 currency codes, for example usd,eur,cny.');
}
const saved = JSON.parse(await readFile(file, 'utf8'));
if (saved.status !== 200 || !saved.body?.rates || Array.isArray(saved.body.rates)
    || typeof saved.body.rates !== 'object') {
  throw new Error('Expected successful CLI JSON with body.rates; inspect the saved response.');
}
const rows = codes.map(code => {
  const rate = saved.body.rates[code];
  const known = typeof rate?.value === 'number' && Number.isFinite(rate.value)
    && rate.value > 0 && Number.isFinite(amount * rate.value)
    && (amount === 0 || amount * rate.value > 0);
  return {
    currency: code.toUpperCase(),
    name: rate?.name ?? null,
    unit: rate?.unit ?? null,
    ratePerBtc: known ? rate.value : null,
    referenceValue: known ? amount * rate.value : null,
    status: known ? 'available' : 'unknown',
  };
});
console.log(JSON.stringify({
  example: saved.example ?? null,
  source: 'CoinGecko via OpenAny',
  requestId: saved.requestId ?? null,
  formattedAt: new Date().toISOString(),
  btcAmount: amount,
  rows,
}, null, 2));

Run the formatter against your saved response:

bash
node btc-table.mjs btc-rates.json 0.01 usd,eur,cny

The formatter preserves unknown rates as null and rounds known reference values to two decimals for this fiat display, not settlement accounting. formattedAt is when the script ran, not collection or source update time.

5. Reuse the saved data

Recalculate a different amount:

bash
node btc-table.mjs btc-rates.json 0.1 usd,eur,cny

Select different currencies:

bash
node btc-table.mjs btc-rates.json 0.01 usd,jpy

Both commands are local. Use a new filename when fetching a fresh snapshot.

If a request fails

If a request times out after submission, keep its request ID. Check the record with openany calls get --id REQUEST_ID -j before deciding whether another request is appropriate. A missing record alone does not prove the first request was never executed. For authentication errors, check the configured key rather than sending credentials in a support chat.

Next step

Set your BTC amount and currency codes above and choose Copy to agent to copy the full task and execute this case with your account key. You can use the returned reference table in your report without maintaining the manual formatter yourself.

Request with your inputs

CoinGecko — BTC-to-Currency Exchange Rates

bash
curl \
  'https://api.openany.si/v1/agent-apis/coingecko/api/v3/exchange_rates' \
  -X GET \
  -H "Authorization: Bearer $OPENANY_API_KEY" \
  -H 'Content-Type: application/json'

Frequently asked questions

Do I need a separate CoinGecko API key?

This OpenAny offering declares no user-supplied CoinGecko key parameter. Use an active OpenAny API key with access to the selected offering. A direct CoinGecko integration has its own authentication setup.

Can I change the BTC amount or display currencies without another request?

Yes, reuse a saved response for local recalculation and selection. Those changes do not call the API. A fresh rate snapshot requires a new request and a new price check.

Are the returned values executable trading quotes?

No. They are reference exchange rates, not order-book quotes, transaction simulations or promises that a venue will execute at those prices.

Is the OpenAny API call free?

The catalog listed a fixed USD 0 per call on October 29, 2026. Copy to agent checks current pricing before executing this case; a paid request needs your confirmation. Your Agent must also stay within your approved budget. Recalculating a saved snapshot makes no additional API call.

Do I need to log in to try this?

Yes. In this runnable case, Copy to agent first checks sign-in. If you are signed out, it opens sign-in and returns here with your inputs; click again to copy the complete task and execute with an active key from your account. Login never copies or executes automatically. An external Agent uses its own authorized local OpenAny configuration.

Can I fetch historical rates or choose a non-BTC base currency?

Not with this inspected operation. Its rates are BTC-based and it declares no historical-date or base-currency input. Use a separately inspected offering for a different data requirement.