1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
4import { encode } from "https://esm.sh/gpt-tokenizer@2.1.2";
12});
13
14const openai = new OpenAI();
15
16// Default token limits - reduced chunk size for better granularity
123
124 try {
125 const completion = await openai.chat.completions.create({
126 messages: [
127 { role: "system", content: systemPrompt },
178
179 try {
180 const completion = await openai.chat.completions.create({
181 messages: [
182 { role: "system", content: systemPrompt },
38 description: 'Advanced conversational AI for writing, coding, analysis, and creative tasks',
39 category: 'text-ai',
40 url: 'https://chat.openai.com',
41 tags: JSON.stringify(['conversation', 'writing', 'coding', 'analysis']),
42 pricing: 'freemium',
123 {
124 name: 'DALL-E 3',
125 description: 'OpenAI\'s advanced image generation model with exceptional prompt understanding',
126 category: 'image-gen',
127 url: 'https://openai.com/dall-e-3',
128 tags: JSON.stringify(['openai', 'text-to-image', 'creative', 'advanced']),
129 pricing: 'paid',
130 featured: true,
217 description: 'Advanced conversational AI for writing, coding, analysis, and creative tasks',
218 category: 'text-ai',
219 url: 'https://chat.openai.com',
220 tags: JSON.stringify(['conversation', 'writing', 'coding', 'analysis']),
221 pricing: 'freemium',
88Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
89
90### OpenAI
91
92```ts
93import { OpenAI } from "https://esm.town/v/std/openai";
94const openai = new OpenAI();
95const completion = await openai.chat.completions.create({
96 messages: [
97 { role: "user", content: "Say hello in a creative way" },
94Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
95
96### OpenAI
97
98```ts
99import { OpenAI } from "https://esm.town/v/std/openai";
100const openai = new OpenAI();
101const completion = await openai.chat.completions.create({
102 messages: [
103 { role: "user", content: "Say hello in a creative way" },
88Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
89
90### OpenAI
91
92```ts
93import { OpenAI } from "https://esm.town/v/std/openai";
94const openai = new OpenAI();
95const completion = await openai.chat.completions.create({
96 messages: [
97 { role: "user", content: "Say hello in a creative way" },
94Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
95
96### OpenAI
97
98```ts
99import { OpenAI } from "https://esm.town/v/std/openai";
100const openai = new OpenAI();
101const completion = await openai.chat.completions.create({
102 messages: [
103 { role: "user", content: "Say hello in a creative way" },
88Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
89
90### OpenAI
91
92```ts
93import { OpenAI } from "https://esm.town/v/std/openai";
94const openai = new OpenAI();
95const completion = await openai.chat.completions.create({
96 messages: [
97 { role: "user", content: "Say hello in a creative way" },
94Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
95
96### OpenAI
97
98```ts
99import { OpenAI } from "https://esm.town/v/std/openai";
100const openai = new OpenAI();
101const completion = await openai.chat.completions.create({
102 messages: [
103 { role: "user", content: "Say hello in a creative way" },
94Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
95
96### OpenAI
97
98```ts
99import { OpenAI } from "https://esm.town/v/std/openai";
100const openai = new OpenAI();
101const completion = await openai.chat.completions.create({
102 messages: [
103 { role: "user", content: "Say hello in a creative way" },