Search

3,155 results found for anthropic (1261ms)

Code
3,144

import { createAnthropic } from "npm:@ai-sdk/anthropic@latest";
import { generateObject } from "npm:ai@latest";
import { z } from "npm:zod@latest";
});
const anthropic = createAnthropic({
apiKey: Deno.env.get("ANTHROPIC_API_KEY"),
});
const { object, usage } = await generateObject({
model: anthropic("claude-haiku-4-5-20251001"),
messages: [
{ role: "user", content: prompt },
image: "imageData",
providerOptions: {
anthropic: { cacheControl: { type: "ephemeral" } },
},
},
},
"imports": {
"@ai-sdk/anthropic": "npm:@ai-sdk/anthropic@^2.0.45",
"@biomejs/biome": "npm:@biomejs/biome@^2.3.5",
"ai": "npm:ai@^5.0.100",
const body = await req.json();
// Call Anthropic API
const response = await fetch("https://api.anthropic.com/v1/messages", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": Deno.env.get("ANTHROPIC_API_KEY"),
"anthropic-version": "2023-06-01",
},
body: JSON.stringify(body),
"Bash(find:*)",
"Bash(git add:*)",
ude.com/claude-code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nEOF\n)\")"
],
"deny": [],
import Anthropic from "https://esm.sh/@anthropic-ai/sdk@0.24.3";
import { Hono } from "https://esm.sh/hono@4.4.2";
import {
serveFile,
} from "https://esm.town/v/std/utils@85-main/index.ts";
import { createAnthropic } from "npm:@ai-sdk/anthropic";
import { generateObject } from "npm:ai";
import { z } from "npm:zod";
}
const anthropic = createAnthropic({
apiKey: Deno.env.get("ANTHROPIC_API_KEY"),
});
const { object: foodItemsObject } = await generateObject({
model: anthropic("claude-haiku-4-5-20251001"),
messages: [
{
},
"imports": {
"@ai-sdk/anthropic": "npm:@ai-sdk/anthropic@^2.0.45",
"@biomejs/biome": "npm:@biomejs/biome@^2.3.5",
"ai": "npm:ai@^5.0.100",
// example.ts
import { createAnthropic } from "npm:@ai-sdk/anthropic";
import { generateObject } from "npm:ai";
import { z } from "npm:zod";
});
const anthropic = createAnthropic({
apiKey: Deno.env.get("ANTHROPIC_API_KEY"),
});
const { object: sonnetObject, usage: sonnetUsage } = await generateObject({
model: anthropic("claude-sonnet-4-5-20250929"),
messages,
maxOutputTokens: 1024,
const { object: haikuObject, usage: haikuUsage } = await generateObject({
model: anthropic("claude-haiku-4-5-20251001"),
messages,
maxOutputTokens: 1024,
// Paste this into Val Town
import { Anthropic } from "npm:@anthropic-ai/sdk";
const userState = new Map();
}
async function identifyProduct(url, anthropic) {
const response = await anthropic.messages.create({
model: "claude-sonnet-4-20250514",
max_tokens: 200,
}
async function generateResponse(product, mode, context, anthropic) {
const prompt = mode === "sell"
? `VOICE: You're their friend who happens to have impeccable taste. Emma Chamberlain clarity
CRITICAL: 40-60 words MAX. This is a text. Be natural.`;
const response = await anthropic.messages.create({
model: "claude-sonnet-4-20250514",
max_tokens: 250,
message,
conversationHistory,
anthropic,
) {
const response = await anthropic.messages.create({
model: "claude-sonnet-4-20250514",
max_tokens: 150,
try {
const ANTHROPIC_API_KEY =
"sk-ant-api03-FGCkmnTrtPq665-LK8udYSCqd8dosz3SRDxGTxmzAH8lfiqrovK-a6TFeNiiEUP3KfobySlByvBt
const anthropic = new Anthropic({ apiKey: ANTHROPIC_API_KEY });
const formData = await req.formData();
`that's your ${FREE_MESSAGE_LIMIT} freebies used up 🔒 unlimited coming soon, promise`
} else {
const product = await identifyProduct(urlToUse, anthropic);
// Pass their message as context so response can reference it
reply = await generateResponse(product, mode, body, anthropic);
user.usageCount++;
user.pendingUrl = null;
body,
user.conversationHistory,
anthropic,
);
} // Case 3: Mode but no URL → need a link
body,
user.conversationHistory,
anthropic,
);
}
export default async function (req: Request): Promise<Response> {
const ANTHROPIC_API_KEY = Deno.env.get("ANTHROPIC_API_KEY");
// Enable CORS
try {
const response = await fetch("https://api.anthropic.com/v1/messages", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": ANTHROPIC_API_KEY,
"anthropic-version": "2023-06-01",
},
body: JSON.stringify({
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,

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