Skip to content

About

Crazyrouter integration guide and API examples for node; current models, endpoints and pricing references.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Crazyrouter Node.js SDK

An OpenAI SDK wrapper that defaults to https://crazyrouter.com/v1.

Use models and operations that support the selected OpenAI-compatible endpoint.

npm version License: MIT

Installation

npm install crazyrouter

Quick Start

import Crazyrouter from "crazyrouter";

const client = new Crazyrouter({ apiKey: "sk-xxx" });

// GPT-5.4
const gpt = await client.chat.completions.create({
  model: "gpt-5.4",
  messages: [{ role: "user", content: "Explain quantum computing" }],
});

// Claude Opus 4.6 — Chat Completions-compatible text example
const claude = await client.chat.completions.create({
  model: "claude-opus-4-6",
  messages: [{ role: "user", content: "Explain quantum computing" }],
});

// Gemini 3.1 Pro
const gemini = await client.chat.completions.create({
  model: "gemini-3.1-pro-preview",
  messages: [{ role: "user", content: "Explain quantum computing" }],
});

Compatibility

This package wraps the OpenAI SDK; it is not a universal adapter for every gateway protocol. Model discovery does not imply support for native Anthropic, Gemini, music or video task APIs. Use the API documentation for those protocols.

Supported Models

  • OpenAI: GPT-5.4, GPT-5.2, GPT-5, GPT-4o, GPT-4.1, o3, o4-mini
  • Anthropic: Claude Opus 4.6, Sonnet 4.6, Haiku 4.5
  • Google: Gemini 3.1 Pro, Gemini 3 Pro, Gemini 2.5 Pro/Flash
  • DeepSeek: V3.2, V3.1, R1
  • Check the current catalogue for additional compatible models.

Full model list →

Helper Functions

import { listModels, chat } from "crazyrouter";

// List all available models
const models = await listModels("sk-xxx");

// Quick one-liner chat
const answer = await chat("sk-xxx", "gpt-5.4", "What is 2+2?");

Streaming

const stream = await client.chat.completions.create({
  model: "claude-opus-4-6",
  messages: [{ role: "user", content: "Write a poem" }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content || "");
}

Migration from OpenAI SDK

- import OpenAI from "openai";
+ import Crazyrouter from "crazyrouter";

- const client = new OpenAI({ apiKey: "sk-openai-xxx" });
+ const client = new Crazyrouter({ apiKey: "sk-crazyrouter-xxx" });

// Verify the model ID, endpoint and supported parameters before migrating.

Links

License

MIT © Crazyrouter

Version and billing scope

The wrapper uses the OpenAI SDK version range declared in the package manifest. It does not promise that all features of newer SDK versions are available. Check current prices; there is no universal discount.

About

Crazyrouter integration guide and API examples for node; current models, endpoints and pricing references.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages