Skip to content

Anthropic JavaScript SDK from NordRouter

Install the package:

bash
npm install @anthropic-ai/sdk
ts
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: process.env.NORDROUTER_API_KEY,
  baseURL: "https://nordrouter.com",
});

const response = await client.messages.create({
  model: "anthropic/claude-sonnet-4.6",
  max_tokens: 256,
  messages: [{ role: "user", content: "Ответь: работает" }],
});

const first = response.content[0];
console.log(first.type === "text" ? first.text : "");

The address here is without /v1: SDK adds the path /v1/messages itself.

Official SDK:anthropics/anthropic-sdk-typescript.

All programs