Search

3,298 results found for openai (1694ms)

Code
3,203

brian@airbnb.com,Brian Chesky
drew@dropbox.com,Drew Houston
sam@openai.com,Sam Altman
tim@apple.com,Tim Cook
jeff@amazon.com,Jeff Bezos
// @ts-ignore
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// @ts-ignore
import { 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-ignore
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// @ts-ignore
import { 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-ignore
import { 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 cre
### OpenAI
```ts
import { 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 cre
### OpenAI
```ts
import { 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",