Search
Code3,173
sip.post("/", async (c) => { // Verify the webhook. const OPENAI_SIGNING_SECRET = Deno.env.get("OPENAI_SIGNING_SECRET"); if (!OPENAI_SIGNING_SECRET) { console.error("π΄ webhook secret not configured"); return c.text("Internal error", 500); } const webhook = new Webhook(OPENAI_SIGNING_SECRET); const bodyStr = await c.req.text(); let callId: string | undefined; // Accept the call. const url = `https://api.openai.com/v1/realtime/calls/${callId}/accept`; const headers = makeHeaders("application/json"); const body = JSON.stringify(makeSession());
rtc.post("/", async (c) => { // Create the call. const url = "https://api.openai.com/v1/realtime/calls"; const headers = makeHeaders(); const fd = new FormData();
# hello-realtimeHello Realtime is a complete OpenAI Realtime application that supports both WebRTC and SIP users.You can access the app via WebRTC at https://hello-realtime.val.run, or via SIP by calling 425-800-0042.This demo shows off the new SIP API, the new all-in-one WebRTC API, and the new server-side websocket interface.If you remix the app, you'll just need to pop in your own OPENAI_API_KEY (from platform.openai.com), and also the OPENAI_SIGNING_SECRET if you want to use the SIP interface.
observer.post("/:callId", async (c) => { const callId = c.req.param("callId"); const url = `wss://api.openai.com/v1/realtime?call_id=${callId}`; const ws = new WebSocket(url, { headers: makeHeaders() }); ws.on("open", () => {
<meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>OpenAI Realtime API Voice Agent</title> <style> :root {
tools: (() => { const list = []; const isOss = !!(state.selectedModel && state.selectedModel.startsWith('openai/gpt-oss')); if (isOss) { if (state.useBrowserSearch) list.push({ type: 'browser_search' });
export async function postGroqChat({ apiKey, body }) { const res = await fetch('https://api.groq.com/openai/v1/chat/completions', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + apiKey },
<div class="relative"> <select id="preset-model-new" x-model="newPresetSettings.selectedModel" class="px-2 py-1 pr-8 border border-gray-200 bg-white rounded-md focus:ring-2 focus:ring-blue-500 appearance-none text-xs w-full"> <option value="openai/gpt-oss-120b">openai/gpt-oss-120b</option> <option value="openai/gpt-oss-20b">openai/gpt-oss-20b</option> <option value="llama-3.1-8b-instant">llama-3.1-8b-instant</option> <option value="llama-3.3-70b-versatile">llama-3.3-70b-versatile</option> <div class="relative"> <select id="preset-model-select" x-model="editingPresetSettings.selectedModel" class="px-2 py-1 pr-8 border border-gray-200 bg-white rounded-md focus:ring-2 focus:ring-blue-500 appearance-none text-xs w-full"> <option value="openai/gpt-oss-120b">openai/gpt-oss-120b</option> <option value="openai/gpt-oss-20b">openai/gpt-oss-20b</option> <option value="llama-3.1-8b-instant">llama-3.1-8b-instant</option> <option value="llama-3.3-70b-versatile">llama-3.3-70b-versatile</option>
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// --- AI BEHAVIORAL GUIDELINES --- if (req.method === "POST") { try { const openai = new OpenAI(); const { image } = await req.json(); } const completion = await openai.chat.completions.create({ model: "gpt-4o", 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" },
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