Runnable code examples for the BrainUs AI API.
All examples require a BrainUs AI API key. Get one at developers.brainus.lk.
export BRAINUS_API_KEY=your_api_keyRequires Python 3.9+ and the brainus-ai package.
pip install brainus-ai| File | Description |
|---|---|
| basic_usage.py | Simple query, filters, usage stats, and plans |
| async_patterns.py | Parallel queries and batch processing with asyncio |
| error_handling.py | Handling auth errors, rate limits, and quota errors |
Run an example:
python examples/python/basic_usage.pyRequires Node.js 18+ and the @brainus/ai package.
npm install @brainus/ai| File | Description |
|---|---|
| basic-usage.ts | Simple query with filters and citations |
| nextjs-query.ts | Server-side queries in a Next.js route handler |
| express-query.ts | Express.js endpoint wrapping the BrainUs AI API |
Run an example:
npx tsx examples/javascript/basic-usage.tsNo dependencies required.
| File | Description |
|---|---|
| basic.sh | Common API calls as shell scripts |
Run an example:
bash examples/curl/basic.sh