sovapi-arena / index.html
ybrault's picture
Correct Arena pricing, sharing and Alibaba model
933b40c verified
Raw History Blame Contribute Delete
96 kB
<!doctype html> <html lang="en" data-theme="light"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>SovAPI Arena</title> <link rel="preconnect" href="https://api.sovinfra.ai" crossorigin /> <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='6' fill='%230b1620'/%3E%3Ctext x='16' y='22' font-size='18' text-anchor='middle' fill='%23ff7a1a' font-family='Arial'%3ES%3C/text%3E%3C/svg%3E" /> <script> try { const savedTheme = localStorage.getItem("sovapi.theme"); if (savedTheme === "light" || savedTheme === "dark") { document.documentElement.dataset.theme = savedTheme; } } catch (_error) { // Storage can be unavailable in private or embedded browser contexts. } </script> <style> :root { color-scheme: light; --paper: #f3eadc; --paper-deep: #e7d8c3; --panel: #fff8ec; --panel-strong: #f7e5ce; --ink: #15110d; --muted: #6f6255; --line: #201812; --line-soft: rgba(32, 24, 18, 0.22); --orange: #ff5a1f; --orange-dark: #c83a10; --green: #26744b; --danger: #bb2c2c; --input: #fffdf7; --shadow: 8px 8px 0 rgba(21, 17, 13, 0.16); } html[data-theme="dark"] { color-scheme: dark; --paper: #15110d; --paper-deep: #231a14; --panel: #201811; --panel-strong: #2d2118; --ink: #fff8ec; --muted: #c5b39f; --line: #f3eadc; --line-soft: rgba(243, 234, 220, 0.2); --orange: #ff7a2d; --orange-dark: #ff5a1f; --green: #64c18a; --danger: #ff7777; --input: #17120d; --shadow: 8px 8px 0 rgba(0, 0, 0, 0.38); } * { box-sizing: border-box; } html { min-width: 320px; } body { background: linear-gradient(90deg, var(--line-soft) 1px, transparent 1px) 0 0 / 42px 42px, linear-gradient(var(--line-soft) 1px, transparent 1px) 0 0 / 42px 42px, var(--paper); color: var(--ink); font-family: "IBM Plex Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.45; margin: 0; } button, input, select, textarea { font: inherit; } a { color: inherit; } button:focus-visible, a:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; } .page { margin: 0 auto; max-width: 1320px; padding: 18px; } .topbar { align-items: center; border: 2px solid var(--line); background: var(--panel); display: flex; gap: 16px; justify-content: space-between; min-height: 68px; padding: 12px 14px; } .brand-mark { align-items: center; display: flex; gap: 12px; min-width: 0; } .brand-badge { align-items: center; background: var(--ink); color: var(--paper); display: inline-flex; font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; font-weight: 800; height: 38px; justify-content: center; letter-spacing: 0; min-width: 38px; } .brand-copy { display: grid; gap: 2px; } .brand-copy strong { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; } .brand-copy span { color: var(--muted); font-size: 13px; } .topnav { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; } .nav-link, .button, .tab, .terrain-button { border: 2px solid var(--line); cursor: pointer; min-height: 42px; } .nav-link { align-items: center; background: transparent; display: inline-flex; font-size: 13px; font-weight: 800; justify-content: center; padding: 0 12px; text-decoration: none; text-transform: uppercase; } .nav-link:hover, .button.secondary:hover, .terrain-button:hover { background: var(--panel-strong); } .button { align-items: center; background: var(--orange); color: #120b07; display: inline-flex; font-weight: 900; justify-content: center; min-width: 0; padding: 0 16px; text-transform: uppercase; } .step .button { margin-top: 12px; } .button.secondary { background: transparent; color: var(--ink); } .button:disabled, select:disabled { cursor: not-allowed; opacity: 0.55; } .hero { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) minmax(280px, 430px); padding: 34px 0 18px; } .hero-copy { min-width: 0; } .eyebrow-row { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; } .eyebrow { border: 2px solid var(--line); background: var(--panel); font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; font-weight: 800; padding: 7px 10px; text-transform: uppercase; } .hero h1 { font-family: "Arial Black", Impact, "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif; font-size: clamp(48px, 7.6vw, 112px); letter-spacing: -0.045em; line-height: 0.92; margin: 0; max-width: 980px; text-wrap: balance; } .hero-lede { border-left: 8px solid var(--orange); color: var(--muted); font-size: clamp(19px, 2.4vw, 30px); font-weight: 700; line-height: 1.15; margin: 24px 0 0; max-width: 900px; padding-left: 18px; } .proof-grid { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 24px; max-width: 820px; } .proof-chip { border: 2px solid var(--line); background: var(--panel); min-height: 58px; padding: 10px 12px; } .proof-chip strong { display: block; font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; text-transform: uppercase; } .proof-chip span { color: var(--muted); display: block; font-size: 13px; margin-top: 2px; } .status-panel { align-self: end; background: var(--ink); border: 2px solid var(--line); color: var(--paper); min-height: 260px; padding: 18px; position: relative; } html[data-theme="dark"] .status-panel { background: var(--panel); color: var(--ink); } .status-panel:before { border: 2px solid var(--orange); bottom: 12px; content: ""; left: 12px; pointer-events: none; position: absolute; right: 12px; top: 12px; } .status-panel h2 { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; letter-spacing: 0.04em; margin: 0 0 18px; text-transform: uppercase; } .status-metric { border-top: 1px solid currentColor; display: flex; gap: 14px; justify-content: space-between; padding: 12px 0; position: relative; z-index: 1; } .status-metric span { color: inherit; opacity: 0.72; } .status-link { display: inline-flex; font-weight: 800; margin-top: 14px; position: relative; text-transform: uppercase; z-index: 1; } .status-cta-note { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; margin: 6px 0 0; opacity: 0.78; position: relative; text-transform: uppercase; z-index: 1; } .status { align-items: center; background: var(--panel); border: 2px solid var(--line); display: flex; gap: 14px; justify-content: space-between; margin: 0 0 14px; padding: 12px 14px; } .status strong { color: var(--orange-dark); } .status span, .muted { color: var(--muted); } .tabs { background: var(--line); border: 2px solid var(--line); display: flex; gap: 2px; margin: 18px 0; max-width: 100%; overflow-x: auto; padding: 2px; scrollbar-width: thin; } .tab { background: var(--panel); color: var(--muted); flex: 0 0 auto; font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; font-weight: 800; padding: 0 14px; text-transform: uppercase; } .tab[aria-selected="true"] { background: var(--orange); color: #120b07; } .tab[disabled] { cursor: default; opacity: 0.7; } .view[hidden] { display: none; } .challenge-grid { display: grid; gap: 18px; grid-template-columns: minmax(290px, 410px) minmax(0, 1fr); } .challenge-grid > *, .duel > * { min-width: 0; } .panel, .metric, .step, .code-block { background: var(--panel); border: 2px solid var(--line); } .panel { padding: 16px; } .pricing-card { border-color: var(--orange); box-shadow: inset 0 6px 0 var(--orange); padding: 22px; } .pricing-header { align-items: stretch; border-bottom: 2px solid var(--line); display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr); padding-bottom: 22px; } .pricing-header h2 { margin-bottom: 14px; text-transform: uppercase; } .pricing-rate { display: block; font-size: clamp(42px, 7vw, 68px); line-height: 0.95; } .starter-offer { background: var(--orange); border: 2px solid var(--line); color: #120b07; display: flex; flex-direction: column; justify-content: center; padding: 18px 20px; } .starter-offer strong { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 18px; text-transform: uppercase; } .starter-offer span { margin-top: 6px; } .pricing-meta { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 18px 0; } .pricing-meta div { border: 2px solid var(--line); padding: 12px; } .pricing-meta span { color: var(--muted); display: block; font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; font-weight: 800; text-transform: uppercase; } .pricing-meta strong { display: block; margin-top: 4px; } .pricing-routing-line { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; font-weight: 800; line-height: 1.5; margin: 18px 0 12px; text-align: center; } .pricing-footnote { color: var(--muted); font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; font-weight: 800; margin: 16px 0 0; text-align: center; } .control-panel { box-shadow: var(--shadow); } .section-kicker { color: var(--muted); font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; font-weight: 800; margin: 0 0 6px; text-transform: uppercase; } .section-title { font-size: 28px; line-height: 1; margin: 0 0 14px; text-transform: uppercase; } .field { display: grid; gap: 8px; margin-bottom: 14px; } label { color: var(--muted); font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; font-weight: 800; text-transform: uppercase; } select, textarea { background: var(--input); border: 2px solid var(--line); color: var(--ink); min-height: 46px; padding: 11px 12px; width: 100%; } textarea { min-height: 190px; resize: vertical; } .terrain-select { display: none; } .terrain-grid { display: grid; gap: 8px; grid-template-columns: 1fr; } .terrain-button { background: var(--input); color: var(--ink); display: grid; gap: 2px; min-height: 64px; padding: 10px 12px; text-align: left; } .terrain-button strong { font-size: 15px; text-transform: uppercase; } .terrain-button span { color: var(--muted); font-size: 13px; } .terrain-button[aria-pressed="true"] { background: var(--orange); color: #120b07; } .terrain-button[aria-pressed="true"] span { color: #3d1b0d; } .duel { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); } .duel-panel { display: grid; grid-template-rows: auto minmax(260px, 1fr) auto; min-height: 100%; } .duel-panel > * { max-width: 100%; min-width: 0; } .output { background: var(--input); border: 2px solid var(--line); min-height: 260px; overflow: auto; padding: 13px; white-space: pre-wrap; word-break: break-word; } .output:empty:before { color: var(--muted); content: "Waiting for stream."; } .panel-title { align-items: flex-start; display: flex; gap: 10px; justify-content: space-between; margin-bottom: 12px; } .panel-title h2 { font-size: 24px; line-height: 1; margin: 0; text-transform: uppercase; } .badge { background: var(--ink); border: 2px solid var(--line); color: var(--paper); font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; font-weight: 800; max-width: 100%; overflow: hidden; padding: 5px 8px; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; } html[data-theme="dark"] .badge { background: var(--orange); color: #120b07; } .metrics { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; } .metric { min-height: 62px; padding: 9px; } .metric span { color: var(--muted); display: block; font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; font-weight: 800; text-transform: uppercase; } .metric strong { display: block; margin-top: 3px; overflow-wrap: anywhere; } .verdict { background: var(--panel); border: 2px solid var(--line); border-left: 12px solid var(--orange); display: grid; font-weight: 800; gap: 4px; margin-top: 16px; padding: 12px 14px; } .verdict strong { font-size: 18px; } .verdict span { color: var(--orange-dark); font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; text-transform: uppercase; } .verdict small { color: var(--muted); font-weight: 700; } .live-note, .reference-note { color: var(--muted); font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; font-weight: 800; letter-spacing: 0; margin: 8px 0 0; text-transform: uppercase; } .live-note strong, .reference-note strong { color: var(--ink); } .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; } .benchmark-grid { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); } .benchmark-card { min-height: 190px; } .benchmark-card strong { display: block; font-size: clamp(34px, 7vw, 78px); letter-spacing: 0; line-height: 0.9; margin: 6px 0 10px; text-transform: uppercase; } .stat-strip { background: var(--orange); border: 2px solid var(--line); color: #120b07; font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: clamp(22px, 5vw, 54px); font-weight: 900; line-height: 0.95; margin-bottom: 16px; padding: 18px; text-transform: uppercase; } .api-grid { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); } .step, .code-block { padding: 16px; } .step h2, .panel h2 { line-height: 1.1; margin-top: 0; } pre { margin: 0; overflow-x: auto; white-space: pre; } code { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; } table { border-collapse: collapse; width: 100%; } .table-scroll { margin-top: 10px; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; } .table-scroll table { min-width: 640px; } td, th { border-bottom: 2px solid var(--line); padding: 10px; text-align: left; vertical-align: top; } .footer { align-items: center; border-top: 2px solid var(--line); color: var(--muted); display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; margin-top: 28px; padding: 18px 0 0; } .benchmark-sources { display: flex; flex-wrap: wrap; gap: 14px 24px; } .footer-links { display: flex; flex-wrap: wrap; gap: 12px; } .footer a { font-weight: 800; } @media (max-width: 980px) { .hero, .challenge-grid, .duel, .api-grid, .benchmark-grid { grid-template-columns: 1fr; } .status-panel { min-height: 220px; } } @media (max-width: 700px) { .page { padding: 12px; } .topbar, .status { align-items: flex-start; flex-direction: column; } .topnav { justify-content: flex-start; width: 100%; } #view-api pre { overflow-x: visible; overflow-wrap: anywhere; white-space: pre-wrap; word-break: break-word; } .nav-link, .topnav .button { flex: 1 1 130px; } .hero { padding-top: 24px; } .hero h1 { font-size: clamp(48px, 14vw, 64px); overflow-wrap: anywhere; } .proof-grid, .metrics, .pricing-header, .pricing-meta { grid-template-columns: 1fr; } .tabs { flex-wrap: wrap; overflow: visible; } .tab { flex: 1 1 calc(50% - 2px); } .panel { padding: 12px; } .table-scroll { margin-top: 12px; max-width: 100%; overflow: visible; padding: 0; } .table-scroll table, .table-scroll tbody, .table-scroll tr, .table-scroll td { display: block; min-width: 0; width: 100%; } .table-scroll thead { clip: rect(0 0 0 0); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } .table-scroll tr { border: 2px solid var(--line); margin-bottom: 10px; padding: 4px 10px; } .table-scroll td { align-items: start; border-bottom: 1px solid var(--line); display: grid; gap: 12px; grid-template-columns: minmax(104px, 0.8fr) minmax(0, 1.2fr); overflow-wrap: anywhere; padding: 9px 0; } .table-scroll td:last-child { border-bottom: 0; } .table-scroll td::before { color: var(--muted); content: attr(data-label); font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; font-weight: 800; text-transform: uppercase; } .status-price-cache { display: block; margin-top: 3px; } .status-price-cache::before { content: ""; } textarea { min-height: 170px; } } @media (prefers-reduced-motion: no-preference) { .button, .nav-link, .tab, .terrain-button { transition: background 140ms ease, color 140ms ease, transform 140ms ease; } .button:hover, .nav-link:hover, .tab:not([disabled]):hover, .terrain-button:hover { transform: translate(-1px, -1px); } } </style> </head> <body> <main class="page"> <header class="topbar"> <div class="brand-mark"> <span class="brand-badge">S</span> <div class="brand-copy"> <strong>SOVINFRA | PRIVATE AI</strong> <span>Private modeless inference · EU-hosted.</span> </div> </div> <nav class="topnav" aria-label="Navigation"> <button class="nav-link" data-nav-tab="api" type="button">Developers</button> <a class="nav-link" href="https://codeberg.org/sovinfra" rel="noopener noreferrer" target="_blank"> Codeberg </a> <a class="nav-link" data-console-link href="https://app.sovinfra.ai" rel="noopener noreferrer" target="_blank"> Console </a> <button class="button secondary" id="themeButton" type="button">Dark mode</button> </nav> </header> <section class="hero" aria-labelledby="hero-title"> <div class="hero-copy"> <div class="eyebrow-row"> <span class="eyebrow">Sovereign AI stack</span> <span class="eyebrow">July 2026</span> </div> <h1 id="hero-title">Compare AI. Measured live.</h1> <p class="hero-lede"> Run the same prompt. Compare latency, throughput, quality and real request cost. </p> <div class="proof-grid" aria-label="Models and modalities"> <div class="proof-chip"> <strong>Qwen 3.8-27B FP8 · H200</strong> <span>Code, reasoning, vision and tool calling</span> </div> <div class="proof-chip"> <strong>Gemma 4 31B BF16 · H200</strong> <span>Text, vision and extraction</span> </div> <div class="proof-chip"> <strong>Whisper Large V3</strong> <span>FR / EN audio coverage</span> </div> <div class="proof-chip"> <strong>BGE-M3</strong> <span>Embeddings and semantic search</span> </div> </div> </div> <aside class="status-panel" aria-label="Resume infrastructure"> <h2>Live stack</h2> <div class="status-metric"> <span>Mode</span> <strong>Modeless</strong> </div> <div class="status-metric"> <span>Region</span> <strong>Europe</strong> </div> <div class="status-metric"> <span>Input</span> <strong>$0.12 / M in</strong> </div> <div class="status-metric"> <span>Output</span> <strong>$0.38 / M out</strong> </div> <a class="status-link" href="#view-defi">Launch Arena</a> <p class="status-cta-note">1B free tokens</p> </aside> </section> <section class="status" aria-label="Statut infrastructure"> <span class="status-copy"><strong id="statusLabel">loading live status</strong> · First token from ~50 ms in Europe · Redundant hosting designed for 99.9999% availability<span id="statusDetail"></span></span> <a href="https://status.sovinfra.cloud/" rel="noopener noreferrer" target="_blank"> Full status </a> </section> <nav class="tabs" aria-label="Vues"> <button class="tab" data-tab="defi" aria-selected="true" type="button">Arena</button> <button class="tab" data-tab="speed" aria-selected="false" type="button">Speed</button> <button class="tab" data-tab="best" aria-selected="false" type="button">Best-of-2</button> <button class="tab" data-tab="economy" aria-selected="false" type="button">Economy</button> <button class="tab" data-tab="api" aria-selected="false" type="button">API ACCESS</button> </nav> <section class="view" id="view-defi"> <div class="challenge-grid"> <aside class="panel control-panel"> <p class="section-kicker">Preloaded prompt</p> <h2 class="section-title">The Arena</h2> <div class="field"> <label>Terrain</label> <select class="terrain-select" id="terrain" aria-label="Terrain"> <option value="code">Code a function</option> <option value="audit">Audit a text</option> <option value="json">Extract to JSON</option> <option value="reasoning">Complex reasoning</option> </select> <div class="terrain-grid" aria-label="Terrain choices"> <button class="terrain-button" data-terrain="code" aria-pressed="true" type="button"> <strong>Code</strong> <span>Code a function</span> </button> <button class="terrain-button" data-terrain="audit" aria-pressed="false" type="button"> <strong>Analysis</strong> <span>Audit a text</span> </button> <button class="terrain-button" data-terrain="json" aria-pressed="false" type="button"> <strong>Structure</strong> <span>Extract to JSON</span> </button> <button class="terrain-button" data-terrain="reasoning" aria-pressed="false" type="button"> <strong>Reasoning</strong> <span>Stress-test modeless routing</span> </button> </div> </div> <div class="field"> <label for="prompt">Editable prompt</label> <textarea id="prompt">Implement merge_intervals(intervals: Array&lt;[number, number]&gt;) in TypeScript. Return sorted, non-overlapping intervals. Merge touching intervals, reject invalid ranges, handle empty input and negative values, and include concise tests.</textarea> </div> <div class="field"> <label for="challenger">Challenger</label> <select id="challenger"> <option value="anthropic/claude-sonnet-5">Anthropic — Claude Sonnet 5</option> </select> <p class="muted"> Comparable profile: reasoning is reduced where the official API permits it. Provider keys remain server-side. </p> </div> <button class="button" id="runButton" type="button">Test SovAPI</button> <p class="muted" id="quotaText">Challenger cap: 30,000 tokens per duel.</p> </aside> <section> <div class="duel"> <article class="panel duel-panel"> <div class="panel-title"> <div> <p class="section-kicker" id="leftLaneKicker">A - Private</p> <h2 id="sovapiLaneTitle">SOVAPI CODE</h2> </div> <span class="badge" id="leftLaneBadge">sovapi</span> </div> <div class="output" id="sovapiOutput"></div> <div class="metrics" id="sovapiMetrics"></div> <p class="live-note">Live measured from this run.</p> </article> <article class="panel duel-panel"> <div class="panel-title"> <div> <p class="section-kicker" id="rightLaneKicker">B - Challenger</p> <h2 id="challengerProviderTitle">Anthropic — Claude Sonnet 5</h2> </div> <span class="badge" id="challengerBadge">Claude Sonnet 5</span> </div> <div class="output" id="challengerOutput"></div> <div class="metrics" id="challengerMetrics"></div> <p class="live-note">Live measured from this run.</p> </article> </div> <div class="verdict" id="verdict" aria-live="polite"> The live verdict appears after both measured runs complete. </div> <div class="actions"> <button class="button secondary" id="newButton" type="button">New test</button> <button class="button secondary" id="shareButton" type="button" disabled> Share result </button> </div> <canvas id="shareCanvas" width="1600" height="900" hidden></canvas> </section> </div> </section> <section class="view" id="view-speed" hidden> <div class="panel"><h2>Measure latency in the Arena</h2><p>Run the same prompt to compare time to first token, throughput and request cost. Results are measured for each request.</p><button class="nav-link" type="button" data-nav-tab="defi">Run the Arena →</button></div> </section> <section class="view" id="view-best" hidden> <div class="panel"><h2>Model developer benchmarks</h2> <p>Results published by the model developers, according to their evaluation protocols.</p> <p class="benchmark-sources"> <a href="https://qwen.ai/research">Qwen research</a> <a href="https://deepmind.google/models/gemma/">Google Gemma</a> <a href="https://www.anthropic.com/news">Anthropic publications</a> <a href="https://github.com/deepseek-ai">DeepSeek publications</a> </p> <p>Compare your own workloads in the Arena.</p> </div> </section> <section class="view" id="view-economy" hidden> <div class="stat-strip">Usage-based pricing in US dollars, with no commitment</div> <div class="benchmark-grid"> <article class="panel benchmark-card"> <p class="section-kicker">Gemma 4 31B BF16 · H200</p> <strong>$0.12 · $0.38</strong> <p>Per million input and output tokens. No cache-read tariff.</p> </article> <article class="panel benchmark-card"> <p class="section-kicker">Qwen 3.8-27B FP8 · H200</p> <strong>$0.12 · $0.38</strong> <p>Per million input and output tokens.</p> </article> <article class="panel benchmark-card"> <p class="section-kicker">Qwen cache read</p> <strong>$0.04 cached</strong> <p>Per million cached input tokens.</p> </article> <article class="panel benchmark-card"> <p class="section-kicker">Trial grant</p> <strong>1 B</strong> <p>Trial tokens for developers starting from API ACCESS.</p> </article> </div> <div class="panel" style="margin-top: 16px"> <h2>Economy reference table</h2> <p class="reference-note"> <strong>Reference / expected values.</strong> SovAPI cost is recalculated from live token usage. Challenger cost remains unavailable when the official API response does not expose a monetary amount. </p> <div class="table-scroll" role="region" aria-label="Economy reference table" tabindex="0"> <table> <thead> <tr><th>Metric</th><th>SovAPI</th><th>Challenger</th><th>How it is shown</th></tr> </thead> <tbody> <tr><td>Gemma 4 31B BF16 · H200</td><td>$0.12 / M input · $0.38 / M output</td><td>-- when unavailable</td><td>No cache-read tariff</td></tr> <tr><td>Qwen 3.8-27B FP8 · H200</td><td>$0.12 / M input · $0.38 / M output</td><td>-- when unavailable</td><td>Model-specific live cost</td></tr> <tr><td>Qwen cache read</td><td>$0.04 cached</td><td>-- when unavailable</td><td>Never inferred from uncached input</td></tr> <tr><td>Whisper Large v3</td><td>$0.00048 / audio minute</td><td>--</td><td>Transcription in 99+ languages</td></tr> <tr><td>Kokoro</td><td>$0.62 / M characters</td><td>--</td><td>FR/EN speech synthesis; other languages on request</td></tr> <tr><td>BGE-M3</td><td>$0.01 / M input tokens</td><td>--</td><td>Embeddings</td></tr> <tr><td>Per-request cost</td><td>Calculated from real tokens</td><td>-- when unavailable</td><td>Only a server-reported amount is displayed</td></tr> <tr><td>Trial grant</td><td>1 B tokens</td><td>None</td><td>API ACCESS onboarding</td></tr> <tr><td>Billing</td><td>Measured usage</td><td>Provider-specific</td><td>No SovAPI commitment</td></tr> </tbody> </table> </div> </div> </section> <section class="view" id="view-api" hidden> <div class="api-grid"> <div class="step"> <p class="section-kicker">Step 1</p> <h2>Create your key</h2> <p>Use GitHub or Google OAuth, then generate your trial SovAPI key.</p> <a class="button" data-console-link href="https://app.sovinfra.ai" rel="noopener noreferrer" target="_blank"> Create my API key </a> </div> <div class="step"> <p class="section-kicker">Step 2</p> <h2>Change two lines</h2> <p>Keep your OpenAI SDK, replace only base_url and api_key.</p> </div> <div class="step"> <p class="section-kicker">Step 3</p> <h2>Call sovapi</h2> <p>One public model, automatic routing by modality.</p> </div> </div> <div class="panel pricing-card" style="margin-top: 16px"> <div class="pricing-header"> <div> <p class="section-kicker">Pay-as-you-go</p> <h2>Plans and pricing</h2> <strong class="pricing-rate">$0.12</strong> <span>/ M tokens in</span> </div> <div class="starter-offer"> <strong>Your first billion tokens are free.</strong> <span>No credit card required.</span> </div> </div> <div class="table-scroll" role="region" aria-label="Model and pricing table" tabindex="0"> <table> <thead> <tr><th>Model / service</th><th>Usage price</th><th>Details</th></tr> </thead> <tbody> <tr> <td data-label="Model / service">Gemma 4 31B BF16 · H200</td> <td data-label="Usage price">$0.12 in · $0.38 out</td> <td data-label="Details">Text, vision and extraction</td> </tr> <tr> <td data-label="Model / service">Qwen 3.8-27B FP8 · H200</td> <td data-label="Usage price">$0.12 in · $0.38 out · $0.04 cached</td> <td data-label="Details">Code, reasoning, vision and tool calling</td> </tr> <tr> <td data-label="Model / service">Whisper Large v3</td> <td data-label="Usage price">$0.00048 / audio minute</td> <td data-label="Details">Transcription, 99+ languages</td> </tr> <tr> <td data-label="Model / service">Kokoro</td> <td data-label="Usage price">$0.62 / M characters</td> <td data-label="Details">Speech synthesis FR/EN · Other languages on request</td> </tr> <tr> <td data-label="Model / service">BGE-M3</td> <td data-label="Usage price">$0.01 / M input tokens</td> <td data-label="Details">Embeddings</td> </tr> </tbody> </table> </div> <div class="pricing-meta"> <div><span>Usage</span><strong>One usage counter · One invoice</strong></div> <div><span>Support</span><strong>Email response &lt; 15 min · 08:00–20:00 CET</strong></div> <div><span>Data retention</span><strong>None</strong></div> </div> <p class="pricing-routing-line">One API. Let the router pick, or call a model by name.</p> <a class="button" data-console-link href="https://app.sovinfra.ai" rel="noopener noreferrer" target="_blank">Get your free API key</a> <p class="pricing-footnote">EU hosting · GDPR native · No data training · OpenAI-compatible API</p> </div> <div class="code-block" style="margin-top: 16px"> <pre><code>curl https://api.sovinfra.ai/v1/chat/completions \ -H "Authorization: Bearer $SOVINFRA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"sovapi","messages":[{"role":"user","content":"Hello"}]}'</code></pre> </div> <p class="reference-note"> Use <code>sovapi</code> for automatic routing, or pin a generation model directly: <code>gemma-4-31b</code> for text and vision, and <code>qwen3.8-27b</code> for code, reasoning, vision and tool calling. Whisper, BGE-M3 and Kokoro remain available through SovAPI. </p> <div class="api-grid" style="margin-top: 16px"> <div class="code-block"> <p class="section-kicker">Direct model call</p> <h2>Gemma 4 31B</h2> <p>Text, vision and structured extraction.</p> <pre><code>curl https://api.sovinfra.ai/v1/chat/completions \ -H "Authorization: Bearer $SOVINFRA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"gemma-4-31b","messages":[{"role":"user","content":"Summarize this request."}]}'</code></pre> </div> <div class="code-block"> <p class="section-kicker">Direct model call</p> <h2>Qwen 3.8-27B</h2> <p>Code, reasoning, vision and tool calling.</p> <pre><code>curl https://api.sovinfra.ai/v1/chat/completions \ -H "Authorization: Bearer $SOVINFRA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"qwen3.8-27b","messages":[{"role":"user","content":"Write a Python health check."}]}'</code></pre> </div> </div> <div class="code-block" style="margin-top: 16px"> <pre><code>from openai import OpenAI client = OpenAI( base_url="https://api.sovinfra.ai/v1", api_key="sk-sov-...", ) response = client.chat.completions.create( model="sovapi", messages=[{"role": "user", "content": "Explain SovAPI in one sentence."}], )</code></pre> </div> <div class="code-block" style="margin-top: 16px"> <pre><code>import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.sovinfra.ai/v1", apiKey: process.env.SOVINFRA_API_KEY, });</code></pre> </div> <div class="panel" style="margin-top: 16px"> <h2>Compliance and control</h2> <p> Private inference, models hosted in Europe, server-side secrets, and logs without prompts or keys. Legal notices and terms are available from the footer. </p> </div> </section> <footer class="footer"> <span>SOVINFRA - FPLC SAS, 10 Place Vendome, Paris.</span> <div class="footer-links"> <a href="https://sovinfra.ai/sovereignty-security">Sovereignty and Security</a> <a href="https://sovinfra.ai/availability-continuity">Availability and Continuity</a> <a href="https://status.sovinfra.cloud/" rel="noopener noreferrer" target="_blank">Status</a> <a href="https://codeberg.org/sovinfra" rel="noopener noreferrer" target="_blank">Codeberg</a> <a href="/legal">Legal</a> <a href="/terms">Terms</a> <a href="mailto:contact@sovinfra.ai">contact@sovinfra.ai</a> <a href="https://db-ip.com" rel="noopener noreferrer" target="_blank">IP geolocation by DB-IP</a> </div> </footer> </main> <script> const REFERRAL_CODE_PATTERN = /^[a-z0-9_-]{1,64}$/; function propagateReferralToConsole() { const requestedCode = new URL(window.location.href).searchParams.get("ref"); const referralCode = requestedCode?.trim().toLowerCase() || ""; if (!REFERRAL_CODE_PATTERN.test(referralCode)) return; document.querySelectorAll("a[data-console-link]").forEach((link) => { const target = new URL(link.href); if (target.origin !== "https://app.sovinfra.ai") return; target.searchParams.set("ref", referralCode); link.href = target.toString(); }); } propagateReferralToConsole(); const API_BASE = window.SOVAPI_API_BASE || "https://api.sovinfra.ai"; const API_FALLBACK_BASE = window.SOVAPI_API_FALLBACK_BASE || "https://api.sovinfra.cloud"; const API_BASES = [API_BASE]; if (API_FALLBACK_BASE !== API_BASE) { API_BASES.push(API_FALLBACK_BASE); } const STATUS_SUMMARY_URL = window.SOVAPI_STATUS_SUMMARY_URL || "https://api.sovinfra.ai/health/ready"; const DEFAULT_CHALLENGER_MODEL = "anthropic/claude-sonnet-5"; const THEME_KEY = "sovapi.theme"; const MOBILE_RETRY_DELAYS_MS = [0, 900, 2200]; const DESKTOP_RETRY_DELAYS_MS = [0, 900]; const MOBILE_REQUEST_TIMEOUT_MS = 180000; const DESKTOP_REQUEST_TIMEOUT_MS = 150000; const TERRAIN_WARMUP_MAX_AGE_MS = 45000; const BENCHMARK_LOCATION_TIMEOUT_MS = 3000; const ARENA_ORIGIN_CITY = "Paris"; const SHARE_CARD_WIDTH = 1600; const SHARE_CARD_HEIGHT = 900; const SHARE_SAFE_MARGIN = 60; const SHARE_CARD_LAYOUT = Object.freeze({ frame: { x: 62, y: 62, width: 1476, height: 776 }, table: { y: 250, width: 680, height: 320, leftX: 96, rightX: 824 }, verdict: { x: 96, y: 590, width: 1408, height: 164 }, }); const CURATED_CHALLENGERS = [ { id: "anthropic/claude-sonnet-5", name: "Anthropic — Claude Sonnet 5", provider: "Anthropic", model: "Claude Sonnet 5", region: "US", available: true, }, { id: "openai/gpt-5.6-sol", name: "OpenAI — GPT-5.6", provider: "OpenAI", model: "GPT-5.6", region: "US", available: true, }, { id: "google/gemini-3.5-flash", name: "Google — Gemini 3.5 Flash", provider: "Google", model: "Gemini 3.5 Flash", region: "US", available: true, }, { id: "deepseek/deepseek-v4-flash", name: "DeepSeek — DeepSeek V4 Flash", provider: "DeepSeek", model: "DeepSeek V4 Flash", region: "China", available: true, }, { id: "deepseek/deepseek-v4-pro", name: "DeepSeek — DeepSeek V4 Pro", provider: "DeepSeek", model: "DeepSeek V4 Pro", region: "China", available: true, }, { id: "z-ai/glm-5.2", name: "Z.AI — GLM-5.2", provider: "Z.AI", model: "GLM-5.2", region: "China", available: true, }, { id: "moonshotai/kimi-k2.6", name: "Moonshot — Kimi K2.6", provider: "Moonshot", model: "Kimi K2.6", region: "China", available: true, }, { id: "mistral/mistral-large-2512", name: "Mistral — Large 3", provider: "Mistral", model: "Large 3", region: "Europe", available: true, }, { id: "alibaba/qwen3.8-27b", name: "Alibaba — Qwen 3.8-27B", provider: "Alibaba", model: "Qwen 3.8-27B", region: "China", available: true, }, { id: "scaleway/qwen3.5-397b-a17b", name: "Scaleway — Qwen3.5-397B", provider: "Scaleway", model: "Qwen3.5-397B", region: "Europe", available: true, }, ].filter( (candidate) => !["OpenAI", "Google"].includes(candidate.provider), ); const PROVIDER_DISPLAY_NAMES = Object.freeze({ sovapi: "SovAPI", anthropic: "Anthropic", openai: "OpenAI", deepseek: "DeepSeek", zai: "Z.AI", "z-ai": "Z.AI", moonshot: "Moonshot", moonshotai: "Moonshot", google: "Google", mistral: "Mistral", alibaba: "Alibaba", scaleway: "Scaleway", external: "Provider relay", }); const PROMPTS = { code: "Implement merge_intervals(intervals: Array<[number, number]>) in TypeScript. Return sorted, non-overlapping intervals. Merge touching intervals, reject invalid ranges, handle empty input and negative values, and include concise tests.", audit: "Audit this reasoning: 'Our competitor lowered prices this quarter, therefore their infrastructure must be cheaper to operate and we should immediately match their price.' Identify the fallacies, missing evidence, business risks, and a corrected decision process.", json: "Extract this invoice into strict JSON only, as minified JSON with no extra whitespace: Invoice INV-2026-0710, issued by Northwind Hosting SAS to FPLC SAS, 10 Place Vendome, Paris. Date 2026-07-10. Due 2026-07-25. Lines: H200 GPU hosting, quantity 42 hours, unit price 18.50 EUR; Sovereign inference support, quantity 1, unit price 690 EUR. VAT rate 20%. Return invoice_number, supplier, customer, dates, line_items, subtotal_eur, vat_eur, total_eur.", reasoning: "Two trains leave at the same time. Train A leaves Paris for Lyon at 300 km/h. Train B leaves Lyon for Paris at 220 km/h. The rail distance is 465 km. After 18 minutes, Train A slows to 250 km/h because of traffic. At what time after departure do the trains meet? Show the calculation clearly.", }; const TERRAIN_LABELS = { code: "CODE", audit: "ANALYSIS", json: "STRUCTURE", reasoning: "REASONING", }; const TERRAIN_SHARE_LABELS = Object.freeze({ code: "Code", audit: "Analysis", json: "Structure", reasoning: "Reasoning", }); const SOVAPI_MODEL_DISPLAY_NAMES = Object.freeze({ "qwen3-coder-next": "Qwen 3.8-27B FP8 · H200", "qwen3-coder-next-fp8": "Qwen 3.8-27B FP8 · H200", "gemma-4-31b": "Gemma 4 31B BF16 · H200", "gemma-4-31b-it-fp8": "Gemma 4 31B BF16 · H200", }); const state = { sovapi: null, challenger: null, challengerIdentity: null, duelId: null, duelDefinition: null, measuredAt: null, locationCity: null, running: false, }; const terrainWarmups = new Map(); const qs = (selector) => document.querySelector(selector); function randomDuelId() { if (globalThis.crypto && typeof globalThis.crypto.randomUUID === "function") { return globalThis.crypto.randomUUID(); } return `duel-${Date.now()}-${Math.random().toString(16).slice(2)}`; } function setTheme(nextTheme, persist = true) { const normalizedTheme = nextTheme === "dark" ? "dark" : "light"; document.documentElement.dataset.theme = normalizedTheme; qs("#themeButton").textContent = normalizedTheme === "dark" ? "Light mode" : "Dark mode"; if (!persist) return; try { localStorage.setItem(THEME_KEY, normalizedTheme); } catch (_error) { // Keep the toggle functional when storage is unavailable. } } setTheme(document.documentElement.dataset.theme, false); qs("#themeButton").addEventListener("click", () => { const current = document.documentElement.dataset.theme; setTheme(current === "dark" ? "light" : "dark"); }); function sleep(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); } function shouldUseMobileSafeMode() { const userAgent = navigator.userAgent || ""; const coarsePointer = window.matchMedia?.("(pointer: coarse)")?.matches || false; return /iPhone|iPad|iPod|Android|Mobile/.test(userAgent) || coarsePointer; } function requestTimeoutMs() { return shouldUseMobileSafeMode() ? MOBILE_REQUEST_TIMEOUT_MS : DESKTOP_REQUEST_TIMEOUT_MS; } function retryDelaysMs() { return shouldUseMobileSafeMode() ? MOBILE_RETRY_DELAYS_MS : DESKTOP_RETRY_DELAYS_MS; } function isRetryableStatus(status) { return status === 408 || status === 425 || status === 429 || status >= 500; } function annotateChallengeError(error, details = {}) { error.code = details.code || "challenge_unavailable"; error.publicMessage = details.publicMessage || ""; error.retryAfterSeconds = details.retryAfterSeconds || null; return error; } function retryableError(message, details = {}) { const error = new Error(message); error.retryable = true; return annotateChallengeError(error, details); } function nonRetryableError(message, details = {}) { const error = new Error(message); error.retryable = false; return annotateChallengeError(error, details); } function shouldRetryError(error) { return error?.retryable !== false; } function retryAfterCopy(rawSeconds) { const seconds = Number(rawSeconds); if (!Number.isFinite(seconds) || seconds <= 0) return "later"; if (seconds < 120) return `in about ${Math.ceil(seconds)} seconds`; if (seconds < 7200) return `in about ${Math.ceil(seconds / 60)} minutes`; return `in about ${Math.ceil(seconds / 3600)} hours`; } function challengeFailureCopy(side, code, retryAfterSeconds) { if ( code === "challenge_duel_token_limit_exceeded" || code === "challenge_token_limit_exceeded" ) { return "This duel has reached its 30,000-token Challenger limit. Start a new duel to continue."; } if (code === "sovapi_duel_token_limit_exceeded") { return "The private-side retry budget for this duel has been reached."; } if (code === "challenge_duel_attempt_limit_exceeded") { return "This duel leg has reached its retry limit."; } if ( code === "challenge_daily_ip_limit_exceeded" || code === "challenge_request_limit_exceeded" ) { return `This network has reached its daily Challenger duel limit. Please retry ${retryAfterCopy(retryAfterSeconds)}.`; } if (code === "challenge_global_daily_limit_exceeded") { return `Today's public Challenger capacity has been reached. Please retry ${retryAfterCopy(retryAfterSeconds)}.`; } if (code === "challenge_global_paid_leg_limit_exceeded") { return `Today's paid provider capacity has been reached. Please retry ${retryAfterCopy(retryAfterSeconds)}.`; } if (code === "challenge_provider_rate_limited") { return "The Challenger provider is temporarily rate-limited. Please retry shortly."; } if ( code === "challenge_provider_not_configured" || code === "challenge_provider_auth_failed" || code === "challenge_provider_credit_exhausted" ) { return "The Challenger service is temporarily unavailable. The server-side provider configuration is being checked."; } if (side === "challenger") { return "The Challenger provider is temporarily unavailable. Please retry shortly."; } return "SovAPI is temporarily unavailable. Please retry shortly."; } async function challengeResponseError(response, side) { let payload = {}; try { payload = await response.json(); } catch (_error) { // Preserve a sanitized HTTP fallback when an intermediary returns non-JSON. } const code = payload?.error?.code || `challenge_http_${response.status}`; const retryAfterSeconds = Number(response.headers.get("retry-after")) || null; const details = { code, retryAfterSeconds, publicMessage: challengeFailureCopy(side, code, retryAfterSeconds), }; const message = `Challenge ${side} failed with ${response.status} (${code})`; const retryable = isRetryableStatus(response.status) && response.status !== 429; return retryable ? retryableError(message, details) : nonRetryableError(message, details); } function challengeEventError(side, payload) { const code = payload?.code || "challenge_upstream_interrupted"; const retryAfterSeconds = Number(payload?.retry_after_seconds) || null; const details = { code, retryAfterSeconds, publicMessage: challengeFailureCopy(side, code, retryAfterSeconds), }; const message = payload?.message || "Challenge upstream stream was interrupted"; return payload?.retryable === false ? nonRetryableError(message, details) : retryableError(message, details); } function rejectedRunCopy(side, error) { return error?.publicMessage || challengeFailureCopy(side, error?.code, error?.retryAfterSeconds); } async function fetchWithTimeout(url, options = {}, timeoutMs = requestTimeoutMs()) { const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), timeoutMs); try { return await fetch(url, { cache: "no-store", credentials: "omit", mode: "cors", ...options, signal: controller.signal, }); } finally { clearTimeout(timeout); } } async function fetchJsonFromApiBases(path, options = {}, timeoutMs = requestTimeoutMs()) { let lastError; const method = options.method || "GET"; for (const base of API_BASES) { try { const response = await fetchWithTimeout( `${base}${path}`, { ...options, headers: { Accept: "application/json", ...(options.headers || {}) }, }, timeoutMs, ); if (!response.ok) { throw isRetryableStatus(response.status) ? retryableError(`${method} ${path} failed with ${response.status}`) : nonRetryableError(`${method} ${path} failed with ${response.status}`); } return await response.json(); } catch (error) { lastError = error; if (!shouldRetryError(error)) break; } } throw lastError || new Error(`${method} ${path} failed`); } function normalizeBenchmarkCity(value) { if (typeof value !== "string") return null; const city = value.normalize("NFKC").replace(/\s+/g, " ").trim(); return city && city.length <= 80 ? city : null; } function formatMeasuredAtUtc(value) { const measuredAt = value instanceof Date ? value : new Date(value); if (!Number.isFinite(measuredAt.getTime())) return "Measured: —"; return `Measured: ${measuredAt.toISOString().slice(0, 16).replace("T", " ")} UTC`; } function shareRunId() { const compactId = String(state.duelId || "").replace(/[^A-Za-z0-9]/g, ""); return compactId ? compactId.slice(0, 12).toUpperCase() : "—"; } function shareProvenanceLabel() { return `Network exit: ${ARENA_ORIGIN_CITY} → ${state.locationCity || "—"}`; } function measurementProvenanceLabel() { const verified = [state.sovapi, state.challenger].every( (metrics) => metrics?.provenance_verified === true, ); return verified ? "Route verified" : "Route unverified"; } function shareFooterMetadata() { return { measured: formatMeasuredAtUtc(state.measuredAt), region: `${measurementProvenanceLabel().toUpperCase()} · ${shareProvenanceLabel().toUpperCase()}`, runId: `Run ID: ${shareRunId()}`, }; } async function loadBenchmarkLocation() { try { const response = await fetchWithTimeout( `${API_BASE}/v1/challenge/location`, { headers: { Accept: "application/json" }, keepalive: true, }, BENCHMARK_LOCATION_TIMEOUT_MS, ); if (!response.ok) throw new Error(`Location lookup failed with ${response.status}`); const payload = await response.json(); state.locationCity = normalizeBenchmarkCity(payload?.city); } catch (_error) { state.locationCity = null; } } function prewarmTerrain(terrain) { const selectedTerrain = PROMPTS[terrain] ? terrain : "code"; const now = Date.now(); const existing = terrainWarmups.get(selectedTerrain); if (existing && now - existing.startedAt < TERRAIN_WARMUP_MAX_AGE_MS) { return existing.promise; } const promise = fetchJsonFromApiBases( `/v1/challenge/warmup?terrain=${encodeURIComponent(selectedTerrain)}`, { method: "POST", keepalive: true }, ).catch(() => null); terrainWarmups.set(selectedTerrain, { startedAt: now, promise }); return promise; } function selectTab(tab) { document.querySelectorAll(".tab[data-tab]").forEach((item) => { item.setAttribute("aria-selected", String(item.dataset.tab === tab)); }); document.querySelectorAll(".view[id^='view-']").forEach((view) => { view.hidden = view.id !== `view-${tab}`; }); const target = qs(`#view-${tab}`) || qs("#view-defi"); target.scrollIntoView({ block: "start", behavior: "smooth" }); } document.querySelectorAll(".tab[data-tab]").forEach((button) => { button.addEventListener("click", () => { selectTab(button.dataset.tab); }); }); document.querySelectorAll("[data-nav-tab]").forEach((button) => { button.addEventListener("click", () => { selectTab(button.dataset.navTab); }); }); function selectTerrain(terrain) { const selectedTerrain = PROMPTS[terrain] ? terrain : "code"; qs("#terrain").value = selectedTerrain; document.querySelectorAll(".terrain-button").forEach((item) => { item.setAttribute("aria-pressed", String(item.dataset.terrain === selectedTerrain)); }); qs("#prompt").value = PROMPTS[selectedTerrain]; void prewarmTerrain(selectedTerrain); invalidateMeasuredRun(); updateLanePresentation(); } function activeLaneTitle(terrain = qs("#terrain").value) { return `SOVAPI ${TERRAIN_LABELS[terrain] || TERRAIN_LABELS.code}`; } function shareTerrainName() { const terrain = measuredDuelDefinition().terrain || "code"; return TERRAIN_SHARE_LABELS[terrain] || TERRAIN_SHARE_LABELS.code; } function actualSovapiModelName(metrics = state.sovapi) { const model = metrics?.reported_model || metrics?.model || metrics?.model_label; if (!model) return "--"; return SOVAPI_MODEL_DISPLAY_NAMES[String(model).toLowerCase()] || String(model); } document.querySelectorAll(".terrain-button").forEach((button) => { button.addEventListener("click", () => selectTerrain(button.dataset.terrain)); }); window.addEventListener("pageshow", () => selectTerrain(qs("#terrain").value)); async function loadModels() { const select = qs("#challenger"); try { const payload = await fetchJsonFromApiBases("/v1/challenge/models"); const models = Array.isArray(payload.data) ? payload.data : []; if (!models.length) throw new Error("empty catalogue"); select.replaceChildren(...challengerOptions(models)); } catch (_error) { select.replaceChildren(...challengerOptions([])); } selectPreferredChallenger(select); updateLanePresentation(); } function challengerOptions(models) { const items = validatedChallengerItems(models); const nodes = []; ["US", "China", "Europe"].forEach((region) => { const regionItems = items.filter( (item) => (item.region || "Other") === region, ); if (!regionItems.length) return; const group = document.createElement("optgroup"); group.label = region; regionItems.forEach((item) => group.append(createChallengerOption(item))); nodes.push(group); }); items .filter((item) => !["US", "China", "Europe"].includes(item.region || "")) .forEach((item) => nodes.push(createChallengerOption(item))); return nodes; } function validatedChallengerItems(models) { const candidates = new Map( models.filter((item) => item && typeof item.id === "string").map((item) => [item.id, item]), ); return CURATED_CHALLENGERS.map((expected) => { const candidate = candidates.get(expected.id); const valid = candidate?.available === true && candidate.route_mode === "direct" && candidate.reasoning_profile === "comparable" && candidate.fallback_enabled === false && candidate.provider === expected.provider && candidate.model === expected.model && candidate.region === expected.region; return { ...expected, available: valid, route_mode: valid ? "direct" : "unavailable", reasoning_profile: valid ? "comparable" : "unavailable", fallback_enabled: false, }; }); } function createChallengerOption(item) { const option = document.createElement("option"); option.value = item.id; option.textContent = item.name || `${item.provider} — ${item.model}`; option.dataset.name = option.textContent; option.dataset.provider = item.provider; option.dataset.model = item.model; option.dataset.region = item.region || ""; option.dataset.mode = "standard"; option.dataset.available = String(item.available); option.dataset.routeMode = item.route_mode || "unavailable"; option.disabled = item.available !== true; return option; } function selectPreferredChallenger(select) { const options = Array.from(select.options); const preferred = options.find( (option) => option.value === DEFAULT_CHALLENGER_MODEL && !option.disabled, ); const available = preferred || options.find((option) => !option.disabled); select.value = (available || options[0])?.value || DEFAULT_CHALLENGER_MODEL; select.disabled = state.running || !available; qs("#runButton").disabled = state.running || !available; } function displayProviderName(value) { const provider = String(value || "").trim(); return PROVIDER_DISPLAY_NAMES[provider.toLowerCase()] || provider || "Challenger"; } function challengerIdentity(payload = null, fallbackIdentity = null) { const selected = qs("#challenger").selectedOptions[0]; const provider = displayProviderName( payload?.provider_label || payload?.provider || fallbackIdentity?.provider || selected?.dataset.provider, ); const model = payload?.model_label || payload?.model || fallbackIdentity?.model || selected?.dataset.model || selected?.dataset.name || "Model"; return { provider, model, name: `${provider} — ${model}`, }; } function updateChallengerIdentity(payload = null) { const identity = challengerIdentity(payload, payload ? state.challengerIdentity : null); state.challengerIdentity = identity; qs("#challengerProviderTitle").textContent = identity.name; qs("#challengerBadge").textContent = identity.model; return identity; } function activeDuelDefinition() { const option = qs("#challenger").selectedOptions[0]; return { terrain: qs("#terrain").value, left: { stateKey: "sovapi", side: "sovapi", model: option?.value || DEFAULT_CHALLENGER_MODEL, provider: "SovAPI", modelLabel: "SovAPI", }, right: { stateKey: "challenger", side: "challenger", model: option?.value || DEFAULT_CHALLENGER_MODEL, provider: option?.dataset.provider || "Challenger", modelLabel: option?.dataset.model || "Model", }, }; } function measuredDuelDefinition() { return state.duelDefinition || activeDuelDefinition(); } function updateLanePresentation() { qs("#leftLaneKicker").textContent = "A - Private"; qs("#sovapiLaneTitle").textContent = activeLaneTitle(); qs("#leftLaneBadge").textContent = "sovapi"; qs("#rightLaneKicker").textContent = "B - Challenger"; qs("#runButton").textContent = "Test SovAPI"; updateChallengerIdentity(); } qs("#challenger").addEventListener("change", () => { invalidateMeasuredRun(); updateLanePresentation(); }); qs("#prompt").addEventListener("input", invalidateMeasuredRun); function setRunControlsDisabled(disabled) { state.running = disabled; const challengerSelect = qs("#challenger"); const hasAvailableChallenger = Array.from(challengerSelect.options).some( (option) => !option.disabled, ); challengerSelect.disabled = disabled || !hasAvailableChallenger; qs("#terrain").disabled = disabled; qs("#prompt").disabled = disabled; qs("#newButton").disabled = disabled; document.querySelectorAll(".terrain-button").forEach((button) => { button.disabled = disabled; }); qs("#runButton").disabled = disabled || !hasAvailableChallenger; } function invalidateMeasuredRun() { if (state.running) return; state.sovapi = null; state.challenger = null; state.duelId = null; state.duelDefinition = null; state.measuredAt = null; qs("#sovapiOutput").textContent = ""; qs("#challengerOutput").textContent = ""; qs("#sovapiMetrics").replaceChildren(); qs("#challengerMetrics").replaceChildren(); qs("#verdict").textContent = "The live verdict appears after both measured runs complete."; qs("#shareButton").disabled = true; qs("#quotaText").textContent = "Challenger cap: 30,000 tokens per duel."; } function resetRun() { state.sovapi = null; state.challenger = null; state.duelDefinition = null; state.measuredAt = null; updateLanePresentation(); markSideStarting("sovapi", "Preparing SovAPI stream…"); markSideStarting("challenger", "Preparing challenger stream…"); qs("#verdict").textContent = "Live run in progress."; qs("#shareButton").disabled = true; qs("#quotaText").textContent = "30,000 Challenger tokens available for this duel."; } function markSideStarting(side, message = "Waiting for first token…") { const output = side === "sovapi" ? qs("#sovapiOutput") : qs("#challengerOutput"); const metrics = side === "sovapi" ? qs("#sovapiMetrics") : qs("#challengerMetrics"); output.textContent = message; output.dataset.pending = "true"; output.setAttribute("aria-busy", "true"); metrics.replaceChildren(metric("Status", "Starting")); } function clearSideStarting(side) { const output = side === "sovapi" ? qs("#sovapiOutput") : qs("#challengerOutput"); if (output.dataset.pending === "true") { output.textContent = ""; delete output.dataset.pending; } output.setAttribute("aria-busy", "false"); } function metric(label, value) { const node = document.createElement("div"); const labelNode = document.createElement("span"); const valueNode = document.createElement("strong"); node.className = "metric"; labelNode.textContent = label; valueNode.textContent = value; node.append(labelNode, valueNode); return node; } function renderMetrics(target, metrics) { const node = qs(target); const provider = metrics.provider_label || metrics.provider || (target === "#sovapiMetrics" ? "SovAPI" : "Challenger"); const rows = [ metric("Live provider", displayProviderName(provider)), metric("Live model", metrics.model_label || metrics.model || "--"), metric("Browser TTFT", formatMs(metrics.browser_time_to_first_text_ms)), metric( "Internal TTFT (client path excluded)", formatMs(metrics.time_to_first_token_ms), ), metric("Live latency", formatMs(metrics.latency_ms)), metric("Live tokens/s", formatNumber(metrics.tokens_per_second)), metric( "Live tokens in/out", `${formatNumber(metrics.input_tokens)}/${formatNumber(metrics.output_tokens)}`, ), metric("Reasoning tokens", formatNumber(metrics.reasoning_tokens)), metric("Route", metrics.route_mode || "--"), metric("Provenance", metrics.provenance_verified ? "Verified" : "Unverified"), metric("Finish reason", metrics.finish_reason || "--"), metric("Est. public cost", formatCostUsd(metrics.cost_usd)), ]; if (metrics.gpu_ms !== undefined) { rows.push(metric("GPU", formatMs(metrics.gpu_ms))); rows.push(metric("Network", formatMs(metrics.network_ms))); } node.replaceChildren(...rows); } function formatNumber(value) { if (value === null || value === undefined) return "--"; return Number(value).toLocaleString("en-US", { maximumFractionDigits: 2 }); } function formatMs(value) { if (value === null || value === undefined) return "--"; return `${Math.round(value)} ms`; } function formatCostUsd(value) { if (value === null || value === undefined) return "--"; return `${Number(value).toFixed(6)} USD`; } function formatSeconds(value) { if (value === null || value === undefined) return "--"; return `${(Number(value) / 1000).toFixed(2)} s`; } function formatRatio(value) { if (!Number.isFinite(value) || value <= 0) return ""; return value >= 10 ? value.toFixed(0) : value.toFixed(1); } function ratioPhrase(sovValue, challengerValue, betterWord, worseWord, equalPhrase, unavailablePhrase) { if ( sovValue === null || sovValue === undefined || challengerValue === null || challengerValue === undefined ) { return unavailablePhrase; } const sov = Number(sovValue); const challenger = Number(challengerValue); if (!Number.isFinite(sov) || !Number.isFinite(challenger)) { return unavailablePhrase; } if (sov === challenger) return equalPhrase; const sovWins = sov < challenger; if (sov <= 0 || challenger <= 0) return sovWins ? betterWord : worseWord; const ratio = sovWins ? challenger / sov : sov / challenger; return `${formatRatio(ratio)}x ${sovWins ? betterWord : worseWord}`.trim(); } function comparisonSummary() { if (!state.sovapi || !state.challenger) { return { headline: "TTFT pending", ttft: "Total time and cost pending", detail: "Run both sides to generate a shareable result.", }; } const speed = ratioPhrase( state.sovapi.latency_ms, state.challenger.latency_ms, "faster", "slower", "same speed", "speed unavailable", ); const cost = ratioPhrase( state.sovapi.cost_usd, state.challenger.cost_usd, "cheaper", "more expensive", "same cost", "cost unavailable", ); const ttft = ratioPhrase( state.sovapi.browser_time_to_first_text_ms, state.challenger.browser_time_to_first_text_ms, "faster", "slower", "same speed", "unavailable", ); return { headline: `TTFT · SovAPI ${ttft}`, ttft: `Total time ${speed} · ${cost}`, detail: "Browser TTFT includes the client-to-API path. Internal TTFT is shown separately for diagnostics.", }; } function renderLiveVerdict(summary) { const headline = document.createElement("strong"); const ttft = document.createElement("span"); const detail = document.createElement("small"); headline.textContent = summary.headline; ttft.textContent = summary.ttft; detail.textContent = summary.detail; qs("#verdict").replaceChildren(headline, ttft, detail); } function updateVerdict() { if (!state.sovapi || !state.challenger) { if (state.sovapi) { const leftName = measuredDuelDefinition().left.provider; qs("#verdict").textContent = `${leftName} run complete. Waiting for the second lane before sharing the result.`; } qs("#shareButton").disabled = true; return; } state.measuredAt ||= new Date(); renderLiveVerdict(comparisonSummary()); qs("#shareButton").disabled = false; } function shareabilityIssue() { if (!state.sovapi || !state.challenger) return "Both measured lanes are required."; return ""; } function markSideRetrying(side, attempt, base) { const output = side === "sovapi" ? qs("#sovapiOutput") : qs("#challengerOutput"); const metrics = side === "sovapi" ? qs("#sovapiMetrics") : qs("#challengerMetrics"); output.textContent = `Mobile network retry ${attempt} in progress.`; output.dataset.pending = "true"; output.setAttribute("aria-busy", "true"); metrics.replaceChildren(metric("Status", "Retrying"), metric("Endpoint", base.replace("https://", ""))); } function resetSideBeforeRetry(side) { const output = side === "sovapi" ? qs("#sovapiOutput") : qs("#challengerOutput"); const metrics = side === "sovapi" ? qs("#sovapiMetrics") : qs("#challengerMetrics"); output.textContent = ""; metrics.replaceChildren(); state[side] = null; state.measuredAt = null; } async function runSide(side) { if (!state.duelId) { throw nonRetryableError("Duel identifier is not initialized"); } const duel = measuredDuelDefinition(); const lane = side === "sovapi" ? duel.left : duel.right; const body = { side: lane.side, terrain: qs("#terrain").value, prompt: qs("#prompt").value, // The legacy API field carries a fresh duel id, not a browser session id. session_id: state.duelId, challenger_model: lane.model, }; const delays = retryDelaysMs(); let lastError; markSideStarting(side); for (let attemptIndex = 0; attemptIndex < delays.length; attemptIndex += 1) { if (delays[attemptIndex] > 0) await sleep(delays[attemptIndex]); for (const base of API_BASES) { try { if (attemptIndex > 0) { resetSideBeforeRetry(side); markSideRetrying(side, attemptIndex + 1, base); } await runSideAttempt(side, body, base); return; } catch (error) { lastError = error; if (!shouldRetryError(error)) throw error; } } } throw lastError || new Error(`Challenge ${side} failed`); } async function runSideAttempt(side, body, base) { const browserTiming = { requestStartedAtMs: performance.now(), firstTextMs: null, }; const response = await fetchWithTimeout(`${base}/v1/challenge`, { method: "POST", headers: { Accept: "text/event-stream", "Content-Type": "application/json", }, body: JSON.stringify(body), }); if (!response.ok) { throw await challengeResponseError(response, body.side); } if (!response.body || typeof response.body.getReader !== "function") { consumeSseText(side, await response.text(), true, browserTiming); if (!state[side]) throw retryableError(`Challenge ${side} completed without metrics`); return; } const reader = response.body.getReader(); const decoder = new TextDecoder(); let buffer = ""; while (true) { const { done, value } = await reader.read(); if (done) break; buffer = consumeSseText( side, buffer + decoder.decode(value, { stream: true }), false, browserTiming, ); } const trailing = decoder.decode(); consumeSseText(side, buffer + trailing, true, browserTiming); if (!state[side]) throw retryableError(`Challenge ${side} completed without metrics`); } function consumeSseText(side, text, flush = false, browserTiming = null) { const parts = text.replace(/\r\n/g, "\n").split("\n\n"); const events = flush ? parts : parts.slice(0, -1); events.forEach((eventText) => handleEvent(side, eventText, browserTiming)); return flush ? "" : parts[parts.length - 1] || ""; } function markSideUnavailable(side, message) { const output = side === "sovapi" ? qs("#sovapiOutput") : qs("#challengerOutput"); const metrics = side === "sovapi" ? qs("#sovapiMetrics") : qs("#challengerMetrics"); output.textContent = message; delete output.dataset.pending; output.setAttribute("aria-busy", "false"); metrics.replaceChildren(metric("Status", "Unavailable")); if (side === "challenger") { state.challenger = null; } else { state.sovapi = null; } } function formatStructureOutputForDisplay(side) { if (qs("#terrain").value !== "json") return; const output = side === "sovapi" ? qs("#sovapiOutput") : qs("#challengerOutput"); try { output.textContent = JSON.stringify(JSON.parse(output.textContent), null, 2); } catch (_error) { // Preserve the raw provider output when it is not valid JSON. } } function handleEvent(side, eventText, browserTiming = null) { if (eventText.includes("data: [DONE]")) return; const eventLine = eventText.split("\n").find((line) => line.startsWith("event:")); const eventName = eventLine?.replace("event:", "").trim() || "message"; const dataLine = eventText.split("\n").find((line) => line.startsWith("data:")); if (!dataLine) return; let payload; try { payload = JSON.parse(dataLine.replace("data:", "").trim()); } catch (_error) { return; } if (side === "challenger") { updateChallengerIdentity(payload); } if (eventName === "challenge.error") { throw challengeEventError(payload.side || side, payload); } if (eventName === "challenge.metrics") { clearSideStarting(side); const measuredMetrics = { ...payload, browser_time_to_first_text_ms: browserTiming?.firstTextMs ?? null, }; state[side] = measuredMetrics; formatStructureOutputForDisplay(side); renderMetrics( side === "sovapi" ? "#sovapiMetrics" : "#challengerMetrics", measuredMetrics, ); if (payload.side === "challenger") { qs("#quotaText").textContent = `${formatNumber(payload.remaining_tokens)} Challenger tokens left in this duel.`; } updateVerdict(); return; } const output = side === "sovapi" ? qs("#sovapiOutput") : qs("#challengerOutput"); const delta = typeof payload.delta === "string" ? payload.delta : ""; if (delta && browserTiming?.firstTextMs === null) { browserTiming.firstTextMs = Math.max( 0, performance.now() - browserTiming.requestStartedAtMs, ); } clearSideStarting(side); output.textContent += delta; } async function settleRun(promise) { try { await promise; return { status: "fulfilled" }; } catch (reason) { return { status: "rejected", reason }; } } qs("#runButton").addEventListener("click", async () => { resetRun(); state.duelDefinition = activeDuelDefinition(); state.duelId = randomDuelId(); setRunControlsDisabled(true); try { await prewarmTerrain(qs("#terrain").value); const results = shouldUseMobileSafeMode() ? [await settleRun(runSide("sovapi")), await settleRun(runSide("challenger"))] : await Promise.allSettled([runSide("sovapi"), runSide("challenger")]); if (results[0].status === "rejected") { markSideUnavailable("sovapi", rejectedRunCopy("sovapi", results[0].reason)); } if (results[1].status === "rejected") { markSideUnavailable("challenger", rejectedRunCopy("challenger", results[1].reason)); } updateVerdict(); } finally { setRunControlsDisabled(false); } }); qs("#newButton").addEventListener("click", () => { invalidateMeasuredRun(); updateLanePresentation(); const prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches; qs("#view-defi").scrollIntoView({ behavior: prefersReducedMotion ? "auto" : "smooth", block: "start", }); window.setTimeout( () => document .querySelector('.terrain-button[aria-pressed="true"]') ?.focus({ preventScroll: true }), 0, ); }); qs("#shareButton").addEventListener("click", async () => { if (shareabilityIssue()) { updateVerdict(); return; } const canvas = qs("#shareCanvas"); drawShareCard(canvas); const blob = await canvasToBlob(canvas); if (!blob) return; const file = new File([blob], "sovapi-arena-result.png", { type: "image/png" }); const shareData = { title: "SOVINFRA | PRIVATE AI", text: `${comparisonSummary().headline}. ${comparisonSummary().ttft}.`, files: [file], }; if (navigator.canShare?.(shareData) && navigator.share) { try { await navigator.share(shareData); return; } catch (error) { if (error instanceof DOMException && error.name === "AbortError") return; } } downloadBlob(blob, "sovapi-arena-result.png"); }); function drawShareCard(canvas) { canvas.width = SHARE_CARD_WIDTH; canvas.height = SHARE_CARD_HEIGHT; const context = canvas.getContext("2d"); if (!context) return; const styles = getComputedStyle(document.documentElement); const paper = styles.getPropertyValue("--paper").trim() || "#f3eadc"; const panel = styles.getPropertyValue("--panel").trim() || "#fff8ec"; const ink = styles.getPropertyValue("--ink").trim() || "#15110d"; const muted = styles.getPropertyValue("--muted").trim() || "#6f6255"; const orange = styles.getPropertyValue("--orange").trim() || "#ff5a1f"; const terrainName = shareTerrainName(); const shareLeftIdentity = { provider: "SovAPI", model: actualSovapiModelName(), }; const shareChallengerIdentity = challengerIdentity( state.challenger, state.challengerIdentity, ); context.fillStyle = paper; context.fillRect(0, 0, canvas.width, canvas.height); context.save(); context.beginPath(); context.rect( SHARE_SAFE_MARGIN, SHARE_SAFE_MARGIN, canvas.width - SHARE_SAFE_MARGIN * 2, canvas.height - SHARE_SAFE_MARGIN * 2, ); context.clip(); drawFrame( context, SHARE_CARD_LAYOUT.frame.x, SHARE_CARD_LAYOUT.frame.y, SHARE_CARD_LAYOUT.frame.width, SHARE_CARD_LAYOUT.frame.height, ink, ); context.fillStyle = orange; context.fillRect(96, 92, 220, 20); context.fillStyle = ink; context.font = "900 68px Arial, sans-serif"; context.fillText("SOVINFRA | PRIVATE AI", 96, 174, 1408); context.font = "700 24px Arial, sans-serif"; context.fillStyle = muted; context.fillText( "Live model comparison - values read from real API responses", 96, 216, 1408, ); drawMetricsTable( context, SHARE_CARD_LAYOUT.table.leftX, SHARE_CARD_LAYOUT.table.y, SHARE_CARD_LAYOUT.table.width, SHARE_CARD_LAYOUT.table.height, shareLeftIdentity.provider, state.sovapi, panel, ink, muted, orange, terrainName, shareLeftIdentity.model, ); drawMetricsTable( context, SHARE_CARD_LAYOUT.table.rightX, SHARE_CARD_LAYOUT.table.y, SHARE_CARD_LAYOUT.table.width, SHARE_CARD_LAYOUT.table.height, shareChallengerIdentity.provider, state.challenger, panel, ink, muted, orange, terrainName, shareChallengerIdentity.model, ); context.strokeStyle = orange; context.lineWidth = 3; context.strokeRect( SHARE_CARD_LAYOUT.verdict.x, SHARE_CARD_LAYOUT.verdict.y, SHARE_CARD_LAYOUT.verdict.width, SHARE_CARD_LAYOUT.verdict.height, ); const summary = comparisonSummary(); context.fillStyle = ink; context.font = "900 40px Arial, sans-serif"; context.textAlign = "center"; context.fillText(summary.headline, 800, 650, 1280); context.fillStyle = orange; context.font = "900 28px Arial, sans-serif"; context.fillText(summary.ttft, 800, 704, 1280); context.fillStyle = muted; context.font = "20px Arial, sans-serif"; const footer = shareFooterMetadata(); context.textAlign = "left"; context.fillText(footer.measured, 96, 810, 440); context.textAlign = "center"; context.fillText(footer.region, 800, 810, 600); context.textAlign = "right"; context.fillText(footer.runId, 1504, 810, 360); context.restore(); } function drawFrame(context, x, y, width, height, color) { context.strokeStyle = color; context.lineWidth = 3; context.strokeRect(x, y, width, height); } function drawMetricsTable( context, x, y, width, height, title, metrics, panel, ink, muted, orange, terrainName, modelName, ) { context.fillStyle = panel; context.fillRect(x, y, width, height); context.strokeStyle = ink; context.lineWidth = 2; context.strokeRect(x, y, width, height); context.fillStyle = ink; context.font = "900 30px Arial, sans-serif"; context.fillText(title, x + 24, y + 48, width - 48); const rows = [ ["Terrain", terrainName], ["Model", modelName || metrics?.model_label || metrics?.model || "--"], ["TTFT", formatMs(metrics?.browser_time_to_first_text_ms)], ["Throughput", `${formatNumber(metrics?.tokens_per_second)} tok/s`], ["Tokens", `${formatNumber(metrics?.input_tokens)} in / ${formatNumber(metrics?.output_tokens)} out`], ["Cost", formatCostUsd(metrics?.cost_usd)], ["Total time", formatSeconds(metrics?.latency_ms)], ]; context.font = "700 20px Arial, sans-serif"; rows.forEach(([label, value], index) => { const rowY = y + 84 + index * 31; context.fillStyle = index % 2 === 0 ? "rgba(255, 90, 31, 0.08)" : "rgba(255, 255, 255, 0)"; context.fillRect(x + 16, rowY - 25, width - 32, 32); context.fillStyle = muted; context.fillText(label.toUpperCase(), x + 28, rowY, 180); context.fillStyle = label === "Cost" ? orange : ink; context.fillText(value, x + 230, rowY, width - 262); }); } function canvasToBlob(canvas) { return new Promise((resolve) => { if (canvas.toBlob) { canvas.toBlob(resolve, "image/png"); return; } const dataUrl = canvas.toDataURL("image/png"); const parts = dataUrl.split(","); const binary = atob(parts[1]); const bytes = new Uint8Array(binary.length); for (let index = 0; index < binary.length; index += 1) { bytes[index] = binary.charCodeAt(index); } resolve(new Blob([bytes], { type: "image/png" })); }); } function downloadBlob(blob, filename) { const link = document.createElement("a"); link.href = URL.createObjectURL(blob); link.download = filename; link.click(); setTimeout(() => URL.revokeObjectURL(link.href), 1000); } async function refreshStatus() { try { // This readiness read is also the deliberate first-duel warmup: the head-level // preconnect starts DNS/TCP/TLS early, then this request opens the reusable API path. const response = await fetch(STATUS_SUMMARY_URL, { cache: "no-store", credentials: "omit", keepalive: true, }); if (!response.ok) throw new Error("status unavailable"); const payload = await response.json(); const status = payload.status || {}; const description = typeof status === "string" ? status : status.description || "operational"; qs("#statusLabel").textContent = `sovereign infra - ${description}`; qs("#statusDetail").textContent = payload.page?.updated_at ? ` - updated ${new Date(payload.page.updated_at).toLocaleString("en-GB")}` : ""; } catch (_error) { qs("#statusLabel").textContent = "live status unavailable"; qs("#statusDetail").textContent = ""; } } loadModels(); refreshStatus(); void loadBenchmarkLocation(); void prewarmTerrain(qs("#terrain").value); </script> </body> </html>
<!doctype html>
<html lang="en" data-theme="light">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>SovAPI Arena</title>
<link rel="preconnect" href="https://api.sovinfra.ai" crossorigin />
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='6' fill='%230b1620'/%3E%3Ctext x='16' y='22' font-size='18' text-anchor='middle' fill='%23ff7a1a' font-family='Arial'%3ES%3C/text%3E%3C/svg%3E" />
<script>
try {
const savedTheme = localStorage.getItem("sovapi.theme");
if (savedTheme === "light" || savedTheme === "dark") {
document.documentElement.dataset.theme = savedTheme;
}
} catch (_error) {
// Storage can be unavailable in private or embedded browser contexts.
}
</script>
<style>
:root {
color-scheme: light;
--paper: #f3eadc;
--paper-deep: #e7d8c3;
--panel: #fff8ec;
--panel-strong: #f7e5ce;
--ink: #15110d;
--muted: #6f6255;
--line: #201812;
--line-soft: rgba(32, 24, 18, 0.22);
--orange: #ff5a1f;
--orange-dark: #c83a10;
--green: #26744b;
--danger: #bb2c2c;
--input: #fffdf7;
--shadow: 8px 8px 0 rgba(21, 17, 13, 0.16);
}
html[data-theme="dark"] {
color-scheme: dark;
--paper: #15110d;
--paper-deep: #231a14;
--panel: #201811;
--panel-strong: #2d2118;
--ink: #fff8ec;
--muted: #c5b39f;
--line: #f3eadc;
--line-soft: rgba(243, 234, 220, 0.2);
--orange: #ff7a2d;
--orange-dark: #ff5a1f;
--green: #64c18a;
--danger: #ff7777;
--input: #17120d;
--shadow: 8px 8px 0 rgba(0, 0, 0, 0.38);
}
* {
box-sizing: border-box;
}
html {
min-width: 320px;
}
body {
background:
linear-gradient(90deg, var(--line-soft) 1px, transparent 1px) 0 0 / 42px 42px,
linear-gradient(var(--line-soft) 1px, transparent 1px) 0 0 / 42px 42px,
var(--paper);
color: var(--ink);
font-family:
"IBM Plex Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
font-size: 16px;
line-height: 1.45;
margin: 0;
}
button,
input,
select,
textarea {
font: inherit;
}
a {
color: inherit;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
textarea:focus-visible {
outline: 3px solid var(--orange);
outline-offset: 2px;
}
.page {
margin: 0 auto;
max-width: 1320px;
padding: 18px;