/* Copyright (C) 2025 QuantumNous This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import React, { useState, useEffect, useCallback, useRef } from 'react'; import { Link, useNavigate } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { Copy, Check, Code, Terminal, FileCode, Box, Grid3X3, Play, Trophy, PieChart, BookOpen, Search, Sun, Moon, Monitor, Languages } from 'lucide-react'; /* ================================================================== TokenDance-style Home Page Design: black/white minimal with serif headings ================================================================== */ /* ─── Hero Marquee Carousel Texts ────────────────────────── */ const CAROUSEL_TEXTS = [ 'OpenAI 协议', 'Claude 协议', 'Gemini 协议', '智能路由', '统一计费', '模型丰富', '安全可靠', '开箱即用', ]; /* ─── Hero Section ──────────────────────────────────────────── */ /* --- Helper: Theme Toggle --- */ function HomeThemeToggle() { const { t } = useTranslation(); const [open, setOpen] = useState(false); const ref = useRef(null); useEffect(() => { if (!open) return; const handler = (e) => { if (ref.current && !ref.current.contains(e.target)) setOpen(false); }; document.addEventListener("mousedown", handler); return () => document.removeEventListener("mousedown", handler); }, [open]); const theme = localStorage.getItem("theme-mode") || "auto"; const applyTheme = useCallback((val) => { const actualTheme = val === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : val; if (actualTheme === 'dark') { document.body.setAttribute('theme-mode', 'dark'); document.documentElement.classList.add('dark'); } else { document.body.removeAttribute('theme-mode'); document.documentElement.classList.remove('dark'); } }, []); const setTheme = (val) => { localStorage.setItem("theme-mode", val); applyTheme(val); setOpen(false); }; useEffect(() => { applyTheme(theme); const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); const handleChange = () => { const stored = localStorage.getItem("theme-mode") || "auto"; applyTheme(stored); }; mediaQuery.addEventListener('change', handleChange); return () => mediaQuery.removeEventListener('change', handleChange); }, [applyTheme]); const icons = { light: , dark: , auto: }; return (
{open && (
{[ { key: "light", icon: , label: t("浅色模式") }, { key: "dark", icon: , label: t("深色模式") }, { key: "auto", icon: , label: t("自动模式") }, ].map((opt) => ( ))}
)}
); } /* --- Helper: Language Selector --- */ function HomeLanguageSelector() { const { t, i18n } = useTranslation(); const [open, setOpen] = useState(false); const ref = useRef(null); useEffect(() => { if (!open) return; const handler = (e) => { if (ref.current && !ref.current.contains(e.target)) setOpen(false); }; document.addEventListener("mousedown", handler); return () => document.removeEventListener("mousedown", handler); }, [open]); const current = (i18n.language || "").startsWith("zh") ? "zh-CN" : "en"; const switchLang = (code) => { i18n.changeLanguage(code); setOpen(false); }; const langLabels = { "zh-CN": "简体中文", "en": "English" }; return (
{open && (
{Object.entries(langLabels).map(([code, label]) => ( ))}
)}
); } function HeroSection() { const { t } = useTranslation(); const [copied, setCopied] = useState(false); const navigate = useNavigate(); const copyCmd = useCallback(() => { navigator.clipboard.writeText("https://tokendance.space"); setCopied(true); setTimeout(() => setCopied(false), 1500); }, []); return (
logo TuringToken BETA
{t("登录")}

{"// unified model API gateway"}

{t("更快、更稳、更省")}
{t("Token服务平台")}

{t("兼容 OpenAI / Claude / Gemini 等协议,覆盖文本、图像、视频、语音,智能路由,统一计费。")}

{t("开始使用")} {t("查看价格")} →
terminal
              {`curl https://api.tokendance.space/v1/chat/completions \\
  -H "Authorization: Bearer \$YOUR_API_KEY" \\
  -H "Content-Type: application/json" \\
  -d '{
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "Hello"}]
  }'`}
            
{/* Hero brand wordmark — TURINGTOKEN */}
Turing Token
{/* Feature marquee strip — 轮播: OpenAI 协议 / Claude 协议 / 智能路由 ... */}
{[...CAROUSEL_TEXTS, ...CAROUSEL_TEXTS].map((text, i) => ( {text} ))}
); }const FEATURES = [ { titleKey: '多协议兼容', descKey: '原生支持 OpenAI、Claude、Gemini 文本协议,覆盖图像 / 视频 / 文本转语音生成。无需修改代码,切换 Base URL 即可接入。', code: 'baseURL: "api.tokendance.space"', }, { titleKey: '智能路由', descKey: '根据模型名称自动路由至对应供应商。一个入口,无需关心底层调度。', code: 'route(model) → provider', }, { titleKey: '统一计费', descKey: '跨供应商统一 Token 消耗统计与账单。告别多平台分别充值的混乱。', code: 'billing.unified()', }, { titleKey: '容错降级', descKey: '同一模型支持多供应商端点自动切换;单次请求可指定多个候选模型,逐级降级,保障服务持续可用。', code: 'fallback: model[] → provider[]', }, { titleKey: '模型丰富', descKey: '接入 MiniMax、通义千问、Kimi、智谱、DeepSeek 等国内头部模型。持续扩展中。', code: 'models.list() → 80+', }, { titleKey: '开箱即用', descKey: '一键登录,分钟级接入。兼容现有 SDK,零迁移成本。', code: 'import OpenAI from "openai"', }, ]; function FeaturesSection() { const { t } = useTranslation(); return (

{/* features */}

{t('为接入 AI 模型的开发者而造。')}

{FEATURES.map((f, i) => (
{f.code}

{t(f.titleKey)}

{t(f.descKey)}

))}
); } /* ─── How It Works Section ──────────────────────────────────── */ const STEPS = [ { step: '01', titleKey: '注册账号', descKey: '通过邮箱一键注册,即刻开始使用。', link: '/register', }, { step: '02', titleKey: '创建 API Key', descKey: '在控制台创建密钥,支持多 Key 管理与权限控制。', link: '/console/token', }, { step: '03', titleKey: '发起请求', descKey: '使用你熟悉的 SDK 调用任意模型,完全兼容原生协议。', link: '/pricing', }, ]; function HowItWorksSection() { const { t } = useTranslation(); return (
{'// how it works'}

{t('三步接入,分钟级上线')}

{STEPS.map((s, i) => (
{s.step}

{t(s.titleKey)}

{t(s.descKey)}

))}
); } /* ─── Quick Start Section (Code Tabs) ───────────────────────── */ const PROVIDERS = ['openai', 'claude', 'gemini']; const PROVIDER_LABELS = { openai: 'OpenAI', claude: 'Claude', gemini: 'Gemini' }; const LANGUAGES = ['curl', 'python', 'nodejs']; const LANG_LABELS = { curl: 'cURL', python: 'Python', nodejs: 'Node.js' }; const CODE_SAMPLES = { openai: { curl: `curl https://api.tokendance.space/v1/chat/completions \\ -H "Authorization: Bearer $OPENAI_API_KEY" \\ -H "Content-Type: application/json" \\ -d '{ "model": "gpt-4o", "messages": [{"role": "user", "content": "Hello!"}] }'`, python: `from openai import OpenAI client = OpenAI( base_url="https://api.tokendance.space", api_key="sk-your-key" ) response = client.chat.completions.create( model="gpt-4o", messages=[{"role": "user", "content": "Hello!"}] ) print(response.choices[0].message.content)`, nodejs: `import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.tokendance.space", apiKey: "sk-your-key", }); const response = await client.chat.completions.create({ model: "gpt-4o", messages: [{ role: "user", content: "Hello!" }], }); console.log(response.choices[0].message.content);`, }, claude: { curl: `curl https://api.tokendance.space/v1/messages \\ -H "x-api-key: sk-your-key" \\ -H "anthropic-version: 2023-06-01" \\ -H "Content-Type: application/json" \\ -d '{ "model": "claude-sonnet-4-20250514", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello!"}] }'`, python: `import anthropic client = anthropic.Anthropic( base_url="https://api.tokendance.space", api_key="sk-your-key" ) response = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[{"role": "user", "content": "Hello!"}] ) print(response.content[0].text)`, nodejs: `import Anthropic from "@anthropic-ai/sdk"; const client = new Anthropic({ baseURL: "https://api.tokendance.space", apiKey: "sk-your-key", }); const response = await client.messages.create({ model: "claude-sonnet-4-20250514", max_tokens: 1024, messages: [{ role: "user", content: "Hello!" }], }); console.log(response.content[0].text);`, }, gemini: { curl: `curl "https://api.tokendance.space/v1beta/models/gemini-2.0-flash:generateContent?key=sk-your-key" \\ -H "Content-Type: application/json" \\ -d '{ "contents": [{"parts":[{"text": "Hello!"}]}] }'`, python: `import google.generativeai as genai genai.configure(api_key="sk-your-key") model = genai.GenerativeModel("gemini-2.0-flash") response = model.generate_content("Hello!") print(response.text)`, nodejs: `import { GoogleGenerativeAI } from "@google/generative-ai"; const genAI = new GoogleGenerativeAI("sk-your-key"); const model = genAI.getGenerativeModel({ model: "gemini-2.0-flash", }); const result = await model.generateContent("Hello!"); console.log(result.response.text());`, }, }; function QuickStartSection() { const { t } = useTranslation(); const [provider, setProvider] = useState('openai'); const [lang, setLang] = useState('curl'); const [copied, setCopied] = useState(false); const code = CODE_SAMPLES[provider]?.[lang] || ''; const handleCopy = useCallback(() => { navigator.clipboard.writeText(code); setCopied(true); setTimeout(() => setCopied(false), 1500); }, [code]); return (

Quick Start

{t('快速开始')}

{/* Provider tabs */}
{PROVIDERS.map((p) => ( ))}
{/* Code block */}
{LANGUAGES.map((l) => ( ))}
              {code}
            
{/* Call to docs */}

Model Pricing

{t('查看模型定价,了解完整列表')}

); } /* ─── Pricing / CTA Section ──────────────────────────────────── */ function PricingSection() { const { t } = useTranslation(); return (
{'// pricing'}

{t('获取 Token 额度')}

{/* Token credit callout */}
{t('今日特惠')} {t('注册即送 ¥10 额度')}
{t('新用户注册即赠 ¥10 Token,7 天有效期')}
{/* Call to action */}

{t('立即注册,开始使用')}

{t( '兼容 OpenAI / Claude / Gemini 协议。一个 API Key,调用所有主流模型。免去多平台充值与管理的麻烦。' )}

{t('免费注册')} →
); } /* ─── Providers Marquee Section ──────────────────────────────── */ const PROVIDER_LOGOS = [ { name: 'OpenAI', className: 'opacity-60' }, { name: 'Claude', className: 'opacity-60' }, { name: 'Gemini', className: 'opacity-60' }, { name: 'DeepSeek', className: 'opacity-60' }, { name: 'Qwen', className: 'opacity-60' }, { name: 'MiniMax', className: 'opacity-60' }, { name: 'Kimi', className: 'opacity-60' }, { name: '智谱', className: 'opacity-60' }, { name: 'Groq', className: 'opacity-60' }, { name: 'Azure', className: 'opacity-60' }, ]; function ProvidersSection() { const { t } = useTranslation(); const navigate = useNavigate(); return (
{/* Provider logos marquee area */}

{'// supported providers'}

{t('40+ AI 供应商,统一接入')}

{[...PROVIDER_LOGOS, ...PROVIDER_LOGOS].map((logo, i) => ( {logo.name} ))}

{t('免费注册,分钟级接入。兼容你现有的 SDK 和工作流。')}

); } /* ─── Dark Footer ────────────────────────────────────────────── */ function DarkFooter() { const { t } = useTranslation(); return (
{t('定价')} {t('控制台')}
© 2026 TokenFactory
); } /* ─── Main Home Page ────────────────────────────────────────── */ const Home = () => { const { t } = useTranslation(); return (
); }; export default Home;