Official Zaguán SDK for TypeScript - The easiest way to integrate with Zaguán CoreX, an enterprise-grade AI gateway that provides unified access to 15+ AI providers and 500+ models through a single, OpenAI-compatible API.
Enterprise Ready: Zaguán CoreX eliminates vendor lock-in with intelligent routing across 16+ providers, supports 5,000+ concurrent connections, and provides unified access to 500+ models through a single OpenAI-compatible API.
Zaguán CoreX eliminates vendor lock-in and optimizes costs while unlocking advanced capabilities:
Drop-in replacement for OpenAI SDK with familiar interfaces and minimal code changes.
Unified access to 15+ AI providers and 500+ models through a single API.
Built-in timeouts, retries, and streaming support for production workloads.
Comprehensive TypeScript definitions for all API surfaces.
Structured error types for better error handling and debugging.
Async iterable interface for real-time streaming responses.
Bearer token authentication and request ID tracking for security.
Reduce costs through intelligent provider routing, credit-based billing, and flexible model selection.
npm install @zaguan/sdkimport { ZaguanClient } from '@zaguan/sdk';
// Initialize the client with your API key
const client = new ZaguanClient({
baseUrl: 'https://api.zaguanai.com/', // or https://api-eu-fi-01.zaguanai.com/
apiKey: 'your-api-key-from-zaguanai.com',
});
// Simple chat completion
const response = await client.chat({
model: 'openai/gpt-4o-mini',
messages: [{ role: 'user', content: 'Hello, world!' }],
});
console.log(response.choices[0].message.content);// Streaming chat completion
for await (const chunk of client.chatStream({
model: 'openai/gpt-4o-mini',
messages: [{ role: 'user', content: 'Tell me a story' }],
})) {
if (chunk.choices[0]?.delta?.content) {
process.stdout.write(chunk.choices[0].delta.content);
}
}Access any of the 15+ supported AI providers with a simple model name change:
// OpenAI
const openaiResponse = await client.chat({
model: 'openai/gpt-4o-mini',
messages: [{ role: 'user', content: 'Hello!' }],
});
// Anthropic
const anthropicResponse = await client.chat({
model: 'anthropic/claude-3-5-sonnet',
messages: [{ role: 'user', content: 'Hello!' }],
});
// Google Gemini
const googleResponse = await client.chat({
model: 'google/gemini-2.0-flash',
messages: [{ role: 'user', content: 'Hello!' }],
});Access advanced features of each provider:
const response = await client.chat({
model: 'google/gemini-2.5-pro',
messages: [{ role: 'user', content: 'Solve this complex problem...' }],
provider_specific_params: {
reasoning_effort: 'high',
thinking_budget: 10000,
},
});Use tools and functions with any provider:
const tools = [{
type: 'function',
function: {
name: 'get_weather',
description: 'Get weather information for a location',
parameters: {
type: 'object',
properties: {
location: { type: 'string' }
},
required: ['location']
}
}
}];
const response = await client.chat({
model: 'openai/gpt-4o-mini',
messages: [{ role: 'user', content: "What's the weather in Paris?" }],
tools: tools,
tool_choice: 'auto'
});Zaguán CoreX supports 18+ AI providers with 500+ models:
Contributions are welcome! Whether it's bug reports, feature requests, or pull requests, we appreciate all forms of contribution.
Apache 2.0 Licensed - The Zaguán SDK for TypeScript is free and open source software. You're welcome to use, modify, and distribute it for any purpose.