SDK
Anthropic Node SDK
Use the Anthropic Node SDK with Claude-compatible Messages routes.
Install
npm install @anthropic-ai/sdkConfigure the client
import Anthropic from "@anthropic-ai/sdk";
const anthropic = new Anthropic({
apiKey: process.env.UOUODUO_API_KEY,
baseURL: "https://uouo.cloud/v1",
});Messages
const message = await anthropic.messages.create({
model: "claude-3-5-sonnet-latest",
max_tokens: 512,
system: "You are a careful code review assistant.",
messages: [
{ role: "user", content: "Compress this launch checklist into three points." },
],
});
console.log(message.content);Streaming
const stream = await anthropic.messages.stream({
model: "claude-3-5-sonnet-latest",
max_tokens: 512,
messages: [{ role: "user", content: "Explain the SSE event order." }],
});
for await (const event of stream) {
if (event.type === "content_block_delta") {
process.stdout.write(event.delta.text ?? "");
}
}Production notes
- Messages requests require `max_tokens`.
- Keep `system` outside `messages`.
- Use a dedicated key for Claude-compatible traffic if you want clean log filters.
- Handle mid-stream interruptions before writing partial output into business data.