Search

4,083 results found for openai (1288ms)

Code
3,977

import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
}
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
model: AI_CONFIG.model,
temperature: AI_CONFIG.temperature,
- **Auth env key**: `FATEBOOK_API_KEY`
### With OpenAI Responses API
```typescript
const response = await openai.responses.create({
model: "gpt-4o-mini",
input: "Create a prediction: Will I finish my project by Friday? 70% confident, resolve by 202
- **URL**: `https://dicemcp.val.run`
### With OpenAI Responses API
```typescript
const response = await openai.responses.create({
model: "gpt-4o-mini",
input: "Roll 3 dice for me",
## Quick Start
1. **Add your OpenAI API key** in Environment Variables:
- Key: `OPENAI_API_KEY`
- Value: Your OpenAI API key
2. **Open the app** and click "New Chat"
This MCP server works with any MCP-compatible client:
- **OpenAI Responses API** - Add as an MCP tool
- **Claude Desktop** - Add to your MCP config
- **MCP Chat** - Add via the settings UI
### Example with OpenAI
```typescript
const response = await openai.responses.create({
model: "gpt-4o-mini",
input: "Roll 3 dice for me",
export function renderApp({ chats, servers, currentChat, messages }: AppProps) {
const hasApiKey = !!Deno.env.get("OPENAI_API_KEY");
return (
{!hasApiKey && (
<div class="bg-amber-50 border-b border-amber-200 px-4 py-2 text-sm text-amber-800
⚠️ Add <code class="bg-amber-100 px-1 rounded">OPENAI_API_KEY</code> in Environment V
</div>
)}
import { Hono } from "npm:hono@4";
import OpenAI from "npm:openai";
import {
createChat,
}
const apiKey = Deno.env.get("OPENAI_API_KEY");
if (!apiKey) {
return c.json({ error: "Add OPENAI_API_KEY in Environment Variables" }, 503);
}
}
// Call OpenAI
const openai = new OpenAI({ apiKey });
try {
const response = await openai.responses.create({
model: "gpt-4o-mini",
input: conversationMessages,
// Auto-title on first exchange
if (history.length === 1) {
const titleResponse = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [
return c.json({ reply });
} catch (err) {
console.error("OpenAI error:", err);
return c.json({ error: err instanceof Error ? err.message : "AI error" }, 500);
}
Configure the following variables in your environment:
- `AGENT_API_KEY` (This is a secure token that you choose to secure the agent.tsx POST endpoint)
- `OPENAI_API_KEY` (An OpenAI API Key)
- `EXA_API_KEY` (Optional, though needed if you use the web search tool)
import { anthropic } from "npm:@ai-sdk/anthropic";
import { openai } from "npm:@ai-sdk/openai";
import { generateText, streamText } from "npm:ai";
import { getSystemPrompt } from "./prompt.tsx";
const maxSteps = 10;
ROPIC_API_KEY") ? anthropic("claude-3-7-sonnet-latest") : openai("gpt-4.1");
const options = {
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" },