Exnest AI SDK

Unified AI API for developers. Access OpenAI, Google Gemini, Moonshot, and more through a single, elegant interface. Support both text completions and chat completions with Universal Connector.

Built for Developers

Exnest AI provides OpenAI-compatible API with dual endpoints for text and chat completions. Use your own API keys or ours—your choice. Simple, secure, and production-ready.

TypeScript First

Full TypeScript definitions with comprehensive type safety and IntelliSense support.

Production Ready

Built-in retry logic, error handling, and rate limiting for enterprise-grade applications.

n8n Compatible

Seamless integration with n8n and other automation tools using Bearer token authentication.

Universal Connector

Use your own provider API keys directly or Exnest's managed keys with secure forwarding.

Core Features

Everything you need to build AI-powered applications at scale, with clean APIs and minimal dependencies.

Multi-Provider

Access OpenAI, Google Gemini, Moonshot, and more through a single unified API.

Smart Retry

Automatic retry with exponential backoff for maximum reliability and uptime.

Configurable

Customize timeouts, retries, and options to match your specific requirements.

Health Checks

Built-in health monitoring and connection testing for proactive monitoring.

Secure

Multiple authentication methods and secure API key management.

Lightweight

Minimal dependencies and optimized performance for production environments.

Universal Connector

Use your own API keys from providers directly or Exnest's managed keys with secure forwarding.

Simple Architecture

Clean, intuitive API design that gets out of your way and lets you focus on building.

// Text Completion - Single prompt
const completion = await fetch('https://api.exnest.app/v1/completions', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ex-sk-your-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'gpt-4.1-mini',
    prompt: 'What is the capital of France?',
    max_tokens: 100
  })
});
// Returns: { object: "text_completion", choices: [{ text: "..." }] }

// Chat Completion - Messages array
const chat = await fetch('https://api.exnest.app/v1/chat/completions', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ex-sk-your-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'gpt-4.1-mini',
    messages: [{ role: 'user', content: 'Hello!' }],
    exnest_metadata: true // Get billing info
  })
});
// Returns: { object: "chat.completion", choices: [{ message: {...} }] }

Universal Connector

Flexibility to use your own provider API keys or Exnest's managed keys with zero security risk. Two endpoints for different use cases.

Two Endpoints

/v1/completions for single prompt (text_completion)
/v1/chat/completions for messages array (chat.completion)

Zero Storage Policy

External API keys are never stored. Securely forwarded directly to providers with zero logging.

Dual Key Support

Use Exnest's managed keys (ex-sk-*) with billing tracking or provider keys (sk-*) without billing.

Optional Metadata

Add exnest_metadata: true to get billing info, transaction ID, and cost breakdown.

Streaming Support

Both endpoints support streaming with Server-Sent Events (SSE) for real-time responses.

OpenAI Compatible

All responses follow OpenAI format. Drop-in replacement for OpenAI API with extended features.

Supported Models

Access the world's leading AI models through a single, unified interface.

OpenAI

gpt-4.1-mini

gpt-4o / gpt-4o-mini

Google Gemini

gemini-2.0-flash-exp

gemini-1.5-pro/flash

Moonshot

moonshot-v1-8k

moonshot-v1-32k/128k

More models coming soon

Join the Community

Connect with developers building the future of AI applications. Open source, active support, and comprehensive documentation.

Open Source

Contributions welcome. Help shape the future of unified AI development.

Active Support

Get help from the community and maintainers in GitHub discussions.

Great Docs

Detailed documentation and examples to get you started quickly.

Ready to Build?

OpenAI-compatible API with text and chat endpoints. Use your own keys or ours. Zero vendor lock-in. Start building in minutes.