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/$%7Bsuccess?q=api&page=1008&format=json

For typeahead suggestions, use the /typeahead endpoint:

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

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

Found 11875 results for "api"(1302ms)

openAiTextCompletionmain.tsx8 matches

@patrickjm•Updated 1 year ago
2
3export let openAiTextCompletion = async (params: {
4 /** https://beta.openai.com/account/api-keys */
5 apiKey: string,
6 /** Optional. https://beta.openai.com/account/org-settings */
7 org?: string,
8
9 // REST args, see https://beta.openai.com/docs/api-reference/completions/create
10 prompt: string,
11 model?: string,
25 user?: string,
26}) => {
27 if (!params.apiKey) {
28 throw new Error(
29 "Please provide 'apiKey' param. See: https://beta.openai.com/account/api-keys "
30 );
31 }
32 const { apiKey, org, ...args } = params;
33 args.stream = false;
34
35 const response = await fetchJSON("https://api.openai.com/v1/completions", {
36 method: "POST",
37 headers: {
38 Authorization: `Bearer ${params.apiKey}`,
39 ...(params.org ? { "OpenAI-Organization": params.org } : {}),
40 },

timemain.tsx1 match

@vs•Updated 1 year ago
3export async function time() {
4 return await fetchJSON(
5 "https://api.openaq.org/v2/latest?" +
6 new URLSearchParams({
7 limit: "10",

githubFollowersmain.tsx1 match

@rym•Updated 1 year ago
3// GitHub followers
4export let githubFollowers = fetchJSON(
5 "https://api.github.com/users/stevekrouse/followers"
6);

getTangleCommentsmain.tsx1 match

@willthereader•Updated 1 year ago
4export async function getTangleComments({ lastRunAt }) {
5 let response = await fetch(
6 "https://www.readtangle.com/members/api/comments/?limit=5&order=created_at%20DESC%2C%20id%20DESC&filter=post_id%3A6525827c68f969000134e052%2Bcreated_at%3A%3C%3D2023-10-13T20%3A55%3A23.163Z&page=2",
7 );
8 let commentsData = await response.json();

myApimain.tsx1 match

@hafifuyku•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

myApimain.tsx1 match

@zzz•Updated 1 year ago
1export function myApi(name) {
2 name = name || "Guest";
3 return `Hello, ${name}`;

untitled_rt2wovqomain.tsx1 match

@zachnusbaum•Updated 1 year ago
1export const untitled_rt2wovqo = (async () => {
2 function myApi(name) {
3 return "hi " + name;
4 console.email("hi");

getVectorStoreBuildermain.tsx1 match

@webup•Updated 1 year ago
31 const client = new PineconeClient();
32 await client.init({
33 apiKey: process.env.PINECONE,
34 environment: "asia-southeast1-gcp-free",
35 });

completemain.tsx4 matches

@webup•Updated 1 year ago
2
3export const complete = async (prompt: string | object, options = {}) => {
4 // Initialize OpenAI API stub
5 const { Configuration, OpenAIApi } = await import("https://esm.sh/openai");
6 const configuration = new Configuration({
7 apiKey: process.env.OPENAI,
8 });
9 const openai = new OpenAIApi(configuration);
10 // Request chat completion
11 const completion = await openai.createCompletion({

parserSampleJSONmain.tsx1 match

@webup•Updated 1 year ago
21 const model = await builder();
22 const input = await prompt.format({
23 question: "What is the capital of France?",
24 });
25 const response = await model.call(input);

social_data_api_project3 file matches

@tsuchi_ya•Updated 7 hours ago

simple-scrabble-api1 file match

@bry•Updated 1 day ago
apiv1
papimark21