A unified interface to Google Gemini AI models with multi-version support
Kushai is an open-source AI platform that hacks the complexity of working with Google Gemini models, providing a unified, developer-friendly interface with multi-version support. It smartly manages a pool of Gemini API keys in the background, giving developers a simple, consistent API for seamless and scalable AI integration.
- Multiple Model Versions: Support for different model versions (kush-1.0, kush-2.0, kush-2.5) with varying capabilities
- Comprehensive AI Capabilities: Text generation, image generation, video generation, multimodal understanding, and more
- Multiple Interfaces: SDK, CLI, and REST API for flexible integration
- Advanced Security: Secure API key management, password hashing, and rate limiting
- Robust Monitoring: Comprehensive logging and usage tracking
- Developer-Friendly: Detailed documentation, examples, and error handling
npm install @kushai/sdk
npm install -g @kushai/cli
import { Kushai } from '@kushai/sdk';
// Initialize with your Kushai API key
const kushai = new Kushai('your-kushai-api-key');
// Generate text with a specific model
async function generateText() {
const response = await kushai.generate({
prompt: 'Explain quantum computing in simple terms',
model: 'kush-2.0-pro'
});
console.log(response.text);
}
// Generate an image
async function generateImage() {
const response = await kushai.generateImage({
prompt: 'A futuristic city with flying cars',
model: 'kush-2.5-creative'
});
console.log(response.images[0]);
}
generateText();
# Configure your API key
kushai config set --api-key "your-kushai-api-key"
# List available models
kushai models list
# Generate text
kushai generate --prompt "Explain quantum computing" --model kush-2.0-pro
# Generate an image
kushai image --prompt "A futuristic city with flying cars" --model kush-2.5-creative --output ./images
curl -X POST https://api.kushai.com/v1/generate
-H "Authorization: Bearer your-kushai-api-key"
-H "Content-Type: application/json"
-d '{
"prompt": "Explain quantum computing in simple terms",
"model": "kush-2.0-pro"
}'
Kushai is built as a TypeScript monorepo with the following packages:
- @kushai/sdk: TypeScript SDK for interacting with the Kushai API
- @kushai/cli: Command-line interface for Kushai
- @kushai/api: Express backend API server
- @kushai/common: Shared utilities and types
- @kushai/web: Landing page and user dashboard
- @kushai/docs: Documentation site
The architecture follows these key principles:
- Separation of Concerns: Each package has a specific responsibility
- Type Safety: Comprehensive TypeScript types for all components
- Consistent API Design: Uniform API design across all interfaces
- Robust Error Handling: Standardized error handling and reporting
- Comprehensive Testing: Unit and integration tests for all components
Generate human-like text for various applications:
const response = await kushai.generate({
prompt: "Write a short story about a robot learning to paint",
model: "kush-2.0-pro",
temperature: 0.7
});
Create images from text descriptions:
const response = await kushai.generateImage({
prompt: "A serene mountain landscape at sunset",
model: "kush-2.5-creative",
width: 1024,
height: 1024
});
Have interactive conversations:
const response = await kushai.chat({
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "What's the capital of France?" }
],
model: "kush-2.0-pro"
});
Use structured function calls for specific tasks:
const response = await kushai.functionCall({
prompt: "What's the weather in New York?",
functions: [
{
name: "getWeather",
description: "Get the weather for a location",
parameters: {
type: "object",
properties: {
location: {
type: "string",
description: "The city and state"
}
},
required: ["location"]
}
}
],
model: "kush-2.0-pro"
});
Process text and images together:
const response = await kushai.multimodal({
prompt: "What's in this image?",
imageUrl: "https://example.com/image.jpg",
model: "kush-2.0-vision"
});
Kushai provides access to multiple model versions:
- kush-1.0-pro: General purpose model
- kush-1.0-flash: Fast and efficient model
- kush-1.0-vision: Specialized for image understanding
- kush-2.0-pro: Advanced model with 128K context window
- kush-2.0-vision: Advanced vision model
- kush-2.5-pro: State-of-the-art model with 256K context
- kush-2.5-flash: High-performance model
- kush-2.5-creative: Specialized for creative content generation
Kushai implements robust security measures:
- API Key Management: Secure generation and validation of API keys
- Password Hashing: bcrypt for secure password storage
- Rate Limiting: Tiered rate limiting based on user plans
- Input Validation: Comprehensive validation of all inputs
- Error Handling: Secure error messages that don't leak sensitive information
- Monitoring: Detailed logging of authentication attempts and API usage
- Node.js 18+
- MongoDB 5.0+
-
Clone the repository:
git clone https://github.com/kushai/kushai.git cd kushai
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env # Edit .env with your configuration
-
Start development servers:
npm run dev
# Run all tests
npm test
# Run tests for a specific package
npm test --workspace=@kushai/sdk
We welcome contributions! Please see our Contributing Guide for details.