You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/...?q=openai&page=3&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 2315 results for "openai"(3386ms)
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { sqlite } from "https://esm.town/v/std/sqlite";
35const CACHE_SUMMARY = "manifold_summary";
6const MANIFOLD_URL = "https://api.manifold.markets/v0/markets?limit=30&sort=last-bet-time";
7const openai = new OpenAI();
89/** @param {Interval} interval */
464. Return ONLY a JSON array of these objects with no extra text. Input: ${rawJson}`;
4748// 6) Call OpenAI gpt-4o-mini
49const completion = await openai.chat.completions.create({
50model: "gpt-4o-mini",
51messages: [{ role: "user", content: prompt.trim() }],
77}
7879async function callOpenAI(messages: any[], tools: any[]) {
80const OPENAI_API_KEY = Deno.env.get("OPENAI_API_KEY");
8182const response = await fetch("https://openrouter.ai/api/v1/chat/completions", {
83method: "POST",
84headers: {
85"Authorization": `Bearer ${OPENAI_API_KEY}`,
86"Content-Type": "application/json",
87},
88body: JSON.stringify({
89model: "openai/gpt-4o",
90messages,
91tools,
143];
144145let completion = await callOpenAI(messages, tools);
146let weatherData = null;
147let locationData = null;
175}
176177completion = await callOpenAI(messages, tools);
178179if (!completion.choices[0].message.tool_calls) {