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/image-url.jpg?q=openai&page=71&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 1667 results for "openai"(645ms)

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: [

steel_puppeteer_startermain.tsx6 matches

@brokencircuits•Updated 2 months ago
10 const [systemPrompt, setSystemPrompt] = useState("You are a helpful AI assistant.");
11 const [isLoading, setIsLoading] = useState(false);
12 const [model, setModel] = useState("openai");
13 const [isSystemPromptEditing, setIsSystemPromptEditing] = useState(false);
14
86 disabled={isLoading}
87 >
88 <option value="openai">GPT-4o Mini</option>
89 <option value="gemini">Gemini Pro</option>
90 <option value="mistral">Mistral 7B</option>
137 try {
138 let response;
139 if (model === "openai") {
140 const { OpenAI } = await import("https://esm.town/v/std/openai");
141 const openai = new OpenAI();
142
143 response = await openai.chat.completions.create({
144 messages: messages,
145 model: "gpt-4o-mini",

RecipeCollectorRC-Parse-Recipe3 matches

@hunterparks•Updated 2 months ago
1import { OpenAI } from 'https://esm.town/v/std/openai';
2
3const devPrompt = 'You are a recipe parsing bot. You will be given a URL to a recipe. You will provide a JSON reponse. ONLY use data available from the provided URL. Do not add extra information to the JSON. Only respond with the properly formatted JSON.';
4
5export async function parseRecipe(recipeUrl: string): any {
6 const openAi = new OpenAI();
7
8 const completion = await openAi.chat.completions.create({
9 messages: [
10 { role: 'developer', content: devPrompt },

Resume_matchermain.tsx4 matches

@Chandrakanth95•Updated 2 months ago
303 if (request.method === 'POST') {
304 try {
305 const { OpenAI } = await import("https://esm.town/v/std/openai");
306 const openai = new OpenAI();
307
308 // New PDF extraction endpoint
328
329 if (request.url.includes('/api/extract-skills')) {
330 const response = await openai.chat.completions.create({
331 model: "gpt-4o-mini",
332 messages: [
356
357 if (request.url.includes('/api/compare-skills')) {
358 const jobSkillsResponse = await openai.chat.completions.create({
359 model: "gpt-4o-mini",
360 messages: [

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 1 week 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": "*",