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=772&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 11605 results for "api"(1053ms)

cerebras_searcherREADME.md8 matches

@stevekrouseUpdated 6 months ago
1# Cerebras Searcher
2
3a Perplexity clone that uses the SerpAPI to do RAG
4and summaries with Cerebras (*requires a SerpAPI key*)
5
6**This val might not be working because we're out of SerpAPI credits,
7but if you fork it and get your own SerpAPI key, it should work.** Comment on this
8val if you still have trouble, thanks!
9
11
121. Fork this val
132. Sign up for [Cerebras](https://cloud.cerebras.ai/) and get an API key
143. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
154. Get a [SerpAPI](https://serpapi.com/) key (free trial available)
165. Set your SerpAPI API key into you [Val Town Environment Variables](https://www.val.town/settings/environment-variables)
176. Done!
18

pluckyGreenHyenamain.tsx16 matches

@stevekrouseUpdated 6 months ago
6function App() {
7 const [messages, setMessages] = useState([]);
8 const [apiKey, setApiKey] = useState("");
9 const [generatedHtml, setGeneratedHtml] = useState("");
10 const [isLoading, setIsLoading] = useState(false);
12
13 useEffect(() => {
14 const savedApiKey = localStorage.getItem("cerebras_api_key");
15 if (savedApiKey) {
16 setApiKey(savedApiKey);
17 }
18 }, []);
19
20 const handleApiKeyChange = (e) => {
21 const newApiKey = e.target.value;
22 setApiKey(newApiKey);
23 if (newApiKey) {
24 localStorage.setItem("cerebras_api_key", newApiKey);
25 } else {
26 localStorage.removeItem("cerebras_api_key");
27 }
28 };
41 const startTime = Date.now();
42 try {
43 const client = new Cerebras({ apiKey });
44 const completionCreateResponse = await client.chat.completions.create({
45 messages: [
83 <input
84 type="password"
85 value={apiKey}
86 onChange={handleApiKeyChange}
87 className="w-full border border-gray-300 rounded-lg p-2"
88 placeholder="Enter your Cerebras API key"
89 />
90 </div>
111 placeholder="Type your instruction..."
112 required
113 disabled={!apiKey || isLoading}
114 />
115
117 type="submit"
118 className="bg-blue-500 text-white px-4 py-2 rounded-lg hover:bg-blue-600 flex-shrink-0 disabled:opacity-50"
119 disabled={!apiKey || isLoading}
120 >
121 {isLoading ? "Loading..." : "Send"}

skilledCoffeePanthermain.tsx5 matches

@gigmxUpdated 6 months ago
29 <div id="connection-status" class="text-center p-2 mb-4 hidden">
30 <span class="bg-yellow-100 bg-opacity-90 text-yellow-800 px-4 py-2 rounded-full text-sm shadow-lg">
31 ⚠️ Cannot connect to local Cheshire Cat API. Make sure it's running at http://192.168.1.95:1865
32 </span>
33 </div>
51 <script>
52 (()=>{
53 const API_URL = "http://192.168.1.95:1865";
54 const messages = [];
55 const messagesContainer = document.querySelector(".messages");
94 }
95
96 // Test API connection
97 fetch(API_URL + "/")
98 .then(response => {
99 if (!response.ok) throw new Error();
138
139 try {
140 const response = await fetch(API_URL + "/message", {
141 method: "POST",
142 headers: {

slackReplyToMessagemain.tsx3 matches

@nicotUpdated 6 months ago
17 if (body.event.type === "app_mention") {
18 const usersResponse = await fetchJSON(
19 `https://slack.com/api/usergroups.users.list?usergroup=S07S1056LN6`,
20 {
21 method: "GET",
38 // Send a message mentioning the randomly selected user
39 const result = await fetchJSON(
40 "https://slack.com/api/chat.postMessage",
41 {
42 headers: {
52 );
53
54 // Log the result of the Slack API request
55 console.log(result);
56 return new Response("Message sent", { status: 200 });

blob_adminREADME.md1 match

@esjayUpdated 6 months ago
11[![](https://stevekrouse-button.web.val.run/Install)](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
12
13It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
14
15# TODO

unpaywallmain.tsx4 matches

@yawnxyzUpdated 6 months ago
9// Unpaywall DOI access function
10async function unpaywallDOI(doi) {
11 const url = `https://api.unpaywall.org/v2/${doi}?email=${YOUR_EMAIL}`;
12 const options = {
13 method: 'GET',
33// Unpaywall search function
34async function unpaywallSearch(query, additionalParams = {}) {
35 const url = new URL('https://api.unpaywall.org/v2/search');
36 url.searchParams.append('query', query);
37 url.searchParams.append('email', YOUR_EMAIL);
81 return c.json(results);
82 } catch (error) {
83 console.error('API error:', error);
84 return c.json({ error: 'An error occurred while processing your request' }, 500);
85 }
106 return c.json(results);
107 } catch (error) {
108 console.error('API error:', error);
109 return c.json({ error: 'An error occurred while processing your request' }, 500);
110 }

modifyImageREADME.md1 match

@darefailUpdated 6 months ago
1Code from https://deno.com/blog/build-image-resizing-api
2
3Useful for compressing an image before sending to chatgpt4v, for example
1Code from https://deno.com/blog/build-image-resizing-api
2
3Useful for compressing an image before sending to chatgpt4v, for example

promptOrangeHookwormmain.tsx1 match

@rohernan76Updated 6 months ago
73async function fetchWeather() {
74 const response = await fetch(
75 'https://api.open-meteo.com/v1/forecast?latitude=40.5853&longitude=-105.0844&current_weather=true&daily=temperature_2m_max,temperature_2m_min&timezone=America%2FDenver'
76 );
77 const data = await response.json();

tomasoValmaxmain.tsx1 match

@allUpdated 6 months ago
316 <meta name="viewport" content="width=device-width, initial-scale=1.0">
317 <title>Tomaso Valmax: Token Breathing Master</title>
318 <link href="https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&family=Lora:wght@400;700&display=swap" rel="stylesheet">
319 <style>${css}</style>
320 </head>

new-val-api-21 file match

@shouserUpdated 14 hours ago
This is an example of using the API to create a val.

gptApiTemplate2 file matches

@charmaineUpdated 1 day ago
papimark21
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration