Dashboard
Back to API keys
Examples · for reference

Drop your key into one of these.

Three working examples that show how to use a Chest API key. Pick the format that fits where you’re shipping, paste your key into the snippet (or leave the placeholder for now), and copy or download. Every paid call the snippet routes through gate.chest.sh/g/<slug> with your bearer key earns the referral split into your payout wallet.

Starter kit

Attach your key. Earn the split.

Drop one of these into any agent / skill / server. Every paid call it routes through gate.chest.sh/g/<slug> with your referrer key earns the referrer commission on that gate’s split.

Pasted keys never leave your browser, the snippet below renders locally.

Markdown skill + TypeScript tool, drop into your project/.claude/skills

chest-sentiment.skill.md
---
name: chest-sentiment
description: Look up real-time crypto sentiment for a token via the Chest Gate
  sentiment-api. Use when the user asks about market sentiment, mood, or
  bullish/bearish signal for BTC, ETH, SOL, or other major tokens.
---

# Chest Sentiment

This skill queries the `sentiment-api` gate on Chest Gate and earns referral
commissions on every paid call via the bundled referrer key.

## Usage

When the user asks about sentiment for a specific token, call:

```ts
const res = await fetch(
  `https://gate.chest.sh/g/sentiment-api/sentiment/${token.toLowerCase()}`,
  {
    headers: {
      "X-Chest-Referrer-Key": "cg_pub_test_YOUR_KEY_HERE",
    },
  },
);

// 402 on first call, the gate challenges for payment. The caller's x402
// client handles this automatically. After payment, the gate forwards the
// request and returns the sentiment JSON.
const data = await res.json();
// { token, score: -1..1, label: "bullish" | "neutral" | "bearish", summary }
```

## Notes

- **Key scope:** referral attribution only, the key never spends funds. The
  caller still pays $0.005 USDC per call from their own wallet.
- **Paying:** if your runtime doesn't have a wallet, pair this with an x402
  client like `@coinbase/x402-fetch` or `@smd00/x402`.
- **Supported tokens:** `GET https://gate.chest.sh/g/sentiment-api/tokens` (free).

Paste a key above to bake it into the snippet, or leave blank to copy the template with a YOUR_KEY_HERE placeholder.

How payment actually works

These snippets attach your referrer key on the X-Chest-Referrer-Key header and make the request. The first call returns 402 Payment Required with x402 v2 requirements. Your runtime pays it with a wallet of its own and retries, the attribution header survives both attempts so attribution lands on the paid retry.

x402 v2 clients that work with chest gate
  • @x402/svm + @x402/core · Solana, from the x402 team, same client the gate uses server-side
  • @coinbase/x402-fetch · fetch wrapper; EVM-first but scheme-agnostic

Spec: x402.org. If your agent already handles paid APIs, it almost certainly speaks one of these, the snippet above is all you need to add.