Elfa API Skill
This skill enables Claude to work with the Elfa API — a social listening
and market context layer for crypto traders. Elfa ingests real-time data from Twitter/X, Telegram,
and other sources, then structures sentiment, narratives, and attention shifts into actionable
trading insights.
When to use this skill
- - User asks about trending tokens, narratives, or contract addresses in crypto
- User wants social mentions for a specific ticker or keyword
- User wants smart stats (smart followers, engagement) for a Twitter/X account
- User wants an AI-generated market summary, macro overview, or token analysis
- User asks how to integrate, call, or use the Elfa API
- User wants code examples (curl, Python, JavaScript/TypeScript) for Elfa endpoints
- User mentions "elfa" in a crypto or trading data context
API Overview
Base URL: https://api.elfa.ai
Version: v2 (current)
Two access modes
Elfa supports two independent ways to authenticate requests:
| Mode | Endpoint prefix | Auth header | Best for |
|---|
| API key | INLINECODE1 | INLINECODE2 | Humans & apps with a registered key |
| x402 (keyless) |
/x402/v2/ |
X-PAYMENT: <signed-payload> | Agents & wallets — no signup needed |
Both modes access the same data. The only difference is how you authenticate:
- - API key — register at https://go.elfa.ai/claude-skills, get 1,000 free credits.
- x402 — pay per request with USDC on Base. No registration, no API key. Currently in beta.
Endpoints at a glance
All endpoints below work with both /v2/ (API key) and /x402/v2/ (keyless) prefixes,
except key-status which is API key mode only.
| Endpoint | Method | Description |
|---|
| INLINECODE8 | GET | API key usage & limits (API key mode only) |
| INLINECODE9 |
GET | Trending tokens by mention count |
|
/v2/account/smart-stats | GET | Smart follower & engagement stats for a Twitter account |
|
/v2/data/top-mentions | GET | Top mentions for a ticker symbol |
|
/v2/data/keyword-mentions | GET | Search mentions by keywords or account name |
|
/v2/data/event-summary | GET | AI event summaries from keyword mentions (5 credits) |
|
/v2/data/trending-narratives | GET | Trending narrative clusters (5 credits) |
|
/v2/data/token-news | GET | Token-related news mentions |
|
/v2/aggregations/trending-cas/twitter | GET | Trending contract addresses on Twitter |
|
/v2/aggregations/trending-cas/telegram | GET | Trending contract addresses on Telegram |
|
/v2/chat | POST | AI chat with multiple analysis modes |
For full parameter details, read references/api-reference.md.
How to use this skill
Step 1: Determine the mode
Check whether the user wants to make a live call or get code/integration help.
- - If the user says things like "show me trending tokens", "what's the sentiment on SOL",
"get me the top mentions for ETH" → they want
live data. Proceed to Step 2a.
- - If the user says things like "how do I call the trending tokens endpoint", "give me a
curl example", "help me integrate Elfa" → they want
code snippets. Skip to Step 3.
- - If the user mentions x402, keyless, pay-per-request, or wallet-based access
→ they want
x402 mode. See Step 2b for live calls or Step 3 for code snippets.
Step 2a: Making live API calls (API key mode)
Use the bash_tool to call the Elfa API via curl.
Getting the API key:
- 1. Check if the
ELFA_API_KEY environment variable is set. This is the preferred method. - If the env var is not set, stop and prompt the user. Offer both options:
> To make live calls, you have two options:
>
> Option A — API key (free tier): Get a free key with 1,000 credits at
> https://go.elfa.ai/claude-skills — then set it as the ELFA_API_KEY environment
> variable (do not paste it directly into the chat).
>
> Option B — x402 keyless payments: Pay per request with USDC on Base — no signup
> needed. See the x402 docs for setup.
Do not attempt any authenticated API calls without a key or x402 setup. Wait for the user.
- 3. Credential safety:
- Always read the API key from the
ELFA_API_KEY environment variable, never ask the
user to paste it into the conversation.
- Never log or expose the full API key in outputs — mask it when displaying curl commands.
- If a user does paste a key in chat, warn them to rotate it and set it as an env var instead.
Free tier limitations:
The free tier provides 1,000 credits that work on most endpoints. However, the following
endpoints require a Pay-As-You-Go or Grow plan:
- - Trending narratives
- AI chat
If a user hits an authorization error on one of these endpoints, let them know they can
upgrade their plan or use x402 payments instead. Full details at https://go.elfa.ai/claude-skills.
Making the call:
CODEBLOCK0
Step 2b: Making live API calls (x402 keyless mode)
x402 lets any wallet pay per request using USDC on Base — no API key, no registration.
This is ideal for agents, bots, and programmatic access.
How x402 works:
- 1. Send a request to the
/x402/v2/ version of any endpoint (no auth header). - The server responds with HTTP 402 containing payment requirements.
- Your wallet signs a USDC transfer authorization (no gas fees).
- Resend the request with the signed payment in the
X-PAYMENT header. - Server verifies payment, serves the response, and settles on-chain.
x402 signing and security:
- - Signing happens entirely client-side using the
@x402/fetch or INLINECODE27
libraries. The agent never handles, stores, or transmits private keys.
- - The user's wallet private key is used only locally by the x402 library to sign
EIP-712 typed data authorizing a specific USDC amount for a specific request.
- - Never ask the user to share their wallet private key or seed phrase in the conversation.
- When generating x402 code examples, use
"0xYOUR_PRIVATE_KEY" as a placeholder and
advise the user to load it from an environment variable (e.g.,
process.env.PRIVATE_KEY).
x402 details:
- - Chain: Base (
eip155:8453) - Currency: USDC on Base (
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) - Status: Currently in beta
x402 pricing:
| Tier | Cost | Endpoints |
|---|
| Standard (1 credit) | $0.009 | trending-tokens, smart-stats, keyword-mentions, token-news, top-mentions, trending-cas |
| Extended (5 credits) |
$0.045 | event-summary, trending-narratives |
| Chat — fast | $0.225 | chat (speed: "fast") |
| Chat — expert | $1.00 | chat (speed: "expert", default) |
Making an x402 call with curl (manual flow):
CODEBLOCK1
Recommended: use the @x402/fetch library which handles payment automatically:
CODEBLOCK2
x402 with the Chat endpoint (POST):
CODEBLOCK3
Presenting results:
- - Parse the JSON response and present it in a clean, readable format.
- For trending tokens: show a ranked table with token name, mention count, and change %.
- For mentions: show tweet links, engagement metrics, and account info.
Note: Elfa returns tweet IDs but not tweet text content — let the user know they'll
need their own X (Twitter) API key to fetch the actual tweet content.
- - For narratives/summaries: present the narrative text with source links.
- For the chat endpoint: display the AI response cleanly.
- If the response contains an error, explain what went wrong and suggest fixes.
Step 3: Generating code snippets
When the user wants integration help, generate correct, production-ready code.
Read references/api-reference.md for the full parameter specs.
Principles for code generation:
- - Always mention both access modes (API key and x402) so developers know their options
- Include the signup link
https://go.elfa.ai/claude-skills as a comment near the
API key placeholder, and link to
https://docs.elfa.ai/x402-payments for x402
- - Always include proper error handling
- For API key mode: show the
x-elfa-api-key header (use a placeholder like YOUR_API_KEY) - For x402 mode: show the
/x402/v2/ prefix and recommend @x402/fetch or INLINECODE40 - Include TypeScript types when generating TS code
- Add comments explaining each parameter
- For pagination endpoints, show how to paginate through results
- For time-windowed endpoints, explain the
timeWindow vs from/to pattern
Language priorities (use unless the user specifies otherwise):
- 1. TypeScript/JavaScript (fetch) — most Elfa integrators are web/Node devs
- Python (requests)
- curl
The Chat endpoint deserves special attention — it's the most complex:
- - It supports multiple
analysisType values: chat, macro, summary, tokenIntro,
tokenAnalysis,
accountAnalysis
- - Session management via
sessionId for multi-turn conversations - Different
assetMetadata requirements per analysis type - Two speed modes:
fast and INLINECODE54
Common patterns
Time window parameters:
Many endpoints accept either timeWindow (e.g., "30m", "1h", "4h", "24h", "7d", "30d")
OR from/to unix timestamps. If both are provided, from/to takes priority.
Pagination:
Most list endpoints support page and pageSize. The keyword-mentions endpoint uses
cursor-based pagination instead (cursor parameter).
Ticker format:
For top-mentions, the ticker param can be prefixed with $ to match only cashtags
(e.g., $SOL vs SOL).
Credit costs (both modes):
- - Most endpoints: 1 credit per call ($0.009 via x402)
- Event summary: 5 credits ($0.045 via x402)
- Trending narratives: 5 credits ($0.045 via x402)
- Chat endpoint: varies — fast $0.225, expert $1.00 via x402
Important notes
- - The Elfa API domain (
api.elfa.ai) must be accessible from the network. If blocked,
inform the user and provide the code snippet instead.
- - Always use the v2 endpoints (paths starting with
/v2/ or /x402/v2/). - For experimental endpoints (trending-tokens, smart-stats), mention that behavior may
change without notice.
- - When the user asks about pricing or API key tiers, direct them to
https://go.elfa.ai/claude-skills for full details on plans and pricing.
- - x402 is currently in beta. Rate limits apply per wallet address (not per API key).
- x402 and API key credits are independent — they do not overlap or share balances.
- For x402 documentation and setup, refer users to https://docs.elfa.ai/x402-payments.
Troubleshooting
CORS or network errors in the Claude desktop app:
If the user is running this skill in the Claude desktop app and API calls are failing due
to CORS or network issues, guide them through this fix:
- 1. Open Settings in the Claude desktop app
- Go to Capabilities
- Enable Network Egress
- Add
*.elfa.ai to the allowed domains list
This grants the app permission to make outbound requests to the Elfa API.
Elfa API 技能
该技能使Claude能够与Elfa API协作——这是一个面向加密货币交易者的社交监听和市场背景层。Elfa从Twitter/X、Telegram和其他来源摄取实时数据,然后将情绪、叙事和注意力变化结构化,形成可操作的交易洞察。
何时使用此技能
- - 用户询问加密货币中的热门代币、叙事或合约地址
- 用户想要特定股票代码或关键字的社交提及
- 用户想要Twitter/X账户的智能统计数据(智能关注者、互动量)
- 用户想要AI生成的市场摘要、宏观概述或代币分析
- 用户询问如何集成、调用或使用Elfa API
- 用户想要Elfa端点的代码示例(curl、Python、JavaScript/TypeScript)
- 用户在加密货币或交易数据上下文中提到elfa
API 概述
基础URL: https://api.elfa.ai
版本: v2(当前版本)
两种访问模式
Elfa支持两种独立的请求认证方式:
| 模式 | 端点前缀 | 认证头 | 最佳用途 |
|---|
| API密钥 | /v2/ | x-elfa-api-key: YOUR_KEY | 拥有注册密钥的用户和应用 |
| x402(无密钥) |
/x402/v2/ | X-PAYMENT: <签名负载> | 代理和钱包——无需注册 |
两种模式访问相同的数据。唯一的区别是认证方式:
- - API密钥——在 https://go.elfa.ai/claude-skills 注册,获得1,000个免费积分。
- x402——在Base链上用USDC按请求付费。无需注册,无需API密钥。目前处于测试阶段。
端点一览
以下所有端点均可使用/v2/(API密钥)和/x402/v2/(无密钥)前缀,除key-status仅支持API密钥模式。
| 端点 | 方法 | 描述 |
|---|
| /v2/key-status | GET | API密钥使用情况和限制(仅API密钥模式) |
| /v2/aggregations/trending-tokens |
GET | 按提及次数排序的热门代币 |
| /v2/account/smart-stats | GET | Twitter账户的智能关注者和互动统计 |
| /v2/data/top-mentions | GET | 股票代码的顶级提及 |
| /v2/data/keyword-mentions | GET | 按关键字或账户名搜索提及 |
| /v2/data/event-summary | GET | 关键字提及的AI事件摘要(5积分) |
| /v2/data/trending-narratives | GET | 热门叙事聚类(5积分) |
| /v2/data/token-news | GET | 代币相关新闻提及 |
| /v2/aggregations/trending-cas/twitter | GET | Twitter上的热门合约地址 |
| /v2/aggregations/trending-cas/telegram | GET | Telegram上的热门合约地址 |
| /v2/chat | POST | 支持多种分析模式的AI聊天 |
完整参数详情请阅读references/api-reference.md。
如何使用此技能
第1步:确定模式
检查用户是想要进行实时调用还是获取代码/集成帮助。
- - 如果用户说显示热门代币、SOL的情绪如何、获取ETH的顶级提及→他们想要实时数据。继续第2a步。
- 如果用户说如何调用热门代币端点、给我一个curl示例、帮我集成Elfa→他们想要代码片段。跳到第3步。
- 如果用户提到x402、无密钥、按请求付费或基于钱包的访问→他们想要x402模式。实时调用见第2b步,代码片段见第3步。
第2a步:进行实时API调用(API密钥模式)
使用bash_tool通过curl调用Elfa API。
获取API密钥:
- 1. 检查ELFAAPIKEY环境变量是否已设置。这是首选方法。
- 如果环境变量未设置,停止并提示用户。提供两种选项:
> 要进行实时调用,您有两个选择:
>
> 选项A——API密钥(免费层): 在https://go.elfa.ai/claude-skills获取包含1,000积分的免费密钥——然后将其设置为ELFAAPIKEY环境变量(不要直接粘贴到聊天中)。
>
> 选项B——x402无密钥支付: 在Base链上用USDC按请求付费——无需注册。设置方法请参见x402文档。
在没有密钥或x402设置的情况下,不要尝试任何经过身份验证的API调用。等待用户操作。
- 3. 凭证安全:
- 始终从ELFA
APIKEY环境变量读取API密钥,切勿要求用户将其粘贴到对话中。
- 切勿在输出中记录或暴露完整的API密钥——在显示curl命令时对其进行掩码处理。
- 如果用户确实在聊天中粘贴了密钥,警告他们轮换该密钥并将其设置为环境变量。
免费层限制:
免费层提供1,000个积分,适用于大多数端点。但以下端点需要即用即付或成长计划:
如果用户在其中一个端点上遇到授权错误,告知他们可以升级计划或改用x402支付。完整详情请访问https://go.elfa.ai/claude-skills。
进行调用:
bash
curl -s -H x-elfa-api-key: $ELFAAPIKEY https://api.elfa.ai/v2/aggregations/trending-tokens?timeWindow=24h&pageSize=10
第2b步:进行实时API调用(x402无密钥模式)
x402允许任何钱包在Base链上用USDC按请求付费——无需API密钥,无需注册。这非常适合代理、机器人和程序化访问。
x402工作原理:
- 1. 向任何端点的/x402/v2/版本发送请求(无认证头)。
- 服务器响应HTTP 402,包含支付要求。
- 您的钱包签署USDC转账授权(无Gas费)。
- 使用X-PAYMENT头中的签名支付重新发送请求。
- 服务器验证支付,提供响应,并在链上结算。
x402签名和安全:
- - 签名完全在客户端使用@x402/fetch或@x402/axios库完成。代理从不处理、存储或传输私钥。
- 用户的钱包私钥仅由x402库在本地使用,用于签署EIP-712类型数据,授权特定USDC金额用于特定请求。
- 切勿要求用户在对话中分享其钱包私钥或助记词。
- 生成x402代码示例时,使用0xYOURPRIVATEKEY作为占位符,并建议用户从环境变量加载(例如process.env.PRIVATE_KEY)。
x402详情:
- - 链: Base(eip155:8453)
- 货币: Base链上的USDC(0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913)
- 状态: 目前处于测试阶段
x402定价:
| 层级 | 费用 | 端点 |
|---|
| 标准(1积分) | $0.009 | trending-tokens、smart-stats、keyword-mentions、token-news、top-mentions、trending-cas |
| 扩展(5积分) |
$0.045 | event-summary、trending-narratives |
| 聊天——快速 | $0.225 | chat(速度:fast) |
| 聊天——专家 | $1.00 | chat(速度:expert,默认) |
使用curl进行x402调用(手动流程):
bash
第1步:发送无支付请求——获取402响应及支付要求
curl -s https://api.elfa.ai/x402/v2/aggregations/trending-tokens?timeWindow=24h
第2步:用钱包签署支付负载后,使用X-PAYMENT头重新发送
curl -s -H X-PAYMENT:
\
https://api.elfa.ai/x402/v2/aggregations/trending-tokens?timeWindow=24h
推荐:使用@x402/fetch库自动处理支付:
javascript
import { wrapFetchWithPayment } from @x402/fetch;
import { ExactEvmScheme, toClientEvmSigner } from @x402/evm;
import { x402Client } from @x402/core/client;
import { createPublicClient, http } from