Spaces:
Running
Running
| /** | |
| * Single source of shared config for every MesmerTools HuggingFace Space. | |
| * Authored once here and imported by all spaces so nothing is duplicated. | |
| * | |
| * Data that changes often (TTS voices, benchmark runs) is NOT hardcoded — it is | |
| * fetched at runtime from generated JSON on mesmer.tools (see DATA) so the spaces | |
| * always reflect the canonical constants in the main repo. | |
| */ | |
| export const SITE = { | |
| name: "MesmerTools", | |
| origin: "https://mesmer.tools", | |
| cdn: "https://cdn.mesmer.tools", | |
| tagline: "Free developer & AI tools.", | |
| }; | |
| /** | |
| * Per-endpoint contract. | |
| * `freeLimitPerHour` is the per-IP free cap the API enforces (null = no hard | |
| * hourly cap). Because each space calls the API directly from the visitor's | |
| * browser, this limit is per-user — every HuggingFace visitor gets their own | |
| * bucket. On a 429 the space points users at `fullToolPath` for higher limits. | |
| */ | |
| export const ENDPOINTS = { | |
| screenshot: { | |
| apiPath: "/api/v1/screenshot", | |
| method: "GET", | |
| freeLimitPerHour: 10, | |
| fullToolPath: "/api-tools/screenshot", | |
| }, | |
| siteLogo: { | |
| apiPath: "/api/v1/site-logo", | |
| method: "GET", | |
| freeLimitPerHour: null, // cached server-side; no hard hourly cap | |
| fullToolPath: "/api-tools/site-logo", | |
| }, | |
| tts: { | |
| apiPath: "/api/v1/tts", | |
| method: "POST", | |
| freeLimitPerHour: 20, | |
| fullToolPath: "/api-tools/tts", | |
| }, | |
| logo: { | |
| trpcPath: "/api/trpc/logo.generate", | |
| method: "POST", | |
| freeLimitPerHour: 10, | |
| fullToolPath: "/free-tools/ai-logo-maker", | |
| }, | |
| benchmark: { | |
| fullToolPath: "/benchmarks/ai-video-generation", | |
| }, | |
| }; | |
| /** | |
| * Live data endpoints. These serve JSON straight from the canonical constants | |
| * in the main repo (no generated snapshot, no build step) so the spaces always | |
| * reflect the current voices / benchmark dict. Edge-cached for an hour. | |
| */ | |
| export const DATA = { | |
| ttsVoices: `${SITE.origin}/api/v1/tts/voices`, | |
| videoBenchmark: `${SITE.origin}/api/v1/benchmarks/ai-video-generation`, | |
| }; | |
| /** | |
| * Cross-sell catalog shown in the footer strip of every space. These are the | |
| * SEO backlinks to mesmer.tools. `key` matches ENDPOINTS keys so a space can | |
| * exclude itself from its own strip. | |
| */ | |
| export const TOOL_CATALOG = [ | |
| { key: "logo", emoji: "🎨", name: "AI Logo Maker", desc: "Generate a brand logo from a prompt.", path: "/free-tools/ai-logo-maker" }, | |
| { key: "tts", emoji: "🔊", name: "Text to Speech", desc: "Natural AI voices, free.", path: "/api-tools/tts" }, | |
| { key: "screenshot", emoji: "📸", name: "Screenshot API", desc: "Capture any URL as an image.", path: "/api-tools/screenshot" }, | |
| { key: "siteLogo", emoji: "🏷️", name: "Site Logo / Favicon", desc: "Fetch any website's logo.", path: "/api-tools/site-logo" }, | |
| { key: "music", emoji: "🎵", name: "AI Music Maker", desc: "Generate short music clips.", path: "/free-tools/ai-music-maker" }, | |
| { key: "tokens", emoji: "🧮", name: "Token Price Calculator", desc: "Estimate LLM API costs.", path: "/free-tools/token-price-calculator" }, | |
| { key: "json", emoji: "{ }", name: "JSON Formatter", desc: "Format & validate JSON.", path: "/free-tools/json-formatter" }, | |
| { key: "synthid", emoji: "🔍", name: "Detect SynthID", desc: "Check images for AI watermarks.", path: "/free-tools/detect-synthid" }, | |
| { key: "benchmark", emoji: "🏁", name: "AI Video Benchmark", desc: "Which LLM codes the best video?", path: "/benchmarks/ai-video-generation" }, | |
| ]; | |
| /** Absolute mesmer.tools URL for a path. */ | |
| export function siteUrl(path) { | |
| return `${SITE.origin}${path}`; | |
| } | |