Skip to content

Kushai is an open-source AI platform that hacks the complexity of using Google Gemini models. It manages multiple API keys behind the scenes and offers a simple, unified API for developers with multi-version support.

License

Notifications You must be signed in to change notification settings

David-patrick-chuks/KushAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Kushai Logo

A unified interface to Google Gemini AI models with multi-version support

Coverage Status License npm version

πŸš€ Overview

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.

🌟 Key Features

  • 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

πŸ“‹ Table of Contents

πŸ“¦ Installation

SDK

npm install @kushai/sdk

CLI

npm install -g @kushai/cli

πŸš€ Quick Start

Using the SDK

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();

Using the CLI

# 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

Using the REST API

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"
  }'

πŸ—οΈ Architecture

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:

  1. Separation of Concerns: Each package has a specific responsibility
  2. Type Safety: Comprehensive TypeScript types for all components
  3. Consistent API Design: Uniform API design across all interfaces
  4. Robust Error Handling: Standardized error handling and reporting
  5. Comprehensive Testing: Unit and integration tests for all components

πŸ”₯ Features

Text Generation

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
});

Image Generation

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
});

Chat

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"
});

Function Calling

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"
});

Multimodal

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"
});

πŸ€– Models

Kushai provides access to multiple model versions:

Kushai 1.0 Series

  • kush-1.0-pro: General purpose model
  • kush-1.0-flash: Fast and efficient model
  • kush-1.0-vision: Specialized for image understanding

Kushai 2.0 Series

  • kush-2.0-pro: Advanced model with 128K context window
  • kush-2.0-vision: Advanced vision model

Kushai 2.5 Series (Beta)

  • 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

πŸ”’ Security

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

πŸ› οΈ Development

Prerequisites

  • Node.js 18+
  • MongoDB 5.0+

Setup

  1. Clone the repository:

    git clone https://github.com/kushai/kushai.git
    cd kushai
  2. Install dependencies:

    npm install
  3. Set up environment variables:

    cp .env.example .env
    # Edit .env with your configuration
  4. Start development servers:

    npm run dev

Testing

# Run all tests
npm test

# Run tests for a specific package
npm test --workspace=@kushai/sdk

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

πŸ“„ License

MIT

About

Kushai is an open-source AI platform that hacks the complexity of using Google Gemini models. It manages multiple API keys behind the scenes and offers a simple, unified API for developers with multi-version support.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published