One API key. 30+ AI models. Zero dependencies.
- 🎯 30+ models, one key — GPT-5, Claude 4, Gemini 2.5, DeepSeek R2, Qwen 3
- 💰 Up to 80% cheaper than official pricing
- 🔄 OpenAI SDK compatible — swap
base_url, zero migration - 🛡️ Built-in retry — auto-retries on network errors
- 🧵 Streaming — async generator for real-time responses
- 📦 Zero dependencies — pure Node.js, no npm bloat
npm install meshs-oneconst MeshsOne = require('meshs-one');
const client = new MeshsOne({ apiKey: 'your-api-key' });
// Simple chat
const reply = await client.chat('Explain quantum computing in one sentence.');
console.log(reply);
// With system prompt + model selection
const reply2 = await client.chat([
{ role: 'system', content: 'You are a Python expert.' },
{ role: 'user', content: 'Write a FastAPI endpoint for file upload.' }
], { model: 'claude-4-sonnet' });
console.log(reply2);| Option | Type | Default | Description |
|---|---|---|---|
apiKey |
string | required | Your API key from api.meshs.one |
timeout |
number | 60000 | Request timeout (ms) |
maxRetries |
number | 3 | Auto-retry count |
Send a chat completion. Returns the response text (string).
// String shorthand
await client.chat('Hello!');
// Full message array
await client.chat([
{ role: 'user', content: 'Hello!' }
]);
// With options
await client.chat('Hello!', {
model: 'claude-4-opus',
temperature: 0.7,
maxTokens: 2000
});
// Streaming
const stream = await client.chat('Tell me a story', { stream: true });
for await (const chunk of stream) {
process.stdout.write(chunk);
}const models = await client.listModels();
// [{ id: 'gpt-5', owned_by: 'openai' }, ...]const ok = await client.ping(); // true | falseconst models = client.getKnownModels();
// ['claude-4-opus', 'claude-4-sonnet', 'gpt-5', 'gpt-4o', ...]const { MeshsError, MeshsAuthError, MeshsRateLimitError } = MeshsOne;
try {
await client.chat('Hello');
} catch (err) {
if (err instanceof MeshsAuthError) {
console.error('Invalid API key');
} else if (err instanceof MeshsRateLimitError) {
console.error('Too many requests, slow down');
} else if (err instanceof MeshsError) {
console.error(`Meshs error: ${err.message} (HTTP ${err.status})`);
}
}Already using openai npm package? Just change baseURL:
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://api.meshs.one/v1',
apiKey: 'your-api-key'
});
// All your existing code works!| Model | Provider | Best for |
|---|---|---|
gpt-5 |
OpenAI | General purpose, math |
gpt-4o |
OpenAI | Balanced cost/quality |
claude-4-opus |
Anthropic | Long-form writing |
claude-4-sonnet |
Anthropic | Code generation |
gemini-2.5-pro |
Translation, vision | |
gemini-2.5-flash |
Fast, cheap | |
deepseek-r2 |
DeepSeek | Math, reasoning |
deepseek-v3 |
DeepSeek | Budget batch |
qwen-3 |
Alibaba | Budget batch |
qwen-3-turbo |
Alibaba | Fast, cheapest |
| Date | Tutorial | Blog | Code |
|---|---|---|---|
| 2026-06-24 | AI API Gateway Quickstart: One Key, 30+ Models in 5 Minutes | blog.meshs.one | examples/quickstart.js · smart-router.js |
More tutorials coming soon. Have a use case to share? Open an issue.
MIT © Meshs One
Get API Key · Blog · X