Search

3,155 results found for β€œanthropic” (6001ms)

Code
3,144

Townie is fully open-source and itself runs on Val Town. Pull requests welcome!
n account, click the **Remix** button and then add your ANTHROPIC_API_KEY. You can leave all the
Authentication in Townie is handled via Val Town Oauth. However, we have not yet opened up our O
</ul>
<p>
The application proxies requests to the Anthropic API and Val Town API, allowing Claud
project files directly.
</p>
const { message, context } = await req.json();
// Your Anthropic API key (stored in Val.town secrets)
const ANTHROPIC_API_KEY = Deno.env.get("ANTHROPIC_API_KEY");
const response = await fetch("https://api.anthropic.com/v1/messages", {
method: "POST",
headers: {
"Content-Type": "application/json",
"anthropic-version": "2023-06-01",
"x-api-key": ANTHROPIC_API_KEY,
},
body: JSON.stringify({
- **Fast Model** (`openai/gpt-oss-20b`): Simple notifications with low severity and minimal desc
- **Balanced Model** (`anthropic/claude-3.5-sonnet`): Standard triage operations (default)
- **Advanced Model** (`openai/gpt-4o`): Critical issues requiring sophisticated analysis
- **Reasoning Model** (`moonshotai/kimi-k2`): Complex scenarios with multiple factors, excellent
|-------|----------|----------|---------------------|------------|---------|
| GPT-OSS 20B | OpenAI | Fast | $0.10/$0.50 | 131K | Open-weight MoE |
| Claude 3.5 Sonnet | Anthropic | Balanced | $3/$15 | 8K | Best overall |
| GPT-4o Mini | OpenAI | Fast | $0.15/$0.60 | 16K | Fallback fast |
| GPT-4o | OpenAI | Advanced | $5/$15 | 4K | Complex analysis |
| Kimi K2 Instruct | MoonshotAI | Reasoning | $1/$3 | 131K | Tool use expert |
| Claude 3 Opus | Anthropic | Reasoning | $15/$75 | 4K | Most capable |
| Gemini Pro 1.5 | Google | Balanced | $1.25/$5 | 8K | Fallback balanced |
// Test a specific model
await testModel('anthropic/claude-3.5-sonnet', 'Hello, test message');
// Test notification triage scenario
export const AI_CONFIG = {
modelSelection: {
default: 'anthropic/claude-3.5-sonnet', // Change default model
fast: 'openai/gpt-oss-20b', // Ultra-cheap for simple notifications
advanced: 'openai/gpt-4o', // For critical analysis
modelId: string,
prompt: string = "Hello! Please respond with a simple greeting.",
provider?: 'groq' | 'openai' | 'anthropic' | 'auto'
): Promise<{ success: boolean; response?: string; error?: string; duration?: number; provider?:
try {
title = 'AI Model Information & Testing';
const modelInfo = getModelInfo();
const basicTest = await testModel('anthropic/claude-3.5-sonnet', 'Hello! Please respond
result = {
import { Bot } from "https://deno.land/x/grammy@v1.35.0/mod.ts";
import { DateTime } from "https://esm.sh/luxon@3.4.4";
import Anthropic from "npm:@anthropic-ai/sdk@0.24.3";
import { backstory } from "../backstory.ts";
import {
} from "../memoryUtils.ts";
async function generateBriefingContent(anthropic, memories, today, isSunday) {
try {
const weekdaysHelp = generateWeekDays(today);
};
console.log("Sending prompt to Anthropic...", userMessage);
const response = await anthropic.messages.create({
model: "claude-3-7-sonnet-latest",
max_tokens: 30000,
export async function sendDailyBriefing(chatId?: string, today?: DateTime) {
// Get API keys from environment
const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
const telegramToken = Deno.env.get("TELEGRAM_TOKEN");
if (!apiKey) {
console.error("Anthropic API key is not configured.");
return;
}
}
// Initialize Anthropic client
const anthropic = new Anthropic({ apiKey });
// Initialize Telegram bot
// Generate briefing content
const content = await generateBriefingContent(
anthropic,
memories,
today,
You'll need to set up some environment variables to make it run.
- `ANTHROPIC_API_KEY` for LLM calls
- You'll need to follow [these instructions](https://docs.val.town/integrations/telegram/) to ma
- For the Google Calendar integration you'll need `GOOGLE_CALENDAR_ACCOUNT_ID` and `GOOGLE_CALEN
import { DateTime } from "https://esm.sh/luxon@3.4.4";
import Anthropic from "npm:@anthropic-ai/sdk@0.24.3";
const RECIPIENTS = ["Geoffrey", "Maggie"] as const;
async function analyzeHtmlContent(
anthropic: Anthropic,
htmlContent: string,
imageSummaries: ImageSummary[]
) {
try {
const response = await anthropic.messages.create({
model: "claude-3-5-sonnet-latest",
max_tokens: 4196,
console.log(e.text);
// Get Anthropic API key from environment
const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
if (!apiKey) {
console.error("Anthropic API key is not configured for this val.");
return;
}
// Initialize Anthropic client
const anthropic = new Anthropic({ apiKey });
// Process each image attachment serially
);
const response = await anthropic.messages.create({
model: "claude-3-5-sonnet-latest",
max_tokens: 4196,
// Analyze HTML content
const htmlAnalysis = await analyzeHtmlContent(
anthropic,
e.html || "",
summaries
} from "https://deno.land/x/grammy@v1.35.0/mod.ts";
import { DateTime } from "https://esm.sh/luxon@3.4.4";
import Anthropic from "npm:@anthropic-ai/sdk@0.24.3";
import { backstory } from "../backstory.ts";
import {
/**
* Format chat history for Anthropic API
*/
function formatChatHistoryForAI(history) {
*/
async function analyzeMessageContent(
anthropic,
username,
messageText,
console.log({ systemPrompt, formattedHistory });
const response = await anthropic.messages.create({
model: "claude-3-5-sonnet-latest",
max_tokens: 4196,
bot.on("message", async (ctx) => {
try {
// Get Anthropic API key from environment
const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
if (!apiKey) {
console.error("Anthropic API key is not configured.");
ctx.reply(
"I apologize, but I'm not properly configured at the moment. Please inform the household
}
// Initialize Anthropic client
const anthropic = new Anthropic({ apiKey });
// Get message text and user info
// Analyze message content with chat history context
const analysis = await analyzeMessageContent(
anthropic,
username,
messageText,
} from "https://esm.town/v/geoffreylitt/getWeather";
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
import Anthropic from "npm:@anthropic-ai/sdk@0.24.3";
const TABLE_NAME = `memories`;
try {
// Get API key from environment
const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
if (!apiKey) {
console.error("Anthropic API key is not configured.");
return null;
}
// Initialize Anthropic client
const anthropic = new Anthropic({ apiKey });
const response = await anthropic.messages.create({
model: "claude-3-5-sonnet-latest",
max_tokens: 150,

Vals

10
View more
diegoivo
anthropicWorkflow
Β 
Public
diegoivo
sdkAnthropic
Β 
Public
maddy
anthropicProxy
Β 
Public
stevekrouse
anthropicStreamDemo
Β 
Public
toowired
anthropicCaching
Β 
Public

Users

No users found
No docs found