Search

3,261 results found for openai (3745ms)

Code
3,166

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" },
```
### OpenAI Integration
```typescript
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" }],
model: "gpt-4o-mini",
<library>
## OpenAI
Val Town includes a free, proxied 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" },
```
OpenAI only works on the server. If the val includes client-side code, use dynamic imports t
`const { OpenAI } = await import "https://esm.town/v/std/openai");`
</library>
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 "npm:openai";
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
messages: [
{ role: "user", content: "Say hello in a creative way" },
import process from "node:process";
import { OpenAI } from "npm:openai";
const IMAGE_COST = 500;
].filter(Boolean);
function createPoeClient(apiKey: string): OpenAI {
return new OpenAI({
apiKey: apiKey || "YOUR_POE_API_KEY",
baseURL: "https://api.poe.com/v1",
import process from "node:process";
import { OpenAI } from "npm:openai";
const IMAGE_COST = 500;
].filter(Boolean);
function createPoeClient(apiKey: string): OpenAI {
return new OpenAI({
apiKey: apiKey || "YOUR_POE_API_KEY",
baseURL: "https://api.poe.com/v1",
import process from "node:process";
import { OpenAI } from "npm:openai";
const IMAGE_COST = 400;
}
function createPoeClient(apiKey: string): OpenAI {
return new OpenAI({
apiKey: apiKey || "YOUR_POE_API_KEY",
baseURL: "https://api.poe.com/v1",
import process from "node:process";
import { OpenAI } from "npm:openai";
const IMAGE_COST = 400;
}
function createPoeClient(apiKey: string): OpenAI {
return new OpenAI({
apiKey: apiKey || "YOUR_POE_API_KEY",
baseURL: "https://api.poe.com/v1",
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" },
language,
offset = 0,
model = 'openai/gpt-oss-120b',
reasoning_effort = 'medium',
tools,
}
const isGptOss = typeof model === 'string' && model.startsWith('openai/gpt-oss');
const supportsReasoning = isGptOss;
const supportsTools = isGptOss;