Search
Code3,983
const __secrets = JSON.parse(req.headers.get('x-secrets') || '{}'); const OPENAI_KEY = __secrets['OPENAI_API_KEY']; if (req.method !== 'POST') { const { action } = body; if (!OPENAI_KEY) { console.log('OpenAI API key not configured, using fallback responses'); return handleFallback(action, body); } if (action === 'generate-topics') { return await generateTopics(body.category, OPENAI_KEY); } else if (action === 'analyze-argument') { return await analyzeArgument(body.topic, body.stance, body.argument, OPENAI_KEY); } else { return Response.json({ error: 'Invalid action' }, { status: 400 }); try { const response = await fetch('https://api.openai.com/v1/chat/completions', { method: 'POST', headers: { if (!response.ok) { const error = await response.text(); console.error('OpenAI API error:', error); return handleFallback('generate-topics', { category }); } try { const response = await fetch('https://api.openai.com/v1/chat/completions', { method: 'POST', headers: { if (!response.ok) { const error = await response.text(); console.error('OpenAI API error:', error); return handleFallback('analyze-argument', { argument }); } { name: "longcat-flash-chat", value: "meituan/longcat-flash-chat" }, { name: "longcat-flash-chat-search", value: "meituan/longcat-flash-chat-search" }, { name: "gpt-oss-20b", value: "openai/gpt-oss-20b" }, { name: "qwen3-coder", value: "qwen/qwen3-coder" }, { name: "deepseek-r1", value: "alibaba/tongyi-deepresearch-30b-a3b" }, if (path === "/" || path === "") { return new Response(JSON.stringify({ service: "StockAI OpenAI Compatible API Proxy", version: "1.0.0", endpoints: {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" },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" },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" }, name: `${hotel_name} Concierge`, model: { provider: "openai", model: "gpt-4.1", messages: [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" },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" },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" }, apiKeys: { groq: '', openai: '', // Future support anthropic: '' // Future support } - Monospace font for better readability - Link to Groq console for obtaining API keys- Placeholder for OpenAI API key (coming soon)#### 4. Messaging (`frontend/app/messaging.js`)1. **Additional Providers** - OpenAI API key support - Anthropic API key support - Custom provider configurationreconsumeralization
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": "*",
OpenAI. Copy page Copy page. Copy this page as Markdown for LLMs. View as Markdown View this page as plain text. Open in ChatGPT Ask questions about this page. Use
OpenAI Codex. Copy page Copy page. Copy this page as Markdown for LLMs. View as Markdown View this page as plain text. Open in ChatGPT Ask questions about this page.
= $("p:nth-of-type(2)").first().text(); console.log(intro); Logs OpenAI is an American artificial intelligence (AI) research organization consisting of the non-profit OpenAI, Inc.[5] registered in Delaware and its for-profit subsidiary OpenAI Global, LLC.[6] One
await browser.close(); console.log(intro); Logs "OpenAI is an American artificial intelligence (AI) research laboratory consisting of the non-profit OpenAI Incorporated and its for-profit subsidiary corporation OpenAI Limited Partnership. OpenAI conducts AI
AI. SQLite Store and retrieve structured data Blob Storage Store and retrieve any data OpenAI Use the OpenAI API Email Send emails API and SDK. Section titled “API and SDK”
Val Town + Claude Web/Desktop ChatGPT Web/Desktop Val Town + ChatGPT Codex Val Town + OpenAI Codex Cursor Val Town + Cursor GitHub Copilot Val Town + GitHub Copilot Warp
else—just send it to a val. Val. Section titled “Val” AI enrichment, browser automation: std/openai Prompt an OpenAI model Clay Enrich user data with Clay Browserbase Search the web with
“Popular tools” Claude Code Val Town CLI + Claude Code Codex Val Town CLI + OpenAI Codex Cursor Val Town CLI + Cursor GitHub Copilot Val Town CLI + GitHub
code. Receiving an attachment and then sending it along. Receiving an attachment, sending it to OpenAI, and then emailing it. Headers. Section titled “Headers” You can set custom headers in
} from "https://esm.town/v/patrickjm/gpt3?v=4"; export let librarySecret = gpt3({ prompt: "what is the meaning of life?", openAiKey: Deno.env.get("openai"), }); Import security. If you’re importing someone else’s code, read the code first