Skip to main content

Anthropic

Use Anthropic’s Claude models with RadarOS through the unified ModelProvider interface. Claude excels at long-context tasks, analysis, and nuanced reasoning.

Setup

Install the Anthropic SDK (required by RadarOS for Anthropic support):
npm install @anthropic-ai/sdk

Factory

import { anthropic } from "@radaros/core";

const model = anthropic("claude-sonnet-4-20250514");
modelId
string
required
The Anthropic model identifier.
config
object
Optional configuration. See Config below.

Supported Models

Model IDDescription
claude-sonnet-4-20250514Claude Sonnet 4. Strong balance of speed and capability.
claude-3-5-haiku-20241022Claude 3.5 Haiku. Fast, cost-effective.
Pass any valid Anthropic model ID to the factory. Check the Anthropic docs for the latest model IDs.

Config

apiKey
string
Anthropic API key. If omitted, uses ANTHROPIC_API_KEY environment variable.

Example

const model = anthropic("claude-sonnet-4-20250514", {
  apiKey: process.env.ANTHROPIC_API_KEY,
});

Full Example

import { Agent, anthropic } from "@radaros/core";

const agent = new Agent({
  name: "Claude Assistant",
  model: anthropic("claude-sonnet-4-20250514", {
    apiKey: process.env.ANTHROPIC_API_KEY,
  }),
  instructions: "You are a thoughtful, thorough assistant. Think step by step.",
});

const output = await agent.run("Analyze the pros and cons of microservices.");
console.log(output.text);