feat: Add CoinGecko plugin
Adding a new plugin, where with free API from coingecko we can get price of a currency and its marketcap. There are 2 actions, so we can fetch by name/ticker but also with address of token.
Added, Readme, .env config and integration to default agent if key is set.
Image attached for example how it makes output.
Seems unnecessary to change the character files (provider switched for whatever reason), also the entire package.json instead of just adding the plugin. I know that's just a formatting thing but makes it more tedious to review.
Seems unnecessary to change the character files (provider switched for whatever reason), also the entire package.json instead of just adding the plugin. I know that's just a formatting thing but makes it more tedious to review.
Ahh nm I see you added those characters originally. Just seemed unrelated to the PR.
Seems unnecessary to change the character files (provider switched for whatever reason), also the entire package.json instead of just adding the plugin. I know that's just a formatting thing but makes it more tedious to review.
Ahh nm I see you added those characters originally. Just seemed unrelated to the PR.
had some problems on DEV branch with antropic so I did change model to openai, but reverted now on this PR, as this is unrelated.
Seems unnecessary to change the character files (provider switched for whatever reason), also the entire package.json instead of just adding the plugin. I know that's just a formatting thing but makes it more tedious to review.
about formating, isnt the setting for prettier set to 4 in all places, so seems to me this should be right formating of .json file?
Going to test this but there are merge conflicts that need to be fixed. Might need to rebase this onto current develop branch to fix. I'm seeing some stuff that doesn't exist in current develop i.e. agent/src/index.ts everything but the addition of the import and getSecret(character, "COINGECKO_API_KEY") ? coingeckoPlugin : null, should be reverted/removed (it's correct already in current develop so this is probably the merge conflict).
Going to test this but there are merge conflicts that need to be fixed. Might need to rebase this onto current develop branch to fix. I'm seeing some stuff that doesn't exist in current develop i.e. agent/src/index.ts everything but the addition of the import and
getSecret(character, "COINGECKO_API_KEY") ? coingeckoPlugin : null,should be reverted/removed (it's correct already in current develop so this is probably the merge conflict).
thanx for review, develop moves fast so I didn't update it for 2 days and lots has changed, I merged current develop into mine so now there shouldn't be any conflict.
Going to test this but there are merge conflicts that need to be fixed. Might need to rebase this onto current develop branch to fix. I'm seeing some stuff that doesn't exist in current develop i.e. agent/src/index.ts everything but the addition of the import and
getSecret(character, "COINGECKO_API_KEY") ? coingeckoPlugin : null,should be reverted/removed (it's correct already in current develop so this is probably the merge conflict).thanx for review, develop moves fast so I didn't update it for 2 days and lots has changed, I merged current develop into mine so now there shouldn't be any conflict.
This looks really clean now. Unfortunately I encountered an error attempting to test price retrieval -
["✓ Normalized action: getcoin_price"]
["ℹ Executing handler for action: GET_COIN_PRICE"]
["◎ Starting GET_COIN_PRICE handler..."]
◎ LOGS
Fetched coin list, total coins:
16269
Error in generateObject: Error: Unknown model
at getEncodingNameForModel (file:///media/bsc/eliza/node_modules/js-tiktoken/dist/chunk-YVJR5WRT.js:242:13)
at encodingForModel (file:///media/bsc/eliza/node_modules/js-tiktoken/dist/index.js:43:22)
at trimTokens (file:///media/bsc/eliza/packages/core/dist/index.js:2191:22)
at generateObject (file:///media/bsc/eliza/packages/core/dist/index.js:2607:19)
at Object.handler (file:///media/bsc/eliza/packages/plugin-gecko/dist/index.js:4114:40)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async AgentRuntime.processActions (file:///media/bsc/eliza/packages/core/dist/index.js:3577:17)
at async MessageManager.handleMessage (file:///media/bsc/eliza/packages/client-discord/dist/index.js:2132:17)
⛔ ERRORS
Error during price lookup:
{}
Going to test this but there are merge conflicts that need to be fixed. Might need to rebase this onto current develop branch to fix. I'm seeing some stuff that doesn't exist in current develop i.e. agent/src/index.ts everything but the addition of the import and
getSecret(character, "COINGECKO_API_KEY") ? coingeckoPlugin : null,should be reverted/removed (it's correct already in current develop so this is probably the merge conflict).thanx for review, develop moves fast so I didn't update it for 2 days and lots has changed, I merged current develop into mine so now there shouldn't be any conflict.
This looks really clean now. Unfortunately I encountered an error attempting to test price retrieval -
["✓ Normalized action: getcoin_price"] ["ℹ Executing handler for action: GET_COIN_PRICE"] ["◎ Starting GET_COIN_PRICE handler..."] ◎ LOGS Fetched coin list, total coins: 16269 Error in generateObject: Error: Unknown model at getEncodingNameForModel (file:///media/bsc/eliza/node_modules/js-tiktoken/dist/chunk-YVJR5WRT.js:242:13) at encodingForModel (file:///media/bsc/eliza/node_modules/js-tiktoken/dist/index.js:43:22) at trimTokens (file:///media/bsc/eliza/packages/core/dist/index.js:2191:22) at generateObject (file:///media/bsc/eliza/packages/core/dist/index.js:2607:19) at Object.handler (file:///media/bsc/eliza/packages/plugin-gecko/dist/index.js:4114:40) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async AgentRuntime.processActions (file:///media/bsc/eliza/packages/core/dist/index.js:3577:17) at async MessageManager.handleMessage (file:///media/bsc/eliza/packages/client-discord/dist/index.js:2132:17) ⛔ ERRORS Error during price lookup: {}
try with openai as modelProvider, IDK why when using anthropic it gets this error, doesnt seem like problem with this plugin as it just sets "ModelClass.SMALL" and then in tiktoken module
function getEncodingNameForModel(model) {
switch (model) {
this part gets some model that is not in the list, but seems more like general codebase problem, as I dont set the actual model in plugin. Please trace it out yourself and let me know what you think?
was having problems with using "generateObject" somehow it got into tiktoken even when using anthropic, didn't really need to use it, just switched to "generateMessageResponse" and all is fine now and should work as expected, please try it out
Scratch what I said before, this is working now you just need to add the plugin to the pnpm-lock file. This is a lot of commits for a single PR but the eliza devs don't seem to mind so this should be good to go.
Tested with Venice
Scratch what I said before, this is working now you just need to add the plugin to the pnpm-lock file. This is a lot of commits for a single PR but the eliza devs don't seem to mind so this should be good to go.
Tested with Venice
Added lock file.
yeah, sorry for too many fixes, was mostly because of the model issue and that the whole plugin namespace changed, so tracking this and updating to dev branch that is constantly moving was hard to catch, but in the end it all resulted in better code and better of understanding of the whole system.
hey @0xCardinalError @odilitime , thanks for working on this!
I work on CoinGecko product, I can supply pro api key to ease your testing, and as token of appreciation for your contributions. Feel free to ping TG @soonegg91
There's more can be done here for eliza with the CG demo and pro api, happy to bounce ideas.
hey @0xCardinalError @odilitime , thanks for working on this!
I work on CoinGecko product, I can supply pro api key to ease your testing, and as token of appreciation for your contributions. Feel free to ping TG @soonegg91
There's more can be done here for eliza with the CG demo and pro api, happy to bounce ideas.
hey, thnx. will contact him in pvt and see where we can take this to
@odilitime @proteanx is testing done, Is anything else needed for this PR? (updated to latest dev branch)
It correctly fetched the price but the first message was probably not meant to be printed?
I installed and tested the plugin. Here's some feedback:
Current Features
- Get current price and market cap for known coins (BTC, ETH). Question: I tested with ordinals tokens (BRC20 but it doesn't fetch them.
- Get price and market cap for tokens by address on specific chains
- Basic error handling for unknown tokens
Limitations Found Through Testing
- Cannot remember or reference previously mentioned prices
- No access to historical data or 24h changes
- No price comparison functionality
- No volume data
- No price alerts or threshold notifications
- No trend analysis
- Action indicators (
(GET_COIN_PRICE),(GET_TOKEN_PRICE_BY_ADDRESS)) visible in responses
Questions
Is this the whole scope? Getting the price when explicitly requested? Or is there a way to extract more from the API?` thanks!
No access to historical data or 24h changes No volume data
Thanks for testing it out. The current commits include these 2 endpoints that support 24hr price change and 24hr trading volume data, but don't think it's included in the code:
- https://docs.coingecko.com/reference/simple-price
- https://docs.coingecko.com/reference/simple-token-price Currently, only include_market_cap is included for both endpoints above. Suggestion: to add the optional params: include_24hr_vol , include_24hr_change
Question: I tested with ordinals tokens (BRC20 but it doesn't fetch them.
Able to replicate this issue. It works for 'bitcoin', but not the following (refer image below):
- 64550b91e058ef71501f1f46d446f6dae16fa446321f9e02e3c89490220ef400i0 on ordinals (CG page)
- price for Bitcoin Wizards (same token as above)
- 0x1185cb5122edad199bdbc0cbd7a0457e448f23c7 on base (CG page)
In case this helps - for 'chainId', this is how CoinGecko API maps with 'asset_platform_id'
- https://docs.coingecko.com/reference/asset-platforms-list (list of ids here)
- https://docs.coingecko.com/reference/simple-token-price
--
There's definitely a lot more data and functionalities can be added given the API has more than 70 endpoints. Perhaps, can let 0xCardinalError focus on shipping the initial scopes, and can continue to expand to support more use cases. Hoping to see more contributors collab too :)
this works but not good all the time!
2. No access to historical data or 24h changes
What kind of print out do you use, when using default browser I don't get extra messages.
I installed and tested the plugin. Here's some feedback:
Current Features
- Get current price and market cap for known coins (BTC, ETH). Question: I tested with ordinals tokens (BRC20 but it doesn't fetch them.
- Get price and market cap for tokens by address on specific chains
- Basic error handling for unknown tokens
Limitations Found Through Testing
- Cannot remember or reference previously mentioned prices
- No access to historical data or 24h changes
- No price comparison functionality
- No volume data
- No price alerts or threshold notificationsh
- No trend analysis
- Action indicators (
(GET_COIN_PRICE),(GET_TOKEN_PRICE_BY_ADDRESS)) visible in responsesQuestions
Is this the whole scope? Getting the price when explicitly requested? Or is there a way to extract more from the API?` thanks!
as written in readme it was just 2 endpoints for fetching price as some V1 of this to have access to price. this made most sense to have for a BOT. should add it to memory/state for reuse. will add others over time, which ones makes most sense. I am thinking mostly in a way that AI would buy something or inform others about specific info about price/market situations. Please state some scenarios you think would be good to have?
No access to historical data or 24h changes No volume data
Thanks for testing it out. The current commits include these 2 endpoints that support 24hr price change and 24hr trading volume data, but don't think it's included in the code:
- https://docs.coingecko.com/reference/simple-price
- https://docs.coingecko.com/reference/simple-token-price Currently, only include_market_cap is included for both endpoints above. Suggestion: to add the optional params: include_24hr_vol , include_24hr_change
Question: I tested with ordinals tokens (BRC20 but it doesn't fetch them.
Able to replicate this issue. It works for 'bitcoin', but not the following (refer image below):
- 64550b91e058ef71501f1f46d446f6dae16fa446321f9e02e3c89490220ef400i0 on ordinals (CG page)
- price for Bitcoin Wizards (same token as above)
- 0x1185cb5122edad199bdbc0cbd7a0457e448f23c7 on base (CG page)
In case this helps - for 'chainId', this is how CoinGecko API maps with 'asset_platform_id'
- https://docs.coingecko.com/reference/asset-platforms-list (list of ids here)
- https://docs.coingecko.com/reference/simple-token-price
--
There's definitely a lot more data and functionalities can be added given the API has more than 70 endpoints. Perhaps, can let 0xCardinalError focus on shipping the initial scopes, and can continue to expand to support more use cases. Hoping to see more contributors collab too :)
yes, there are a lot of endpoints, started from the most logical one :)
about the base problem, hmm it could also be down to quirkiness of actual LLM/char you are using. I tried exact same many times and it does output correctly as seen below.
about ordinals, yeah, that is a problem, optimizing template for it and other to use ordinals word as platform/chain _id
this works but not good all the time!
please provide if you have different problems then the ones stated by others?
Ordinals should be fetched now, also added memory part so agent can recall what he just found
Added trending coins.
was solved and merged in other PRs, so will close this one

In case this helps - for 'chainId', this is how CoinGecko API maps with 'asset_platform_id'