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%20%22Image%20title%22?q=openai&page=135&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 1602 results for "openai"(2339ms)

weatherGPTREADME.md1 match

@sefllessUpdated 1 year ago
1If you fork this, you'll need to set `OPENAI_API_KEY` in your [Val Town Secrets](https://www.val.town/settings/secrets).
2
3

OpenAImain.tsx9 matches

@pomdtrUpdated 1 year ago
1import { type ClientOptions, OpenAI as RawOpenAI } from "npm:openai";
2
3/**
4 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
5 */
6export class OpenAI {
7 private rawOpenAIClient: RawOpenAI;
8
9 /**
10 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
11 *
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
19 */
20 constructor(options: Omit<ClientOptions, "baseURL" | "apiKey" | "organization"> = {}) {
21 this.rawOpenAIClient = new RawOpenAI({
22 ...options,
23 baseURL: "https://std-openaiproxy.web.val.run/v1",
24 apiKey: Deno.env.get("valtown"),
25 organization: null,
28
29 get chat() {
30 return this.rawOpenAIClient.chat;
31 }
32
33 get beta() {
34 return this.rawOpenAIClient.beta;
35 }
36}

OpenAIREADME.md6 matches

@pomdtrUpdated 1 year ago
1# OpenAI
2
3Get started using OpenAI's chat completion without the need to set your own API keys.
4
5## Usage
6
7Here's a quick example to get you started with the Val Town OpenAI wrapper:
8
9```ts
10import { OpenAI } from "https://esm.town/v/std/openai";
11
12const openai = new OpenAI();
13
14const functionExpression = await openai.chat.completions.create({
15 "messages": [
16 { "role": "user", "content": "Say hello in a creative way" },

openaiREADME.md14 matches

@stdUpdated 1 year ago
1# OpenAI - [Docs ↗](https://docs.val.town/std/openai)
2
3Use OpenAI's chat completion API with [`std/openai`](https://www.val.town/v/std/openai). This integration enables access to OpenAI's language models without needing to acquire API keys.
4
5For free Val Town users, [all calls are sent to `gpt-4o-mini`](https://www.val.town/v/std/openaiproxy?v=12#L85).
6
7## Basic Usage
8
9```ts title="Example" val
10import { OpenAI } from "https://esm.town/v/std/openai";
11
12const openai = new OpenAI();
13
14const completion = await openai.chat.completions.create({
15 messages: [
16 { role: "user", content: "Say hello in a creative way" },
58## Limits
59
60While our wrapper simplifies the integration of OpenAI, there are a few limitations to keep in mind:
61
62* **Usage Quota**: We limit each user to 10 requests per minute.
65If these limits are too low, let us know! You can also get around the limitation by using your own keys:
66
671. Create your own API key on [OpenAI's website](https://platform.openai.com/api-keys)
682. Create an [environment variable](https://www.val.town/settings/environment-variables?adding=true) named `OPENAI_API_KEY`
693. Use the `OpenAI` client from `npm:openai`:
70
71```ts title="Example" val
72import { OpenAI } from "npm:openai";
73
74const openai = new OpenAI();
75```
76
77
78[📝 Edit docs](https://github.com/val-town/val-town-docs/edit/main/src/content/docs/std/openai.mdx)
79
80Migrated from folder: openai/openai

openaiproxyREADME.md3 matches

@stdUpdated 1 year ago
1# OpenAI Proxy
2
3This OpenAI API proxy injects Val Town's API keys. For usage documentation, check out https://www.val.town/v/std/openai
4
5Migrated from folder: openai/openaiproxy
4 const cheerio = await import("npm:cheerio");
5 const html = await fetchText(
6 "https://en.wikipedia.org/wiki/OpenAI",
7 );
8 const $ = cheerio.load(html);

weatherGPTmain.tsx3 matches

@dantaeyoungUpdated 1 year ago
1import { email } from "https://esm.town/v/std/email?v=11";
2import { OpenAI } from "npm:openai";
3
4let location = "brooklyn ny";
8).then(r => r.json());
9
10const openai = new OpenAI();
11let chatCompletion = await openai.chat.completions.create({
12 messages: [{
13 role: "user",

weatherGPTREADME.md1 match

@dantaeyoungUpdated 1 year ago
1If you fork this, you'll need to set `OPENAI_API_KEY` in your [Val Town Secrets](https://www.val.town/settings/secrets).
2
3

instructorExamplemain.tsx3 matches

@inkpotmonkeyUpdated 1 year ago
1import Instructor from "https://esm.sh/@instructor-ai/instructor";
2import OpenAI from "https://esm.sh/openai";
3import { z } from "https://esm.sh/zod";
4
5const openAISecrets = {
6 apiKey: getApiKey(),
7 organization: getOrganisationKey(),
8};
9
10const oai = new OpenAI(openAISecrets);
11
12const client = Instructor({

weatherGPTmain.tsx3 matches

@liaolileUpdated 1 year ago
1import { email } from "https://esm.town/v/std/email?v=11";
2import { fetch } from "https://esm.town/v/std/fetch";
3import { OpenAI } from "npm:openai";
4
5let location = "shenzhen";
9).then(r => r.json());
10
11const openai = new OpenAI();
12let chatCompletion = await openai.chat.completions.create({
13 messages: [{
14 role: "user",

translateToEnglishWithOpenAI1 file match

@shlmtUpdated 1 day ago

testOpenAI1 file match

@stevekrouseUpdated 3 days 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": "*",