Search
Code4,103
var providerMap = { 'groq': 'Groq', 'openai': 'OpenAI', 'anthropic': 'Anthropic', 'custom': 'Custom Provider' { id: 'groq/compound-mini', name: 'Compound Mini', desc: 'Faster, lighter version with web search and code execution.', logo: '/public/groq-logo-orange.png', provider: 'groq', web: true, tools: true }, // Groq - OpenAI GPT-OSS Models { id: 'openai/gpt-oss-120b', name: 'GPT OSS 120B', desc: 'Flagship 120B parameter model with browser search and reasoning.', logo: '/public/groq-logo-orange.png', provider: 'groq', web: true, thinking: true, tools: true }, { id: 'openai/gpt-oss-20b', name: 'GPT OSS 20B', desc: 'Fast 20B model with web search, thinking, and code execution.', logo: '/public/groq-logo-orange.png', provider: 'groq', web: true, thinking: true, tools: true }, // Groq - Llama 3.x Production { id: 'meta-llama/llama-4-scout-17b-16e-instruct', name: 'Llama 4 Scout 17B', desc: 'Fast responses with image support (750 t/s).', logo: '/public/groq-logo-orange.png', provider: 'groq', image: true, preview: true }, // OpenAI - GPT-5.2 Series (Latest) { id: 'gpt-5.2', name: 'GPT-5.2', desc: 'Most advanced model for coding and agentic tasks across industries.', logo: '/public/openai-logo.png', provider: 'openai', image: true, tools: true }, { id: 'gpt-5.2-pro', name: 'GPT-5.2 Pro', desc: 'Version of GPT-5.2 that produces smarter and more precise responses.', logo: '/public/openai-logo.png', provider: 'openai', image: true, tools: true }, { id: 'gpt-5-mini', name: 'GPT-5 Mini', desc: 'Faster, cost-efficient version of GPT-5 for well-defined tasks.', logo: '/public/openai-logo.png', provider: 'openai', image: true, tools: true }, { id: 'gpt-5-nano', name: 'GPT-5 Nano', desc: 'Fastest, most cost-efficient version of GPT-5.', logo: '/public/openai-logo.png', provider: 'openai', tools: true }, // OpenAI - GPT-4o Series { id: 'gpt-4o', name: 'GPT-4o', desc: 'High-intelligence model with vision, fast and affordable.', logo: '/public/openai-logo.png', provider: 'openai', image: true, tools: true }, { id: 'gpt-4o-mini', name: 'GPT-4o Mini', desc: 'Small, fast, and affordable. Great for most tasks.', logo: '/public/openai-logo.png', provider: 'openai', image: true, tools: true }, // OpenAI - o4 Reasoning Models (Latest) { id: 'o4', name: 'o4', desc: 'Latest reasoning model with enhanced capabilities.', logo: '/public/openai-logo.png', provider: 'openai', thinking: true, image: true, tools: true }, { id: 'o4-mini', name: 'o4-mini', desc: 'Faster reasoning model optimized for coding and math.', logo: '/public/openai-logo.png', provider: 'openai', thinking: true }, // OpenAI - o3 Reasoning Models { id: 'o3', name: 'o3', desc: 'Advanced reasoning model for complex multi-step tasks.', logo: '/public/openai-logo.png', provider: 'openai', thinking: true, image: true, tools: true }, { id: 'o3-mini', name: 'o3-mini', desc: 'Fast, flexible reasoning for coding and problem-solving.', logo: '/public/openai-logo.png', provider: 'openai', thinking: true }, // OpenAI - o1 Reasoning Models { id: 'o1', name: 'o1', desc: 'Original reasoning model for complex analysis.', logo: '/public/openai-logo.png', provider: 'openai', thinking: true, image: true }, { id: 'o1-mini', name: 'o1-mini', desc: 'Efficient reasoning model for coding and math.', logo: '/public/openai-logo.png', provider: 'openai', thinking: true }, // Anthropic - Claude 4 Series (Latest) apiKeys: { groq: '', // Groq API key openai: '', // OpenAI API key anthropic: '', // Anthropic API key custom: '', // Custom provider API key (optional) groq: { name: 'Groq', baseUrl: 'https://api.groq.com/openai/v1', logo: '/public/groq-logo-orange.png', docsUrl: 'https://console.groq.com/docs', apiKeyPrefix: 'gsk_' }, openai: { name: 'OpenAI', baseUrl: 'https://api.openai.com/v1', logo: '/public/openai-logo.png', docsUrl: 'https://platform.openai.com/docs', apiKeyUrl: 'https://platform.openai.com/api-keys', apiKeyPrefix: 'sk-' }, { id: 'meta-llama/llama-4-maverick-17b-128e-instruct', name: 'Llama 4 Maverick 17B', provider: 'groq', desc: 'Powerful image understanding and analysis (600 t/s).', capabilities: { image: true, streaming: true }, preview: true }, { id: 'meta-llama/llama-4-scout-17b-16e-instruct', name: 'Llama 4 Scout 17B', provider: 'groq', desc: 'Fast responses with image support (750 t/s).', capabilities: { image: true, streaming: true }, preview: true }, { id: 'openai/gpt-oss-120b', name: 'GPT OSS 120B', provider: 'groq', desc: 'Flagship 120B parameter model with browser search and reasoning.', capabilities: { web: true, thinking: true, tools: true, streaming: true } }, { id: 'openai/gpt-oss-20b', name: 'GPT OSS 20B', provider: 'groq', desc: 'Fast 20B model with web search, thinking, and code execution.', capabilities: { web: true, thinking: true, tools: true, streaming: true } }, { id: 'moonshotai/kimi-k2-instruct-0905', name: 'Kimi K2', provider: 'groq', desc: 'Highly capable for writing and coding with 262K context.', capabilities: { streaming: true }, preview: true }, { id: 'qwen/qwen3-32b', name: 'Qwen3-32B', provider: 'groq', desc: 'Multilingual responses with thinking capabilities.', capabilities: { thinking: true, streaming: true }, preview: true }, // OpenAI models - GPT-5.2 Series (Latest) { id: 'gpt-5.2', name: 'GPT-5.2', provider: 'openai', desc: 'Most advanced model for coding and agentic tasks across industries.', capabilities: { image: true, streaming: true, tools: true } }, { id: 'gpt-5.2-pro', name: 'GPT-5.2 Pro', provider: 'openai', desc: 'Version of GPT-5.2 that produces smarter and more precise responses.', capabilities: { image: true, streaming: true, tools: true } }, { id: 'gpt-5-mini', name: 'GPT-5 Mini', provider: 'openai', desc: 'Faster, cost-efficient version of GPT-5 for well-defined tasks.', capabilities: { image: true, streaming: true, tools: true } }, { id: 'gpt-5-nano', name: 'GPT-5 Nano', provider: 'openai', desc: 'Fastest, most cost-efficient version of GPT-5.', capabilities: { streaming: true, tools: true } }, // OpenAI - GPT-4o Series { id: 'gpt-4o', name: 'GPT-4o', provider: 'openai', desc: 'High-intelligence model with vision, fast and affordable.', capabilities: { image: true, streaming: true, tools: true } }, { id: 'gpt-4o-mini', name: 'GPT-4o Mini', provider: 'openai', desc: 'Small, fast, and affordable. Great for most tasks.', capabilities: { image: true, streaming: true, tools: true } }, { id: 'chatgpt-4o-latest', name: 'ChatGPT-4o Latest', provider: 'openai', desc: 'Dynamic model continuously updated to current ChatGPT version.', capabilities: { image: true, streaming: true, tools: true } }, // OpenAI - o4 Reasoning Models (Latest) { id: 'o4', name: 'o4', provider: 'openai', desc: 'Latest reasoning model with enhanced capabilities and configurable effort.', capabilities: { thinking: true, streaming: true, image: true, tools: true } }, { id: 'o4-mini', name: 'o4-mini', provider: 'openai', desc: 'Faster reasoning model optimized for coding, math, and science.', capabilities: { thinking: true, streaming: true } }, // OpenAI - o3 Reasoning Models { id: 'o3', name: 'o3', provider: 'openai', desc: 'Advanced reasoning model for complex multi-step tasks.', capabilities: { thinking: true, streaming: true, image: true, tools: true } }, { id: 'o3-mini', name: 'o3-mini', provider: 'openai', desc: 'Fast, flexible reasoning for coding and problem-solving.', capabilities: { thinking: true, streaming: true } }, // OpenAI - o1 Reasoning Models { id: 'o1', name: 'o1', provider: 'openai', desc: 'Original reasoning model for complex analysis.', capabilities: { thinking: true, streaming: true, image: true } }, { id: 'o1-mini', name: 'o1-mini', provider: 'openai', desc: 'Efficient reasoning model for coding and math.', capabilities: { thinking: true, streaming: true } }, { id: 'o1-pro', name: 'o1-pro', provider: 'openai', desc: 'Enhanced compute for hard problems.', capabilities: { thinking: true, streaming: true, image: true } }, // Anthropic - Claude 4 Series (Latest) // Provider settings state providerSettings: { providers: {}, // { groq: { baseUrl, apiKey }, openai: {...} } models: [], // User's configured models loaded: false var providerLogos = { groq: '/public/groq-logo-orange.png', openai: '/public/openai-logo.png', anthropic: 'vscode-icons:file-type-claude', custom: 'lucide:message-square' var logos = { groq: '/public/groq-logo-orange.png', openai: '/public/openai-logo.png', anthropic: 'vscode-icons:file-type-claude', custom: '/public/custom-logo.png' /> <p class="text-xs text-muted-foreground mt-1"> The base OpenAI-compatible endpoint to use. See the <a href="https://console.groq.com/docs" target="_blank" class="text-blue-600 hover:underline">Groq documentation</a>. </p> </div> </div> <!-- OpenAI Provider Section --> <div class="surface" x-data="{ providerOpen: false }"> <button <span class="font-medium flex items-center gap-2"> <span class="iconify text-lg" data-icon="heroicons:chevron-right-20-solid" :class="{ 'rotate-90': providerOpen }" style="transition: transform 0.2s"></span> <img src="/public/openai-logo.png" alt="OpenAI" class="w-5 h-5 object-contain" /> OpenAI </span> </button> class="form-input flex-1" placeholder="sk-..." x-model="apiKeys.openai" @change="updateApiKey('openai', $event.target.value)" style="font-family: var(--font-mono, 'Menlo', monospace); font-size: 0.8125rem;" /> <div class="flex items-center justify-between mt-1"> <p class="text-xs text-muted-foreground"> Get your API key from <a href="https://platform.openai.com/api-keys" target="_blank" class="text-blue-600 hover:underline">platform.openai.com</a> </p> </div> type="text" class="form-input" x-model="providerSettings.providers.openai.baseUrl" @input="updateProviderBaseUrl('openai', $event.target.value)" style="font-family: var(--font-mono, 'Menlo', monospace); font-size: 0.8125rem;" /> <p class="text-xs text-muted-foreground mt-1"> Default: https://api.openai.com/v1 </p> </div> <h4 class="text-sm font-semibold text-foreground mb-0">Models</h4> <div class="flex items-center gap-1 text-xs"> <button type="button" class="btn-ghost btn-sm !px-2 !py-0.5 text-xs" @click="enableAllModels('openai')">All</button> <span class="text-gray-300">/</span> <button type="button" class="btn-ghost btn-sm !px-2 !py-0.5 text-xs" @click="disableAllModels('openai')">None</button> </div> </div> type="button" class="btn-secondary btn-sm" @click="startAddingModel('openai')" x-show="providerSettingsUI.addingModelToProvider !== 'openai'" > <span class="iconify mr-1" data-icon="lucide:plus"></span> <!-- Add New Model Row --> <div x-show="providerSettingsUI.addingModelToProvider === 'openai'" class="add-model-row flex items-center gap-2 p-3 mb-2 rounded-lg border" > placeholder="Enter model ID (e.g., gpt-4o)" x-model="providerSettingsUI.newModelId" :data-new-model-input="'openai'" @keydown.enter.prevent="commitAddingModel()" @keydown.escape.prevent="cancelAddingModel()" <div class="models-table-body expandable-table-body"> <template x-for="model in getModelsForProvider('openai')" :key="model.id"> <details class="expandable-row"> <summary class="text-sm"> </template> <div x-show="getModelsForProvider('openai').length === 0" class="p-4 text-center text-muted-foreground text-sm"> No models configured. Click "Add Model" to get started. </div> <p class="text-sm text-muted-foreground"> Connect to any OpenAI-compatible API endpoint (e.g., Ollama, LM Studio, vLLM, Together AI). </p> /> <p class="text-xs text-muted-foreground mt-1"> The base URL of your OpenAI-compatible API endpoint (must end with /v1) </p> </div>Use any unique string (e.g., "my-dnd-campaign", "solo-ironsworn-2024").Supports: HTTP POST (OpenAI) and SSE (Claude.ai connectors)Endpoint: ${url.origin}`, } // Direct POST for HTTP transport (OpenAI style) if (req.method === "POST") { try {Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.### OpenAI```tsimport { OpenAI } from "https://esm.town/v/std/openai";const openai = new OpenAI();const completion = await openai.chat.completions.create({ messages: [ { role: "user", content: "Say hello in a creative way" },import { generateObject } from "npm:ai";import { openai } from "npm:@ai-sdk/openai";import { z } from "npm:zod";export async function summarizeContent(markdown: string, originalUrl: string): Promise<Summary> { const { object } = await generateObject({ model: openai("gpt-4o"), schema: summarySchema, prompt: `You are summarizing web content that was saved as a task in Todoist. console.log("0.5 webhook"); // Verify the webhook. const OPENAI_SIGNING_SECRET = Deno.env.get("OPENAI_SIGNING_SECRET"); console.log("1 webhook"); if (!OPENAI_SIGNING_SECRET) { console.error("π΄ webhook secret not configured"); return c.text("Internal error", 500); console.log("2 webhook"); const webhook = new Webhook(OPENAI_SIGNING_SECRET); const bodyStr = await c.req.text(); let callId: string | undefined;_2 or _3) to create a fresh table.### OpenAI```tsimport { OpenAI } from "https://esm.town/v/std/openai";const openai = new OpenAI();const completion = await openai.chat.completions.create({ messages: [ { role: "user", content: "Say hello in a creative way" },import { OpenAI } from "https://esm.town/v/std/openai";const enc = new TextEncoder(); const payload = await req.json(); const openai = new OpenAI({ // Strongly recommended: store as a Val Town secret, not in code. // apiKey: Deno.env.get("BASETEN_API_KEY")!, }; const openAIResponse = await openai.chat.completions.create(requestArgs); const stream = new ReadableStream<Uint8Array>({ try { for await ( const chunk of openAIResponse as unknown as AsyncIterable<any> ) { // Stop if the client disconnectedreconsumeralization
import { OpenAI } from "https://esm.town/v/std/openai";
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
/**
* Practical Implementation of Collective Content Intelligence
* Bridging advanced AI with collaborative content creation
*/
exp
kwhinnery_openai
lost1991
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
No docs found