Full Feature Set

Built for Production

Every feature you need to build secure, scalable AI applications directly in the browser.

Security First

OWASP 2024 Compliant

  • 600,000 PBKDF2 iterations for key derivation
  • SHA-512 for secure hashing
  • AES-256-GCM authenticated encryption

Advanced Protection

  • Constant-time comparison prevents timing attacks
  • Memory wiping for sensitive data
  • Key fingerprinting without exposure

Flexible Storage

  • Memory (default, most secure)
  • localStorage with encryption
  • IndexedDB for larger datasets

Auto Expiration

  • Configurable auto-clear timers
  • Session-based key persistence
  • Lifecycle management with destroy()

Middleware Pipeline

📝

Logging

Request/response logging (never logs keys)

🔄

Retry

Exponential backoff with jitter

⏱️

Rate Limit

Client-side request throttling

Timeout

Request timeout handling

🛡️

Content Filter

Filter/sanitize content

🔀

Fallback

Auto-switch to backup provider

📊

Metrics

Performance monitoring

🔧

Custom

Build your own middleware

// Chain middleware together ai.use(createLoggingMiddleware())
.use(createRetryMiddleware({ maxRetries: 3 }))
.use(createRateLimitMiddleware({ requestsPerMinute: 60 }));

Performance

Intelligent Caching

  • • SHA-256 cache keys for request matching
  • • LRU eviction for memory efficiency
  • • Configurable TTL and max size
  • • Cache stats and hit/miss tracking

Request Optimization

  • • Request deduplication
  • • Batch processing with concurrency control
  • • Circuit breaker for resilient retries
  • • Progress callbacks for batch operations

Developer Experience

📦

Multiple Builds

ESM, CJS, UMD for any environment

🎯

Full TypeScript

Rich types with autocomplete

📋

Prompt Templates

Reusable prompts with variables