btb-finance
Autonomous-AI-Agent
TypeScript

๐Ÿค– An autonomous AI agent built in typescript that combines social media management with blockchain capabilities. Features Claude AI integration for intelligent interactions, Solana token creation/management, and automated Twitter engagement. Perfect for DeFi projects looking to automate community management and token operations.

Last updated Jun 10, 2026
20
Stars
3
Forks
1
Issues
0
Stars/day
Attention Score
47
Language breakdown
No language data available.
โ–ธ Files click to expand
README

BTB Finance Autonomous AI Agent ๐Ÿค–

An intelligent Twitter bot that monitors mentions of $BTB, provides information about BTB Finance, and engages with the community using AI-powered responses.

Repository: https://github.com/btb-finance/Autonomous-AI-Agent

Features

  • ๐Ÿฆ Twitter Integration: Monitors mentions, replies to tweets, and posts updates
  • ๐Ÿค– AI-Powered Responses: Uses any AI model from OpenRouter (Claude, GPT-4, Gemini, etc.)
  • ๐Ÿ“š Knowledge Base: Maintains information about BTB Finance for accurate responses
  • ๐Ÿ”„ Real-time Processing: Continuously monitors Twitter for new mentions
  • ๐Ÿ’ฐ Wallet Integration: Ready for future cryptocurrency features
  • ๐Ÿ›ก๏ธ Rate Limit Management: Handles Twitter API rate limits gracefully
  • โšก TypeScript: Built with TypeScript for type safety and better developer experience

Prerequisites

  • Node.js v18 or higher
  • npm, yarn, or bun
  • X (Twitter) Developer Account with API access (Basic tier recommended)
  • OpenRouter API account
  • Git

Setup Instructions

1. Clone the Repository

git clone https://github.com/btb-finance/autonomous-ai-agent.git
cd autonomous-ai-agent

2. Install Dependencies

npm install

3. Configure Twitter API

  • Go to Twitter Developer Portal
  • Create a new app or use existing one
  • Navigate to "User authentication settings"
  • Ensure OAuth 1.0a is enabled with "Read and write" permissions
  • Generate the following credentials:
- API Key and Secret - Access Token and Secret - Bearer Token - Client ID and Secret (OAuth 2.0)

4. Set Up OpenRouter

- Free options: deepseek/deepseek-r1-0528-qwen3-8b:free, nousresearch/hermes-3-llama-3.1-405b:free - Premium options: anthropic/claude-3.5-sonnet, openai/gpt-4-turbo, google/gemini-pro
  • Add credits if using premium models

5. Configure Environment Variables

Create a .env file in the project root:

# Twitter API OAuth 1.0a Credentials
TWITTERAPIKEY=yourapikey_here
TWITTERAPISECRET=yourapisecret_here
TWITTERACCESSTOKEN=youraccesstoken_here
TWITTERACCESSTOKENSECRET=youraccesstokensecret_here
TWITTERBEARERTOKEN=yourbearertoken_here

Twitter OAuth 2.0 Credentials (optional, for future features)

TWITTERCLIENTID=yourclientid_here TWITTERCLIENTSECRET=yourclientsecret_here

OpenRouter API Configuration

OPENROUTERAPIKEY=youropenrouterapikeyhere

Choose any model from https://openrouter.ai/models

OPENROUTERMODEL=yourpreferredmodelhere

Ethereum Wallet Configuration (optional)

WALLETPRIVATEKEY=yourwalletprivatekeyhere ETHRPCURL=yourethereumrpcurlhere ETH_NETWORK=mainnet

6. Build the Project

npm run build

Running the Bot

Development Mode

npm run dev

Production Mode

npm run build
npm start

Available Commands

| Command | Description | |---------|-------------| | npm run dev | Run in development mode with hot reload | | npm start | Run the production build | | npm run build | Compile TypeScript to JavaScript | | npm test | Run test suite | | npm run test:tweet | Test tweet posting functionality | | npm run test:mentions | Test mention fetching | | npm run lint | Run ESLint | | npm run format | Format code with Prettier |

Testing Features

Test Tweet Posting

npm run test:tweet
This will post a test tweet from your configured account.

Test Mention Monitoring

npm run test:mentions
This will fetch the latest mentions of your account.

How It Works

  • Mention Monitoring: The bot checks for new mentions every 60 seconds
  • $BTB Detection: Filters mentions containing "$BTB"
  • Question Extraction: Extracts the actual question from the tweet
  • Knowledge Base Search: Searches the local knowledge base for relevant information
  • AI Response Generation: Uses your chosen OpenRouter model to generate an appropriate response
  • Tweet Reply: Posts the response as a reply to the original tweet

Project Structure

โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ services/          # Core service implementations
โ”‚   โ”‚   โ”œโ”€โ”€ TwitterService.ts      # Twitter API integration
โ”‚   โ”‚   โ”œโ”€โ”€ OpenRouterService.ts   # AI service integration
โ”‚   โ”‚   โ”œโ”€โ”€ BTBTweetService.ts     # Main bot logic
โ”‚   โ”‚   โ”œโ”€โ”€ KnowledgeBaseService.ts # Knowledge management
โ”‚   โ”‚   โ””โ”€โ”€ WalletService.ts       # Crypto wallet integration
โ”‚   โ”œโ”€โ”€ config/            # Configuration management
โ”‚   โ”œโ”€โ”€ types/             # TypeScript type definitions
โ”‚   โ”œโ”€โ”€ utils/             # Utility functions
โ”‚   โ””โ”€โ”€ index.ts           # Application entry point
โ”œโ”€โ”€ knowledge_base/        # BTB Finance information
โ”œโ”€โ”€ .env.example          # Environment variables template
โ””โ”€โ”€ package.json          # Project dependencies

X (Twitter) API Limits (2026)

Be aware of X API pricing tiers:

| Tier | Cost | Read Limit | Post Limit | |------|------|------------|------------| | Free | $0 | Minimal | 1,500 tweets/month | | Basic | $100/mo | 10,000 tweets/month | 3,000 tweets/month | | Pro | $5,000/mo | 1,000,000 tweets/month | Full access | | Enterprise | Custom | Unlimited | Revenue-sharing model |

2026 Updates:
- Pay-as-you-go beta available (Nov 2025)
- Enterprise tier moved to revenue-sharing (July 2025)
- v1.1 API endpoints deprecated

The bot includes automatic rate limit handling and will pause when limits are reached.

Troubleshooting

Common Issues

  • 403 Forbidden Error: Your Twitter app needs "Read and write" permissions
  • 401 Unauthorized: Check your API credentials are correct
  • Rate Limit Errors: The bot will automatically wait and retry
  • OpenRouter Errors: Ensure you have credits and valid API key

Debug Mode

Enable detailed logging by setting the log level in your configuration:

monitoring: {   logLevel: 'debug' }

Security Notes

  • Never commit your .env file
  • Keep your API keys and tokens secure
  • Regularly rotate your access tokens
  • Use environment variables for all sensitive data

Contributing

  • Fork the repository
  • Create a feature branch: git checkout -b feature/your-feature
  • Commit changes: git commit -am 'Add new feature'
  • Push to branch: git push origin feature/your-feature
  • Submit a pull request

Support

For issues and questions:

  • Open an issue on GitHub
  • Tweet at @btb_finance
  • Check the documentation

License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท btb-finance/Autonomous-AI-Agent ยท Updated daily from GitHub