Search
Code3,203
brian@airbnb.com,Brian Cheskydrew@dropbox.com,Drew Houstonsam@openai.com,Sam Altmantim@apple.com,Tim Cookjeff@amazon.com,Jeff Bezos
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// @ts-ignoreimport { Hono } from "npm:hono@4.4.12"; }; const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [
// Val Town HTTP val: OpenAI-compatible streaming (Chat Completions)// - Edit LONG_RESPONSE (or pass { override_response }) to change output text.// - Add per-chunk delay with CHUNK_DELAY_MS (or pass { chunk_delay_ms }).// - Adjust chunk size with CHUNK_SIZE (or pass { chunk_size }).// - If "stream": false, returns a non-streaming OpenAI-style response.//// Example POST body (OpenAI style):// {// "model": "gpt-4o-mini", if (req.method !== "POST") { return new Response("Use POST with an OpenAI-style body", { status: 405, headers: corsHeaders, : CHUNK_DELAY_MS; // Non-streaming OpenAI-style response if stream=false if (!streamRequested) { const now = Math.floor(Date.now() / 1000); } // Streaming (SSE) per OpenAI Chat Completions (chat.completion.chunk) const id = `chatcmpl-${crypto.randomUUID()}`; const created = Math.floor(Date.now() / 1000); }, 15000); // Initial role delta (matches OpenAI behavior) send({ id,
import { cors } from "npm:hono/cors";// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// @ts-ignoreimport { blob } from "https://esm.town/v/std/blob?v=11"; const { description } = await c.req.json(); if (!description) return c.json({ error: "Description is required" }, 400); const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ ); } const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// --- TYPE DEFINITIONS --- if (req.method === "POST" && action === "wizard") { try { const openai = new OpenAI(); const body = await req.json(); const phase = body.phase; } const completion = await openai.chat.completions.create({ model: modelToUse, messages: promptMessages,
import { slack } from "./slack.ts";import { Hono } from "npm:hono";import { icp } from "./openai.ts";const app = new Hono();
import { OpenAI } from "https://esm.town/v/std/openai";import { z } from "npm:zod@3.23.8";import { zodResponseFormat } from "npm:openai@5.12.2/helpers/zod";const openai = new OpenAI();const ICPResult = z.object({ }]; const resp = await openai.chat.completions.parse({ model: "gpt-5-mini", 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" },
import "jsr:@std/dotenv/load";const DEFAULT_API_URL = "https://api.groq.com/openai/v1/chat/completions";function getApiKey() { }, ], model: "openai/gpt-oss-120b", stream: true, reasoning_effort: "medium",
reconsumeralization
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