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=120&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 11716 results for "api"(1521ms)

medmain.tsx3 matches

@salonUpdated 1 week ago
117 const finalSys = sysPrompt + `\n\nREMINDER: Info only, not medical advice. Verify & use clinical judgment.`;
118 try {
119 const oa = new OpenAI(); // Assumes API key is set in environment
120 const completion = await oa.chat.completions.create({
121 model: "gpt-4o-mini", // Use appropriate model
130 } catch (err: any) {
131 const errD = { msg: err.message, name: err.name, status: err.status, type: err.type, code: err.code };
132 log("ERROR", "LLM", `OpenAI API task ${tid} failed`, { error: errD }, mid, tid);
133 throw new Error(`OpenAI API error: ${err.message}${err.code ? ` (Code: ${err.code})` : ''}`);
134 }
135}
12 },
13 {
14 prompt: "weather dashboard for nyc using open-meteo API for NYC with icons",
15 title: "Weather App",
16 code:

shiningChocolateBaboonmain.tsx1 match

@SanketG007Updated 1 week ago
12 },
13 {
14 prompt: "weather dashboard for nyc using open-meteo API for NYC with icons",
15 title: "Weather App",
16 code:

cerebras_coder_promptsmain.tsx1 match

@SanketG007Updated 1 week ago
12 },
13 {
14 prompt: "weather dashboard for nyc using open-meteo API for NYC with icons",
15 title: "Weather App",
16 code:

STARTER_PROMPTSmain.tsx1 match

@SanketG007Updated 1 week ago
12 },
13 {
14 prompt: "weather dashboard for nyc using open-meteo API for NYC with icons",
15 title: "Weather App",
16 code:

svcmain.tsx6 matches

@salonUpdated 1 week ago
46 setProfileError(null);
47 try {
48 const response = await fetch("/api/profile");
49 if (response.status === 404) {
50 setProfile(null);
98 setStrategyError(null);
99 try {
100 const response = await fetch("/api/profile", {
101 method: "POST",
102 headers: { "Content-Type": "application/json" },
128 try {
129 // Use POST to trigger generation, profile is fetched server-side
130 const response = await fetch("/api/generate-strategy", { method: "POST" });
131 const data = await response.json();
132 if (!response.ok) {
410 const url = new URL(request.url);
411
412 // --- API Route Handling ---
413 if (url.pathname === "/api/profile") {
414 // GET Profile (Select new fields)
415 if (request.method === "GET") {
475
476 // --- Generate Strategy Route ---
477 if (url.pathname === "/api/generate-strategy" && request.method === "POST") {
478 let profile: any = null;
479 // 1. Fetch the enhanced profile

business_finder_productionmain.tsx14 matches

@runUpdated 1 week ago
44}
45
46// Função para buscar empresas reais usando a API do Google Places
47async function buscarEmpresasReais(endereco, tipo) {
48 try {
78async function geocodificarEndereco(endereco) {
79 try {
80 // Usando a API de Geocodificação do Google
81 const url = `https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(endereco)}&key=YOUR_GOOGLE_API_KEY`;
82
83 // Como não temos uma chave real da API do Google, vamos simular a resposta
84 // Em produção, você usaria uma chave real e faria a requisição
85
124}
125
126// Função para buscar empresas próximas usando a API do Google Places
127async function buscarEmpresasProximas(coordenadas, tipo) {
128 try {
129 // Em produção, você usaria a API do Google Places
130 // const url = `https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=${coordenadas.lat},${coordenadas.lng}&radius=5000&type=${encodeURIComponent(tipo)}&language=pt-BR&key=YOUR_GOOGLE_API_KEY`;
131
132 // Como não temos uma chave real da API do Google, vamos gerar dados realistas
133 const tiposDeNegocio = {
134 "restaurante": [
235}
236
237// Função para buscar detalhes de uma empresa usando a API do Google Places
238async function buscarDetalhesEmpresa(placeId) {
239 try {
240 // Em produção, você usaria a API do Google Places
241 // const url = `https://maps.googleapis.com/maps/api/place/details/json?place_id=${placeId}&fields=name,formatted_address,formatted_phone_number,website,opening_hours,rating,reviews,price_level,photos&language=pt-BR&key=YOUR_GOOGLE_API_KEY`;
242
243 // Como não temos uma chave real da API do Google, vamos gerar dados realistas
244
245 // Gerar horários de funcionamento realistas
755
756 <div class="map-container" id="map-${empresa.place_id}">
757 <img src="https://maps.googleapis.com/maps/api/staticmap?center=${empresa.latitude},${empresa.longitude}&zoom=15&size=400x200&markers=color:red%7C${empresa.latitude},${empresa.longitude}&key=YOUR_GOOGLE_API_KEY"
758 alt="Mapa de localização"
759 style="width:100%; height:100%; object-fit:cover;"
949 geoButton.addEventListener('click', function() {
950 navigator.geolocation.getCurrentPosition(function(position) {
951 // Em um ambiente real, você usaria uma API de geocodificação reversa
952 // para converter coordenadas em endereço
953 const lat = position.coords.latitude;

business_findermain.tsx4 matches

@runUpdated 1 week ago
11
12 // Aqui simulamos a busca de empresas baseada no endereço e tipo
13 // Em uma implementação real, você usaria uma API como Google Places ou similar
14 const empresas = await buscarEmpresas(endereco, tipo);
15
46
47// Função para simular a busca de empresas
48// Em uma implementação real, você usaria uma API como Google Places
49async function buscarEmpresas(endereco, tipo) {
50 // Simulação de dados para demonstração
51 // Em um ambiente real, você faria uma chamada para uma API externa
52
53 // Aguarda um pouco para simular o tempo de busca
643 geoButton.addEventListener('click', function() {
644 navigator.geolocation.getCurrentPosition(function(position) {
645 // Em um ambiente real, você usaria uma API de geocodificação reversa
646 // para converter coordenadas em endereço
647 enderecoInput.value = 'Localização atual';

mohitkingsprojectmain.tsx3 matches

@MkvUpdated 1 week ago
92 async function fetchCurrencyRates() {
93 try {
94 const response = await fetch("https://open.exchangerate-api.com/v6/latest");
95 const data = await response.json();
96 setCurrencyRates(data.rates);
108 setLoading(true);
109 const response = await fetch(
110 "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=10&page=1&sparkline=false",
111 );
112 const data = await response.json();
152 try {
153 const response = await fetch(
154 `https://api.coingecko.com/api/v3/coins/${coinId}/market_chart?vs_currency=usd&days=${days}`,
155 );
156 const data = await response.json();

valProfilePageREADME.md4 matches

@dcm31Updated 1 week ago
64- Hono (server-side)
65- Tailwind CSS (styling)
66- Uses the Charlie's User Search API for fetching user val data
67- Uses Val Town's profile picture proxy for user avatars
68
69## API Integration
70
71The app integrates with two main APIs:
72
731. Charlie's User Search API: `https://charliesusersearch.val.run/?user=USERNAME`
742. Val Town Profile Pic Proxy: `https://pic.val.run/USERNAME`
75

gpt-image-test

@CaptainJackUpdated 5 hours ago
测试 gpt image 的不同 api 能否满足图片生成要求

new-val-api-21 file match

@shouserUpdated 1 day ago
This is an example of using the API to create a val.
apiv1
papimark21