Gemini-2-5-Pro-O-01main.tsx28 matches
19provider: "google",
20model: "gemini-2.5-pro",
21endpoint: "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent",
22headers: {
23"Content-Type": "application/json",
28provider: "google",
29model: "gemini-1.5-flash",
30endpoint: "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent",
31headers: {
32"Content-Type": "application/json",
37provider: "google",
38model: "models/gemini-2.5-pro",
39endpoint: "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent",
40headers: {
41"Content-Type": "application/json",
77};
7879const POE_API_KEYS = [
80process.env.POE_API_KEY,
81process.env.POE_API_KEY2,
82process.env.POE_API_KEY3,
83].filter(Boolean);
849091const providedKey = req.headers.get("Authorization")?.replace("Bearer ", "") ||
92req.headers.get("X-API-Key") ||
93req.headers.get("X-Bot-Access-Key");
9496return {
97isValid: false,
98error: "Missing authentication. Please provide BOT_ACCESS_KEY in Authorization header, X-API-Key header, or X-Bot-Access-Key header."
99};
100}
110}
111112function createPoeClient(apiKey: string): OpenAI {
113return new OpenAI({
114apiKey: apiKey || "YOUR_POE_API_KEY",
115baseURL: "https://api.poe.com/v1",
116});
117}
127model: string,
128prompt: string,
129apiKeyIndex: number,
130taskType: string,
131timeout: number = 15000,
133): Promise<string | null> {
134try {
135const apiKey = POE_API_KEYS[apiKeyIndex];
136const poeClient = createPoeClient(apiKey);
137
138const maxTokens = selectOptimalTokens(prompt.length, taskType);
164return content && content.trim().length > 0 ? content : null;
165} catch (error) {
166console.error(`Model ${model} failed with API key ${apiKeyIndex + 1}:`, error.message);
167return null;
168}
184const promises: Promise<{result: string | null, model: string, keyIndex: number}>[] = [];
185
186for (let keyIndex = 0; keyIndex < Math.min(POE_API_KEYS.length, 2); keyIndex++) {
187for (const model of parallelModels) {
188promises.push(
201202if (successful) {
203console.log(`Success with ${successful.value.model} (API key ${successful.value.keyIndex + 1})`);
204
205if (isImageGeneration) {
231console.log("Trying remaining models sequentially...");
232for (const model of remainingModels) {
233for (let keyIndex = 0; keyIndex < POE_API_KEYS.length; keyIndex++) {
234const result = await callSinglePoeModel(model, prompt, keyIndex, taskType, timeout, isImageGeneration);
235if (result) {
276}
277278async function callGeminiApi(
279config: ModelConfig,
280prompt: string,
308};
309310const url = `${config.endpoint}?key=${process.env.GEMINI_API_KEY}`;
311const response = await fetch(url, {
312method: "POST",
318if (!response.ok) {
319const errorText = await response.text();
320throw new Error(`${config.model} API error: ${response.status} - ${errorText}`);
321}
322371
372if (shouldUseFast) {
373const flashResult = await callGeminiApi(GEMINI_FLASH_CONFIG, prompt, send, "Text Generation");
374if (flashResult) return;
375} else {
376// For complex queries, try Gemini Pro first
377const proResult = await callGeminiApi(GEMINI_PRO_CONFIG, prompt, send, "Text Generation");
378if (proResult) return;
379}
416417// Try fast model first for file analysis
418const flashResult = await callGeminiApi(GEMINI_FLASH_CONFIG, analysisPrompt, send, "File Analysis");
419if (flashResult) return;
420447448// Try Gemini Pro with vision first
449const geminiResult = await callGeminiApi(GEMINI_VISION_CONFIG, analysisPrompt, send, "Image Analysis", imageUrl);
450if (geminiResult) return;
451484if (!poeResult) {
485// Fallback to Gemini Flash for search
486const geminiResult = await callGeminiApi(GEMINI_FLASH_CONFIG, searchPrompt, send, "Web Search");
487if (!geminiResult) {
488send("error", {
733headers: {
734"Content-Type": "application/json",
735"WWW-Authenticate": "Bearer realm=\"Bot API\"",
736},
737});
Gemini-2-5-Pro-O-02main.tsx28 matches
19provider: "google",
20model: "gemini-2.5-pro",
21endpoint: "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent",
22headers: {
23"Content-Type": "application/json",
28provider: "google",
29model: "gemini-1.5-flash",
30endpoint: "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent",
31headers: {
32"Content-Type": "application/json",
37provider: "google",
38model: "models/gemini-2.5-pro",
39endpoint: "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent",
40headers: {
41"Content-Type": "application/json",
77};
7879const POE_API_KEYS = [
80process.env.POE_API_KEY,
81process.env.POE_API_KEY2,
82process.env.POE_API_KEY3,
83].filter(Boolean);
849091const providedKey = req.headers.get("Authorization")?.replace("Bearer ", "") ||
92req.headers.get("X-API-Key") ||
93req.headers.get("X-Bot-Access-Key");
9496return {
97isValid: false,
98error: "Missing authentication. Please provide BOT_ACCESS_KEY in Authorization header, X-API-Key header, or X-Bot-Access-Key header."
99};
100}
110}
111112function createPoeClient(apiKey: string): OpenAI {
113return new OpenAI({
114apiKey: apiKey || "YOUR_POE_API_KEY",
115baseURL: "https://api.poe.com/v1",
116});
117}
127model: string,
128prompt: string,
129apiKeyIndex: number,
130taskType: string,
131timeout: number = 15000,
133): Promise<string | null> {
134try {
135const apiKey = POE_API_KEYS[apiKeyIndex];
136const poeClient = createPoeClient(apiKey);
137
138const maxTokens = selectOptimalTokens(prompt.length, taskType);
164return content && content.trim().length > 0 ? content : null;
165} catch (error) {
166console.error(`Model ${model} failed with API key ${apiKeyIndex + 1}:`, error.message);
167return null;
168}
184const promises: Promise<{result: string | null, model: string, keyIndex: number}>[] = [];
185
186for (let keyIndex = 0; keyIndex < Math.min(POE_API_KEYS.length, 2); keyIndex++) {
187for (const model of parallelModels) {
188promises.push(
201202if (successful) {
203console.log(`Success with ${successful.value.model} (API key ${successful.value.keyIndex + 1})`);
204
205if (isImageGeneration) {
231console.log("Trying remaining models sequentially...");
232for (const model of remainingModels) {
233for (let keyIndex = 0; keyIndex < POE_API_KEYS.length; keyIndex++) {
234const result = await callSinglePoeModel(model, prompt, keyIndex, taskType, timeout, isImageGeneration);
235if (result) {
276}
277278async function callGeminiApi(
279config: ModelConfig,
280prompt: string,
308};
309310const url = `${config.endpoint}?key=${process.env.GEMINI_API_KEY}`;
311const response = await fetch(url, {
312method: "POST",
318if (!response.ok) {
319const errorText = await response.text();
320throw new Error(`${config.model} API error: ${response.status} - ${errorText}`);
321}
322371
372if (shouldUseFast) {
373const flashResult = await callGeminiApi(GEMINI_FLASH_CONFIG, prompt, send, "Text Generation");
374if (flashResult) return;
375} else {
376// For complex queries, try Gemini Pro first
377const proResult = await callGeminiApi(GEMINI_PRO_CONFIG, prompt, send, "Text Generation");
378if (proResult) return;
379}
416417// Try fast model first for file analysis
418const flashResult = await callGeminiApi(GEMINI_FLASH_CONFIG, analysisPrompt, send, "File Analysis");
419if (flashResult) return;
420447448// Try Gemini Pro with vision first
449const geminiResult = await callGeminiApi(GEMINI_VISION_CONFIG, analysisPrompt, send, "Image Analysis", imageUrl);
450if (geminiResult) return;
451484if (!poeResult) {
485// Fallback to Gemini Flash for search
486const geminiResult = await callGeminiApi(GEMINI_FLASH_CONFIG, searchPrompt, send, "Web Search");
487if (!geminiResult) {
488send("error", {
733headers: {
734"Content-Type": "application/json",
735"WWW-Authenticate": "Bearer realm=\"Bot API\"",
736},
737});
103<div className="">âś· Farcaster mini app manifest + webhook + embed metadata</div>
104<div className="">âś· Farcaster notifications (storing tokens, sending recurring notifications, ...)</div>
105<div className="">âś· Neynar API integration for Farcaster data</div>
106<div className="">âś· Hosted on Val Town (instant deployments on save)</div>
107<div className="">
SonarSearchScreen.tsx1 match
64onChange={(e) => setQuery(e.target.value)}
65placeholder="@user, fid:123, /channel, cast hash"
66// autoCapitalize="on"
67// autoCorrect="on"
68type="text"
dotcomGoogol.tsx1 match
161<em>do you want a domain for your cool new app?</em>{" "}
162Regardless of where someone prefers to (vibe) code, registrars can meet
163people where they are (e.g., by selling domains through an API or MCP
164server). That’s not wholly a new idea—Squarespace is a website builder
165after all—but it might be a bigger opportunity now.
25}
2627// const resend = new Resend(Deno.env.get("RESEND_API_KEY"));
2829// const { data, error } = await resend.emails.send({
222});
223224// API endpoint to get current OAuth status
225app.get("/oauth/status", (c) => {
226// In production, check actual token storage
12701271// RTMS Analysis Configuration
1272const OPENROUTER_API_KEY = Deno.env.get("OPENROUTER_API_KEY");
1273const OPENROUTER_MODEL = Deno.env.get("OPENROUTER_MODEL") || "meta-llama/llama-3.2-3b-instruct:free";
12741285const analysisClients = new Set();
12861287// OpenRouter API helper for trait analysis
1288async function analyzeTraitsWithOpenRouter(text) {
1289if (!OPENROUTER_API_KEY) {
1290console.warn("⚠️ OPENROUTER_API_KEY not set - skipping trait analysis");
1291return { Curiosity: 0, Empathy: 0, Assertiveness: 0, Creativity: 0, Analytical: 0 };
1292}
13191320try {
1321const response = await fetch('https://openrouter.ai/api/v1/chat/completions', {
1322method: 'POST',
1323headers: {
1324'Authorization': `Bearer ${OPENROUTER_API_KEY}`,
1325'Content-Type': 'application/json',
1326'HTTP-Referer': 'https://val.town',
13351336if (!response.ok) {
1337throw new Error(`OpenRouter API error: ${response.status}`);
1338}
133915171518<div class="status">
1519<strong>Status:</strong> ${OPENROUTER_API_KEY ? 'API Connected' : 'API Key Missing'}
1520<br>
1521<strong>WebSocket Clients:</strong> <span id="clientCount">0</span>
1const baseUrl = 'https://sonar.val.run/neynar-proxy?path='
2// const baseUrl = "https://api.neynar.com/v2/farcaster/";
34export async function fetchNeynarGet(path: string) {
8'Content-Type': 'application/json',
9'x-neynar-experimental': 'true',
10'x-api-key': 'NEYNAR_API_DOCS',
11},
12})
location-feed-generatorcheckins.ts8 matches
1// Checkin creation API endpoint for Anchor
2import type { Context } from "jsr:@hono/hono@4.9.6";
3import { OverpassService } from "../services/overpass-service.ts";
17*/
18/**
19* Convert API PlaceInput to proper Place object
20*/
21function _sanitizePlaceInput(input: PlaceInput): Place {
123}
124125// API input format - coordinates might be strings
126interface PlaceInput {
127name: string;
129longitude: number | string;
130tags: Record<string, string>;
131// Optional fields that might be missing from API input
132id?: string;
133elementType?: "node" | "way" | "relation";
237const { message } = body;
238239// Convert API input to proper Place object and validate coordinates
240const place = _sanitizePlaceInput(body.place);
241const lat = place.latitude;
255console.log("🚀 Starting checkin creation process...");
256257// Get sessions instance for clean OAuth API access
258const { sessions } = await import("../routes/oauth.ts");
259295}
296297// Create address and checkin records via AT Protocol using clean OAuth API
298async function createAddressAndCheckin(
299sessions: OAuthSessionsInterface,
307console.log(`đź”° Getting OAuth session for DID: ${did}`);
308309// Use the clean API to get a ready-to-use OAuth session
310const oauthSession = await sessions.getOAuthSession(did);
311if (!oauthSession) {
9"Bash(/Users/tijs/projects/Anchor/location-feed-generator/scripts/test.sh:*)",
10"Bash(./scripts/test.sh:*)",
11"Bash(./scripts/test-api.sh:*)",
12"Bash(vt list:*)",
13"Bash(vt browse:*)",
14"Bash(ls:*)",
15"Bash(./scripts/monitor-api.sh:*)",
16"Bash(swift test:*)",
17"Bash(swift build:*)",