Providers
Anthropic
Use Claude 3.5 Sonnet, Claude 3 Opus, and more
🟠
Anthropic
Claude 3.5 Sonnet, Claude 3 Opus
Anthropic
Claude models from Anthropic. Known for safety, long context, and excellent reasoning.
Setup
1. Get API Key
Get your API key from console.anthropic.com
2. Add Environment Variable
# .env.local
ANTHROPIC_API_KEY=sk-ant-...3. Configure Provider
<YourGPTProvider
runtimeUrl="/api/chat"
llm={{
provider: 'anthropic',
model: 'claude-3-5-sonnet-20241022',
}}
>
<CopilotChat />
</YourGPTProvider>Available Models
| Model | Context | Best For |
|---|---|---|
claude-3-5-sonnet-20241022 | 200K | Best balance of speed & quality |
claude-3-opus-20240229 | 200K | Most capable, complex tasks |
claude-3-sonnet-20240229 | 200K | Balanced performance |
claude-3-haiku-20240307 | 200K | Fastest, most affordable |
Recommended: Use claude-3-5-sonnet-20241022 for most use cases.
Configuration Options
llm={{
provider: 'anthropic',
model: 'claude-3-5-sonnet-20241022',
temperature: 0.7, // 0-1
maxTokens: 4096, // Max response length
topP: 1, // Nucleus sampling
topK: 40, // Top-k sampling
}}Vision (Image Input)
Claude 3 models support image analysis:
const { sendMessage } = useYourGPT();
sendMessage("Analyze this screenshot", [
{
type: 'image',
data: base64ImageData,
mimeType: 'image/png',
}
]);Long Context
Claude excels at long documents (200K context):
// System prompt can include extensive documentation
<YourGPTProvider
systemPrompt={`You are a support agent. Here is our full documentation:
${fullDocumentation} // Can be 100K+ tokens
Answer questions based on this documentation.`}
>Tool Calling
Claude has robust tool support:
useToolWithSchema({
name: 'analyze_document',
description: 'Analyze a document for key insights',
schema: z.object({
documentId: z.string(),
analysisType: z.enum(['summary', 'sentiment', 'entities']),
}),
handler: async ({ documentId, analysisType }) => {
// Claude is excellent at analysis tasks
const result = await analyzeDocument(documentId, analysisType);
return { success: true, data: result };
},
});Pricing
| Model | Input | Output |
|---|---|---|
| claude-3-5-sonnet | $3/1M tokens | $15/1M tokens |
| claude-3-opus | $15/1M tokens | $75/1M tokens |
| claude-3-haiku | $0.25/1M tokens | $1.25/1M tokens |
Check Anthropic pricing for current rates.
Next Steps
- Google - Try Gemini models
- Smart Tools - Build Generative UI