Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7Bart_info.art.src%7D?q=openai&page=67&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=openai

Returns an array of strings in format "username" or "username/projectName"

Found 1630 results for "openai"(503ms)

chatGPTClonemain.tsx3 matches

@shadow24•Updated 2 months ago
95export default async function server(request: Request): Promise<Response> {
96 if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
97 const { OpenAI } = await import("https://esm.town/v/std/openai");
98 const openai = new OpenAI();
99
100 const { messages } = await request.json();
101
102 const stream = await openai.chat.completions.create({
103 model: "gpt-4o-mini",
104 messages: messages,

tactfulGreenPigeonmain.tsx3 matches

@jarin1425•Updated 2 months ago
100export default async function server(request: Request): Promise<Response> {
101 if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
102 const { OpenAI } = await import("https://esm.town/v/std/openai");
103 const openai = new OpenAI();
104
105 const { messages } = await request.json();
106
107 const stream = await openai.chat.completions.create({
108 model: "gpt-4o-mini",
109 messages: messages,

researchAgentemailHandler2 matches

@saif•Updated 2 months ago
2import process from "node:process";
3import { marked } from "npm:marked";
4import { OpenAI } from "npm:openai";
5
6function pm(...lines: string[]): string {
16 );
17
18 const client = new OpenAI({ apiKey: process.env.PERPLEXITY_API_KEY, baseURL: "https://api.perplexity.ai" });
19 const response = await client.chat.completions.create({
20 model: "sonar",

chatmain.tsx1 match

@sandy•Updated 2 months ago
2 const apiKey = "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"; // Use straight quotes
3
4 const response = await fetch(“https://api.openai.com/v1/chat/completions”, {
5 method: “POST”,
6 headers: {

AuraX_AImain.tsx3 matches

@HTKhan14•Updated 2 months ago
194export default async function server(request: Request): Promise<Response> {
195 if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
196 const { OpenAI } = await import("https://esm.town/v/std/openai");
197 const openai = new OpenAI();
198
199 try {
200 const { messages } = await request.json();
201
202 const completion = await openai.chat.completions.create({
203 messages: [
204 ...messages,

githubactivitysummarizerREADME.md3 matches

@michaelwschultz•Updated 2 months ago
1# GitHub Activity Summarizer
2
3This val.town script fetches a user's recent GitHub activity and generates a summarized narrative overview using OpenAI's GPT model.
4
5## Features
6
7- Retrieves GitHub activity for a specified user from the past week
8- Summarizes activity using OpenAI's GPT-3.5-turbo model
9- Returns a concise, narrative summary of the user's GitHub contributions
10
22## Note
23
24Ensure you have necessary permissions and comply with GitHub's and OpenAI's terms of service when using this script.

email_summarizermain.tsx3 matches

@patrickgdl•Updated 2 months ago
2import { email } from "https://esm.town/v/std/email";
3import { extractValInfo } from "https://esm.town/v/stevekrouse/extractValInfo";
4import { OpenAI } from "npm:openai";
5
6function stripHtmlBackticks(html: string): string {
9
10export default async function(e: Email) {
11 const openai = new OpenAI();
12 console.log(`from: ${e.from} to: ${e.to} subject: ${e.subject}, cc: ${e.cc}, bcc: ${e.bcc}`);
13
25 }
26
27 const summary = await openai.chat.completions.create({
28 messages: [
29 {

genuineBrownBoobymain.tsx3 matches

@sdevanair•Updated 2 months ago
19async function generateMotivation(userProgress) {
20 try {
21 const { OpenAI } = await import("https://esm.town/v/std/openai");
22 const openai = new OpenAI();
23
24 const motivationPrompt = `Generate a highly personalized, inspiring message for someone who has ${userProgress.totalHabits} habits, ${userProgress.completedHabits} completed habits, and an average streak of ${userProgress.averageStreak} days. Make it motivational and specific.`;
25
26 const response = await openai.chat.completions.create({
27 model: "gpt-4o-mini",
28 messages: [{ role: "user", content: motivationPrompt }],

habitTrackerAppmain.tsx3 matches

@sdevanair•Updated 2 months ago
19async function generateMotivation(userProgress) {
20 try {
21 const { OpenAI } = await import("https://esm.town/v/std/openai");
22 const openai = new OpenAI();
23
24 const motivationPrompt = `Generate a highly personalized, inspiring message for someone who has ${userProgress.totalHabits} habits, ${userProgress.completedHabits} completed habits, and an average streak of ${userProgress.averageStreak} days. Make it motivational and specific.`;
25
26 const response = await openai.chat.completions.create({
27 model: "gpt-4o-mini",
28 messages: [{ role: "user", content: motivationPrompt }],

cabinAdjacentTweetsmain.tsx3 matches

@jonbo•Updated 2 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { sqlite } from "https://esm.town/v/std/sqlite";
3import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
113];
114
115const openai = new OpenAI();
116
117async function isTweetProcessed(tweetId: string): Promise<boolean> {
340 try {
341 const completion = await retryWithBackoff(() =>
342 openai.chat.completions.create({
343 model: "gpt-4o-mini",
344 messages: [

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 5 days ago

testOpenAI1 file match

@stevekrouse•Updated 1 week ago
lost1991
import { OpenAI } from "https://esm.town/v/std/openai"; export default async function(req: Request): Promise<Response> { if (req.method === "OPTIONS") { return new Response(null, { headers: { "Access-Control-Allow-Origin": "*",