Node.js / TypeScript: official OpenAI or Anthropic SDK
Set baseURL and your key — the rest of your code stays the same.
Replace
YOUR-ENDPOINT with the endpoint shown on your API Key page after you sign up, and YOUR-KEY with your key. One key works for every model on 666 AI — Claude, GPT, Gemini, DeepSeek, Qwen and 200+ more.1. OpenAI SDK — chat
npm install openai
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://YOUR-ENDPOINT/v1",
apiKey: process.env.YOUR_KEY,
});
const resp = await client.chat.completions.create({
model: "anthropic/claude-haiku-5.5",
messages: [{ role: "user", content: "Say hi in 3 words." }],
max_tokens: 200,
});
console.log(resp.choices[0].message.content);2. Streaming
const stream = await client.chat.completions.create({
model: "anthropic/claude-haiku-5.5",
messages: [{ role: "user", content: "Count from 1 to 5." }],
max_tokens: 200,
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}3. Anthropic SDK
npm install @anthropic-ai/sdk
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://YOUR-ENDPOINT",
apiKey: process.env.YOUR_KEY,
});
const msg = await client.messages.create({
model: "anthropic/claude-haiku-5.5",
max_tokens: 200,
messages: [{ role: "user", content: "Say hi in 3 words." }],
});
console.log(msg.content[0].text);FAQ
Does it work in TypeScript?
Yes, both packages ship their own types.
Can I call it from the browser?
Don't put your key in front-end code. Call 666 AI from your server and forward the result.