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/?q=api&page=924&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 11482 results for "api"(1599ms)

checkIosBingAppsmain.tsx1 match

@cescyang_service•Updated 1 year ago
6 const { default: axios } = await import("npm:axios");
7 const url =
8 "https://sapphire.api.microsoftapp.net/config/api/v1/get?setmkt=en-us&setplatform=android&setchannel=production&settenant=sapphire-bing";
9 try {
10 const response = await fetch(url, {

checkAndroidBingAppsmain.tsx1 match

@cescyang_service•Updated 1 year ago
6 const { default: axios } = await import("npm:axios");
7 const url =
8 "https://sapphire.api.microsoftapp.net/config/api/v1/get?setmkt=en-us&setplatform=android&setchannel=production&settenant=sapphire-bing";
9 try {
10 const response = await fetch(url, {

untitled_emeraldChinchillamain.tsx1 match

@tejchak•Updated 1 year ago
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();

getReplicatePredictionmain.tsx6 matches

@patrickjm•Updated 1 year ago
7export async function getReplicatePrediction({
8 /** https://replicate.com/account */
9 apiKey,
10 predictionId,
11}: {
12 apiKey: string;
13 predictionId: string;
14}) {
15 if (!apiKey) {
16 throw new Error("missing apiKey; visit https://replicate.com/account");
17 } else if (!predictionId) {
18 throw new Error("missing predictionId");
19 }
20 const result = await fetchJSON(
21 `https://api.replicate.com/v1/predictions/${encodeURIComponent(predictionId)}`,
22 {
23 headers: {
24 Authorization: `Token ${apiKey}`,
25 },
26 },

untitled_silverFowlmain.tsx1 match

@rmahshie50•Updated 1 year ago
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();

memoryApiExampleREADME.md1 match

@xkonti•Updated 1 year ago
1Migrated from folder: GPTs/memoryApiExample

subaruREADME.md1 match

@seep•Updated 1 year ago
1An API for mysubaru.com to enable remote start and stop.
2
3Requires env vars (val.town secrets) named: `SUBARU_USERNAME, SUBARU_PASSWORD, SUBARU_DEVICEID, SUBARU_VEHICLEKEY, SUBARU_PIN`. The username, password, and PIN should match your mysubaru.com credentials. The device ID and vehicle key can be found by inspecting the request body of a login network request at mysubaru.com.

memoryApiPolicyREADME.md3 matches

@xkonti•Updated 1 year ago
1Returns a simple privacy policy for the GPT Memory API.
2
3Examples of input:
4- `apiName`: `Memory API`
5- `contactEmail`: `some@email.com`
6- `lastUpdated`: `2023-11-28`
7
8Migrated from folder: GPTs/memoryApiPolicy

gptMemoryManagerREADME.md20 matches

@xkonti•Updated 1 year ago
1A simple Rest API that allows for you GPT to save and recall snippets of data (memories). You can read my blog post explaining it in detail here: [xkonti.tech](https://xkonti.tech/blog/giving-gpt-memory/)
2
3# Demonstration
7![FirstConversation.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/78c48b8b-8a1b-4caf-ef23-2ad78be3a100/public)
8
9What GPT sent do the API:
10
11```json
24# Setup
25
26There are several steps to set up the API:
27- deploy and configure the API
28- create the API key for your GPT
29- add an action for the API in you GPT
30- add prompt section to your GPT so that it can use it properly
31
32## Deploying the API on Val Town
33
34Deploy your own memory API. You can fork the following Val to do it: https://www.val.town/v/xkonti/memoryApiExample
35
36In the code configure the appropriate values:
37
38- `apiName` the name of your API - used in the Privacy Policy (eg. `Memory API`)
39- `contactEmail` - the email to provide for contact in the Privacy Policy (eg. `some@email.com`)
40- `lastPolicyUpdate` - the date the Privacy Policy was last updated (eg. `2023-11-28`)
41- `blobKeyPrefix` - the prefix for the blob storage keys used by your API - more info below (eg. `gpt:memories:`)
42- `apiKeyPrefix` - the prefix for you API Keys secrets - more info below (eg. `GPTMEMORYAPI_KEY_`)
43
44## Create API keys
45
46The Memory API is designed to serve multiple GPTs at the same time. Each GPT should have it's own unique **name** and **API key**.
47
48The **name** is used for identifying the specific GPT and appended to both:
49- `blobKeyPrefix`- to maintain separate memory storage from other GPTs
50- `apiKeyPrefix` - to maintain separate API key for each GPT
51
521. Please pick a unique alphanumeric name for your GPT. For example `personaltrainer`.
532. Generate some alphanumeric API key for your GPT. For example `Wrangle-Chapped-Monkhood4-Domain-Suspend`
543. Add a new secret to your Val.town secrets storage. The Key should be the picked name prefixed by `apiKeyPrefix`. Using the default it would be `GPTMEMORYAPI_KEY_personaltrainer`. The value of the secret should be the API key itself.
55
56The memories of the GPT will be stored in the blob storage under the key `blobKeyPrefix + name`, for example: `gpt:memories:personaltrainer`.
59
601. Add a new action in your GPT.
612. Get the OpenAPI spefication by calling the `/openapi` endpoint of your API
623. Change all `<APIURL>` instances within the specification to the url of your deployed API. For example `https://xkonti-memoryapiexample.web.val.run`
634. Set the authentication method to basic and provide a [base64 encoded](https://www.base64encode.org/) version of the `<name>:<apiKey>`. For example: `personaltrainer:Wrangle-Chapped-Monkhood4-Domain-Suspend` -> `cGVyc29uYWx0cmFpbmVyOldyYW5nbGUtQ2hhcHBlZC1Nb25raG9vZDQtRG9tYWluLVN1c3BlbmQ=`
645. Add the link to the privacy policy, which is the `/privacy` endpoint of your API. For example: `https://xkonti-memoryapiexample.web.val.run/privacy`
65
66## Adding the prompt section

untitled_lavenderWildfowlmain.tsx1 match

@aounw•Updated 1 year ago
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();

gptApiTemplate2 file matches

@charmaine•Updated 2 hours ago

mod-interview-api1 file match

@twschiller•Updated 18 hours ago
apiv1
papimark21