Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Examples

Runnable code examples for the BrainUs AI API.

Setup

All examples require a BrainUs AI API key. Get one at developers.brainus.lk.

export BRAINUS_API_KEY=your_api_key

Python

Requires 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.py

JavaScript / TypeScript

Requires 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.ts

cURL

No dependencies required.

File Description
basic.sh Common API calls as shell scripts

Run an example:

bash examples/curl/basic.sh