Search

4,004 results found for openai (5637ms)

Code
3,900

volt/frfr/main.ts
5 matches
// @ts-ignore
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
import { Hono } from "npm:hono@4.4.12";
</button>
</form>
<p class="text-sm text-gray-500 mt-6">Powered by Val Town & OpenAI</p>
</div>
<div id="start-overlay" class="fixed inset-0 bg-gray-900/80 backdrop-blur-sm z-20 flex flex-
}
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
}
} catch (error) {
console.error("OpenAI API Error:", error);
return c.json({
error: "An error occurred while communicating with the AI designer.",
}
const response = await fetch("https://api.openai.com/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
},
body: JSON.stringify({
if (!response.ok) {
throw new Error(`OpenAI API error: ${response.status}`);
}
}
const response = await fetch("https://api.openai.com/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
},
body: JSON.stringify({
if (!response.ok) {
throw new Error(`OpenAI API error: ${response.status}`);
}
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" },
_2 or _3) to create a fresh table.
### 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" },
**AI enrichment, browser automation:**
- [std/openai: Prompt an OpenAI model](/reference/std/openai)
- [Clay: Enrich user data with Clay](https://blog.val.town/clay)
- [Browserbase: Search the web with Browserbase](/guides/browser-automation/browserbase/)
volt/scaf/main.ts
4 matches
// @description: Intelligently scaffolds new Val Town projects from a string, with a helpful UI
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// --- Frontend UI Generation ---
content: string,
): Promise<{ projectName: string; projectDescription: string }> {
const openai = new OpenAI();
const prompt =
`You are an expert software architect. Analyze the following file paths and code snippets. B
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "system", content: prompt }],
};
} catch (error) {
console.error("OpenAI call failed:", error);
return {
projectName: `fallback-project-${Date.now()}`,
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,
volt/Gait/main.ts
3 matches
// @ts-ignore
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// --- AI BEHAVIORAL GUIDELINES ---
if (req.method === "POST") {
try {
const openai = new OpenAI();
const body = await req.json();
];
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: messages,