Search

3,155 results found for anthropic (1327ms)

Code
3,144

project,
branchId,
// anthropicApiKey,
// bearerToken,
selectedFiles,
- [x] Add a "view source" / "send me a PR" link
- [x] Show the HTTP preview in second column if there is one (and let the user pick which one to
- [x] Figure out a convention to teach in the anthropic prompt mod where the LLM always checks t
- [x] Ability to create new projects from the interface
- [x] Figure out why OpenTownie can't create HTTP vals. Maybe give it a seperate tool for it?
- [x] Start a timer for messages
- [x] Add more indicators that it's "still working"
- [x] Require users supply their own Anthropic token?
- [x] Add cost indications on messages
- [x] Add a bell noise when the message is done to let us know
import { readFile } from "https://esm.town/v/std/utils/index.ts";
import { createAnthropic } from "npm:@ai-sdk/anthropic@1.2.12";
import {
convertToCoreMessages,
} = await c.req.json();
const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
if (await hasInsufficientCredits({ bearerToken })) {
});
const anthropic = createAnthropic({ apiKey });
let tracedModel = anthropic(model);
if (Deno.env.get("POSTHOG_PROJECT_API_KEY")) {
const traceId = `townie_${rowid}_${Date.now()}`;
// Wrap the Anthropic model with PostHog tracing
tracedModel = withTracing(anthropic(model), phClient, {
posthogDistinctId: user.id,
posthogTraceId: traceId,
// @ts-ignore
lastMessage.content.at(-1).providerOptions = {
anthropic: { cacheControl: { type: "ephemeral" } },
};
}
output_tokens: result.usage.completionTokens,
cache_read_tokens:
result.providerMetadata.anthropic.cacheReadInputTokens,
cache_write_tokens:
result.providerMetadata.anthropic.cacheCreationInputTokens,
});
output_tokens: result.usage.completionTokens,
cache_read_tokens:
result.providerMetadata.anthropic.cacheReadInputTokens,
cache_write_tokens:
result.providerMetadata.anthropic.cacheCreationInputTokens,
});
},
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>
import { OpenAI } from "npm:openai@4";
import { Pinecone } from "npm:@pinecone-database/pinecone@3";
import Anthropic from "npm:@anthropic-ai/sdk@0.27";
// Env vars
const OPENAI_EMBEDDINGS_MODEL = Deno.env.get("OPENAI_EMBEDDINGS_MODEL") ||
"text-embedding-3-small";
const ANTHROPIC_API_KEY = Deno.env.get("ANTHROPIC_API_KEY");
// Validate required environment variables
throw new Error("PINECONE_API_KEY environment variable is required");
}
if (!ANTHROPIC_API_KEY) {
throw new Error("ANTHROPIC_API_KEY environment variable is required");
}
if (!AUTH_TOKEN) {
const openai = new OpenAI({ apiKey: OPENAI_API_KEY });
const pinecone = new Pinecone({ apiKey: PINECONE_API_KEY });
const anthropic = new Anthropic({ apiKey: ANTHROPIC_API_KEY });
const index = pinecone.index(PINECONE_INDEX_NAME);
</context>`;
const response = await anthropic.messages.create({
model: "claude-haiku-4-5",
max_tokens: 300,
embed_ms?: number;
pinecone_query_ms?: number;
anthropic_ms?: number;
} = {};
timings.pinecone_query_ms = pineconeMs;
// Step 3: Anthropic
const { result: answer, ms: anthropicMs } = await timeStep(
"generateResponse",
() => generateResponse(question, context),
);
timings.anthropic_ms = anthropicMs;
// Total
* Examples:
* /api/resolve/davila7/claude-code-templates/supabase-toolkit
* /api/resolve/anthropics/claude-code-plugins/agent-sdk-dev
*/
export async function resolvePlugin(c: Context) {
**Example:**
- `/api/resolve/anthropics/claude-code-plugins/agent-sdk-dev`
**Response:**
{
"name": "agent-sdk-dev",
"namespace": "anthropics/claude-code-plugins",
"gitUrl": "https://github.com/anthropics/claude-code-plugins.git",
"description": "Development tools for building agents",
"version": "1.0.0",
"author": "Anthropic",
"keywords": ["agent", "sdk"],
"category": "development",
**Example:**
- `/api/skills/anthropics/skills/algorithmic-art`
### Install Skill
Returns git URL, metadata, and increments download stats.
Example: `/api/resolve/anthropics/claude-code-plugins/agent-sdk-dev`
2. **Search Plugins:**
Returns skill info (read-only, no install increment).
Example: `/api/skills/anthropics/skills/algorithmic-art`
2. **Install Skill:**
serveFile,
} from "https://esm.town/v/std/utils@85-main/index.ts";
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: foodItemsObject } = await generateObject({
model: anthropic("claude-haiku-4-5-20251001"),
messages: [
{

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