PageSourceSearch

https://git-hub-new-api.hf.space/static/js/async/1172.8bb2a3aba0.js

js git-hub-new-api.hf.space collected 2026-10-03 16:53:39 UTC 71,720 bytes, 186 lines download raw bytes

1/*! LICENSE: 1172.8bb2a3aba0.js.LICENSE.txt */
2"use strict";(self.rspackChunknewapi_web=self.rspackChunknewapi_web||[]).push([[1172],{41593(e,t,n){n.d(t,{},{M:[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}]})},27711(e,t,n){var a=n(79015),r=n(58197),s=n(91174),i=n(89766),o=n(40116),l=n(82939),d=n(52300),c=n(53926),m=n(35140),u=n(70556),p=n(70367),g=n(65311),x=n(89077),h=n(73178),f=n(52909),b=n(47801);let y=(0,g.createContext)({code:"",language:"plaintext"}),N={csharp:"c#",golang:"go",js:"javascript",shell:"bash",shellscript:"bash",ts:"typescript"},v=/^[a-z0-9][a-z0-9+#._-]{0,31}$/i,j=o.Lz.theme({"&":{background:"transparent",color:"var(--foreground)",fontSize:"13px"},".cm-content":{caretColor:"var(--foreground)",fontFamily:"var(--font-mono)",lineHeight:"1.5rem",minHeight:"var(--code-editor-min-height)",minWidth:"max-content",padding:"1rem 1rem 1rem 0"},".cm-editor":{background:"transparent",width:"100%"},".cm-focused":{outline:"none"},".cm-gutters":{background:"transparent",borderRight:"0",color:"var(--muted-foreground)",fontFamily:"var(--font-mono)",fontSize:"13px",lineHeight:"1.5rem",padding:"1rem 1rem 1rem 0"},".cm-gutters:empty":{display:"none"},".cm-lineNumbers .cm-gutterElement":{minWidth:"2.5rem",padding:"0 1rem 0 0",textAlign:"right"},".cm-line":{padding:"0"},".cm-scroller":{fontFamily:"var(--font-mono)",lineHeight:"1.5rem",minHeight:"var(--code-editor-min-height)",overflow:"auto"},".cm-selectionBackground":{background:"color-mix(in oklch, var(--primary) 28%, transparent) !important"}}),_=(0,s.y9)(s.cr.define([{tag:l._A.heading,color:"#e06c75",fontWeight:"600"},{tag:[l._A.strong,l._A.emphasis],color:"#d19a66"},{tag:[l._A.link,l._A.url],color:"#61afef"},{tag:[l._A.monospace,l._A.contentSeparator],color:"#98c379"},{tag:[l._A.keyword,l._A.processingInstruction],color:"#c678dd"},{tag:[l._A.atom,l._A.bool,l._A.number],color:"#d19a66"},{tag:[l._A.string,l._A.inserted],color:"#98c379"},{tag:[l._A.deleted,l._A.invalid],color:"#e06c75"},{tag:[l._A.meta,l._A.comment],color:"var(--muted-foreground)"}]));function w(e){let t=e?.trim().toLowerCase()||"plaintext";return v.test(t)?N[t]??t:"plaintext"}function k(e){return`${1.5*Math.max(4,e)+2}rem`}function $(e){let{ariaLabel:t,autoFocus:n=!1,language:s,onChange:l,onKeyDown:d,readOnly:c=!1,rows:m=8,showLineNumbers:u=!0,value:p}=e,x=(0,g.useRef)(null),h=(0,g.useRef)(null),f=(0,g.useRef)(p),b=(0,g.useRef)(l),y=`${1.5*Math.max(4,m)+2}rem`,N=(0,g.useMemo)(()=>{var e;let t,n;return n=["markdown"===(t=w((e={language:s,onKeyDown:d,readOnly:c,showLineNumbers:u}).language))||"md"===t||"mdx"===t?(0,r.wD)():[],_,j,i.$t.tabSize.of(2),i.$t.readOnly.of(e.readOnly),o.Lz.editable.of(!e.readOnly)],e.showLineNumbers&&n.unshift((0,o.$K)()),e.onKeyDown&&n.push(o.Lz.domEventHandlers({keydown:t=>(e.onKeyDown?.(t),t.defaultPrevented)})),n},[s,d,c,u]);return(0,g.useEffect)(()=>{b.current=l},[l]),(0,g.useEffect)(()=>{let e=x.current;if(!e)return;let t=new o.Lz({doc:f.current,extensions:[...N,o.Lz.updateListener.of(e=>{e.docChanged&&b.current?.(e.state.doc.toString())})],parent:e});return h.current=t,n&&t.focus(),()=>{t.destroy(),h.current=null}},[n,N]),(0,g.useEffect)(()=>{let e=h.current;e&&e.state.doc.toString()!==p&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:p}})},[p]),(0,a.jsx)("div",{"aria-label":t,"aria-readonly":c,className:"min-h-(--code-editor-min-height)",ref:x,role:"textbox",style:{"--code-editor-min-height":y}})}let A=e=>{let{bodyClassName:t,bodyMaxHeight:n,bodyOverlay:r,children:s,className:i,endActions:o,showToolbar:l=!1,title:d,...c}=e;return(0,a.jsxs)("div",{className:(0,b.cn)("group/code-block bg-muted/20 text-foreground my-3 w-full max-w-full overflow-hidden rounded-lg border shadow-xs",i),...c,children:[l&&(0,a.jsxs)("div",{className:"bg-muted/35 border-border/70 flex min-h-10 items-center gap-2 border-b px-2 py-1.5",children:[(0,a.jsx)("div",{className:"min-w-0 flex-1",children:(0,a.jsx)("div",{className:"text-muted-foreground truncate font-mono text-[11px] font-medium tracking-wide uppercase",children:d})}),o&&(0,a.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:o})]}),(0,a.jsxs)("div",{className:"relative min-w-0",children:[(0,a.jsx)("div",{className:(0,b.cn)("code-block-scroll max-w-full overflow-auto transition-[max-height] duration-200 ease-out",t),style:{maxHeight:n},children:s}),r]})]})};n.d(t,{},{NG:e=>{let{code:t,collapsedLines:n=12,defaultCollapsed:r,enableCollapse:s=!0,filename:i,language:o,maxExpandedLines:l,maxCollapsedLines:u,showLineNumbers:p=!1,showToolbar:b=!1,title:N,className:v,children:j,..._}=e,{t:E}=(0,x.Bd)(),[C,R]=(0,g.useState)(!!r),M=w(o),K=(0,g.useMemo)(()=>t?t.split("\n").length:1,[t]),P=u??n,F=s&&K>P,S=F&&C,T=N??M,O=S?k(P):l?k(l):void 0;return(0,a.jsx)(y.Provider,{value:{code:t,language:M},children:(0,a.jsx)(A,{bodyClassName:"p-0",bodyMaxHeight:O,bodyOverlay:(0,a.jsxs)(a.Fragment,{children:[S&&(0,a.jsx)("div",{className:"from-muted/20 to-background pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-linear-to-b"}),!b&&j&&(0,a.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-1",children:j})]}),className:v,endActions:(0,a.jsxs)(a.Fragment,{children:[F&&(0,a.jsxs)(f.m_,{children:[(0,a.jsx)(f.k$,{render:(0,a.jsx)(h.$,{"aria-label":E(S?"Expand":"Collapse"),className:"size-8",onClick:()=>R(e=>!e),size:"icon-sm",type:"button",variant:"ghost",children:S?(0,a.jsx)(d.A,{className:"size-4"}):(0,a.jsx)(c.A,{className:"size-4"})})}),(0,a.jsx)(f.ZI,{children:(0,a.jsx)("p",{children:E(S?"Expand":"Collapse")})})]}),b&&j,(0,a.jsxs)(f.m_,{children:[(0,a.jsx)(f.k$,{render:(0,a.jsx)(h.$,{"aria-label":E("Download"),className:"size-8",onClick:()=>
2{if("u"<typeof window)return;let e=new Blob([t],{type:"text/plain;charset=utf-8"}),n=URL.createObjectURL(e),a=document.createElement("a");a.href=n,a.download=i||`code.${"plaintext"===M?"txt":M}`,a.click(),URL.revokeObjectURL(n)},size:"icon-sm",type:"button",variant:"ghost",children:(0,a.jsx)(m.A,{className:"size-4"})})}),(0,a.jsx)(f.ZI,{children:(0,a.jsx)("p",{children:E("Download")})})]})]}),showToolbar:b,title:T,..._,children:(0,a.jsx)($,{ariaLabel:"string"==typeof T?T:M,language:o,readOnly:!0,rows:Math.min(Math.max(K,4),l??K),showLineNumbers:p,value:t})})})},gZ:e=>{let{onCopy:t,onError:n,timeout:r=2e3,children:s,className:i,...o}=e,{t:l}=(0,x.Bd)(),[d,c]=(0,g.useState)(!1),{code:m}=(0,g.useContext)(y),N=async()=>{if("u"<typeof window||!navigator?.clipboard?.writeText)return void n?.(Error("Clipboard API not available"));try{await navigator.clipboard.writeText(m),c(!0),t?.(),setTimeout(()=>c(!1),r)}catch(e){n?.(e)}},v=d?u.A:p.A,j=(0,a.jsx)(h.$,{"aria-label":l(d?"Copied!":"Copy code"),className:(0,b.cn)("size-8 shrink-0",i),onClick:N,size:"icon-sm",type:"button",variant:"ghost",...o,children:s??(0,a.jsx)(v,{size:14})});return(0,a.jsxs)(f.m_,{children:[(0,a.jsx)(f.k$,{render:j}),(0,a.jsx)(f.ZI,{children:(0,a.jsx)("p",{children:l(d?"Copied!":"Copy code")})})]})},oJ:e=>{let{actions:t,ariaLabel:n,className:r,language:s,onChange:i,onKeyDown:o,rows:l=8,title:d,value:c,...m}=e;return(0,a.jsx)(A,{bodyClassName:"p-0",className:r,endActions:t,showToolbar:!0,title:d,...m,children:(0,a.jsx)($,{ariaLabel:n,autoFocus:!0,language:s,onChange:i,onKeyDown:o,rows:l,showLineNumbers:!0,value:c})})}})},10879(e,t,n){var a=n(63228);async function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:24;return(await a.FH.get("/api/perf-metrics/summary",{params:{hours:e}})).data}async function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24;return(await a.FH.get("/api/perf-metrics",{params:{model:e,hours:t}})).data}n.d(t,{J:()=>s,R:()=>r})},79072(e,t,n){function a(e){return!Number.isFinite(e)||e<=0?"—":e>=1e3?`${(e/1e3).toFixed(1)}K t/s`:`${e.toFixed(e<10?2:1)} t/s`}function r(e){return!Number.isFinite(e)||e<=0?"—":e>=1e3?`${(e/1e3).toFixed(2)}s`:`${Math.round(e)}ms`}function s(e){return Number.isFinite(e)?`${e.toFixed(2)}%`:"—"}function i(e){return Number.isFinite(e)?e>=100?"excellent":e>=90?"good":e>=70?"warning":"critical":"unknown"}let o={excellent:"text-emerald-600 dark:text-emerald-400",good:"text-emerald-500 dark:text-emerald-300",warning:"text-amber-600 dark:text-amber-400",critical:"text-red-600 dark:text-red-400",unknown:"text-muted-foreground"},l={excellent:"bg-emerald-500",good:"bg-emerald-400",warning:"bg-amber-500",critical:"bg-red-500",unknown:"bg-muted-foreground"},d={excellent:"#10b981",good:"#34d399",warning:"#f59e0b",critical:"#ef4444",unknown:"#9ca3af"};function c(e){return o[i(e)]}function m(e){return l[i(e)]}function u(e){return d[i(e)]}n.d(t,{Fm:()=>s,NA:()=>c,NY:()=>m,Y5:()=>a,YL:()=>r,tN:()=>u})},56367(e,t,n){var a=n(79015),r=n(89077),s=n(32483),i=n(61574),o=n(60866);function l(e){let{t}=(0,r.Bd)(),n=t("Per Request"),l="purple";return(0,i.h8)(e.model)?(n=t("Dynamic Pricing"),l="warning"):(0,o.ow)(e.model)&&(n=t("Token-based"),l="info"),(0,a.jsx)(s.Wh,{label:n,variant:l,copyable:!1,size:"sm",className:e.className})}n.d(t,{v:()=>l})},53991(e,t,n){n.d(t,{Gm:()=>eZ,n$:()=>eQ});var a=n(79015),r=n(43866),s=n(10816),i=n(62698),o=n(72473),l=n(32115),d=n(85052),c=n(58550),m=n(5487),u=n(14398),p=n(59325),g=n(8223),x=n(62348),h=n(12011),f=n(40946);let b=(0,f.A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var y=n(65311),N=n(89077),v=n(20143),j=n(13595),_=n(49583),w=n(72744),k=n(51571),$=n(73178),A=n(9273),E=n(93539),C=n(60106),R=n(10879),M=n(79072),K=n(98918),P=n(47801),F=n(69474),S=n(61574),T=n(58028),O=n(60866),L=n(79458),I=n(70952),z=n(56367);let U=(0,f.A)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),B=(0,f.A)("sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",ke
2y:"wuwx1p"}]]);var G=n(37417),H=n(68758),D=n(52300),q=n(27711),V=n(83357),Y=n(43303);function J(e){let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return Math.abs(0|t)}let W=[{name:"temperature",type:"number",defaultValue:1,range:"0 ~ 2",descriptionKey:"Sampling temperature; lower is more deterministic"},{name:"top_p",type:"number",defaultValue:1,range:"0 ~ 1",descriptionKey:"Nucleus sampling probability mass"},{name:"max_tokens",type:"integer",range:">= 1",descriptionKey:"Maximum number of tokens in the response"},{name:"frequency_penalty",type:"number",defaultValue:0,range:"-2 ~ 2",descriptionKey:"Penalises repetition of frequent tokens"},{name:"presence_penalty",type:"number",defaultValue:0,range:"-2 ~ 2",descriptionKey:"Encourages introducing new topics"},{name:"stop",type:"array",descriptionKey:"Up to 4 strings that stop generation"},{name:"seed",type:"integer",descriptionKey:"Deterministic sampling seed (best-effort)"},{name:"n",type:"integer",defaultValue:1,range:">= 1",descriptionKey:"Number of completions to generate"},{name:"stream",type:"boolean",defaultValue:!1,descriptionKey:"Stream tokens via Server-Sent Events"},{name:"response_format",type:"object",descriptionKey:"Force JSON object or schema-conforming output"},{name:"tools",type:"array",descriptionKey:"Tool / function declarations the model may call"},{name:"tool_choice",type:"string",enumValues:["auto","none","required"],descriptionKey:"Tool-choice policy or specific tool name"},{name:"logprobs",type:"boolean",defaultValue:!1,descriptionKey:"Return per-token log probabilities"},{name:"top_logprobs",type:"integer",range:"0 ~ 20",descriptionKey:"Number of top log probabilities returned per token"},{name:"logit_bias",type:"object",descriptionKey:"Per-token logit bias map"},{name:"user",type:"string",descriptionKey:"End-user identifier for abuse monitoring"}],Q=[{name:"reasoning_effort",type:"enum",enumValues:["low","medium","high"],defaultValue:"medium",descriptionKey:"Controls how much the model thinks before answering"},{name:"max_completion_tokens",type:"integer",range:">= 1",descriptionKey:"Maximum tokens including hidden reasoning tokens"},{name:"stop",type:"array",descriptionKey:"Up to 4 strings that stop generation"},{name:"seed",type:"integer",descriptionKey:"Deterministic sampling seed (best-effort)"},{name:"stream",type:"boolean",defaultValue:!1,descriptionKey:"Stream tokens via Server-Sent Events"},{name:"response_format",type:"object",descriptionKey:"Force JSON object or schema-conforming output"},{name:"tools",type:"array",descriptionKey:"Tool / function declarations the model may call"},{name:"tool_choice",type:"string",enumValues:["auto","none","required"],descriptionKey:"Tool-choice policy or specific tool name"},{name:"user",type:"string",descriptionKey:"End-user identifier for abuse monitoring"}],Z=[{name:"input",type:"string",required:!0,descriptionKey:"Text or array of texts to embed"},{name:"dimensions",type:"integer",range:">= 1",descriptionKey:"Truncate embeddings to this many dimensions"},{name:"encoding_format",type:"enum",enumValues:["float","base64"],defaultValue:"float",descriptionKey:"Wire encoding for the embedding vectors"},{name:"user",type:"string",descriptionKey:"End-user identifier for abuse monitoring"}],X=[{name:"prompt",type:"string",required:!0,descriptionKey:"Text description of the desired image"},{name:"size",type:"enum",enumValues:["256x256","512x512","1024x1024","1024x1792","1792x1024"],defaultValue:"1024x1024",descriptionKey:"Output image size"},{name:"quality",type:"enum",enumValues:["standard","hd"],defaultValue:"standard",descriptionKey:"Generation quality preset"},{name:"style",type:"enum",enumValues:["vivid","natural"],defaultValue:"vivid",descriptionKey:"Aesthetic style"},{name:"n",type:"integer",defaultValue:1,range:"1 ~ 10",descriptionKey:"Number of images to generate"},{name:"response_format",type:"enum",enumValues:["url","b64_json"],defaultValue:"url",descriptionKey:"How to deliver the resulting image"}],ee=[{name:"prompt",type:"string",required:!0,descriptionKey:"Text description of the desired video"},{name:"duration",type:"integer",range:"1 ~ 60",descriptionKey:"Video length in seconds"},{name:"aspect_ratio",type:"enum",enumValues:["16:9","9:16","1:1"],defaultValue:"16:9",descriptionKey:"Output aspect ratio"},{name:"fps",type:"integer",range:"8 ~ 60",defaultValue:24,descriptionKey:"Frames per second"}];function et(e){let t,n=(t=e.model_name.toLowerCase(),/embed|rerank/.test(t)?"embedding":/image|sora|veo|kling|pika|jimeng|dalle|imagen/.test(t)?"image":/whisper|tts|voice|audio/.test(t)?"audio":/o1|o3|o4|reasoning|thinking|deepseek-r/.test(t)?"reasoning":/flash|haiku|mini|small|nano|fast/.test(t)?"fast":/gpt-5|opus|ultra|405|70b/.test(t)?"large":"standard");return"embedding"===n||"reasoning"===n?n:"image"===n?/sora|veo|kling|pika|video|wan-|hunyuanvideo/i.test(e.model_name)?"video":"image":"chat"}function en(e){return e<=0?"—":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}
2K`:e.toLocaleString()}let ea={curl:"cURL",python:"Python",typescript:"TypeScript",javascript:"JavaScript"},er={curl:"bash",python:"python",typescript:"typescript",javascript:"javascript"};function es(e){let{t}=(0,N.Bd)(),{status:n}=(0,Y.s)(),r=(0,y.useMemo)(()=>{let e=n?.server_address??n?.serverAddress??n?.data?.server_address??n?.data?.serverAddress;return e&&"string"==typeof e?e.replace(/\/$/,""):"u">typeof window?window.location.origin:"https://api.example.com"},[n]),s=(0,y.useMemo)(()=>(e.model.supported_endpoint_types||[]).map(t=>{let n=e.endpointMap[t]||{},a=n.path||"";return a&&a.includes("{model}")&&(a=(0,O.Oi)(a,e.model.model_name||"")),{type:t,path:a,method:n.method||"POST"}}).filter(e=>!!e.path),[e.model,e.endpointMap]),[i,o]=(0,y.useState)(s[0]?.type??""),[l,d]=(0,y.useState)("curl"),c=(0,y.useMemo)(()=>s.find(e=>e.type===i)??s[0],[i,s]);if(0===s.length||!c)return null;let m=function(e,t,n){let a,r,s,i,o,l;if("anthropic"===t){let t=`${n.baseUrl}${n.endpointPath}`,a="Explain quantum entanglement in one paragraph.";if("curl"===e){let e=JSON.stringify({model:n.modelName,max_tokens:1024,messages:[{role:"user",content:a}]},null,2);return`curl ${t} \\
3  -H "x-api-key: $${n.apiKeyEnv}" \\
4  -H "anthropic-version: 2023-06-01" \\
5  -H "Content-Type: application/json" \\
6  -d '${e.replace(/\n/g,"\n     ")}'`}return"python"===e?`import anthropic
7
8client = anthropic.Anthropic(
9    base_url="${n.baseUrl}",
10    api_key="<YOUR_API_KEY>",
11)
12
13message = client.messages.create(
14    model="${n.modelName}",
15    max_tokens=1024,
16    messages=[{"role": "user", "content": "${a}"}],
17)
18
19print(message.content[0].text)`:"typescript"===e?`import Anthropic from '@anthropic-ai/sdk'
20
21const client = new Anthropic({
22  baseURL: '${n.baseUrl}',
23  apiKey: process.env.${n.apiKeyEnv},
24})
25
26const message = await client.messages.create({
27  model: '${n.modelName}',
28  max_tokens: 1024,
29  messages: [{ role: 'user', content: '${a}' }],
30})
31
32console.log(message.content[0].text)`:`const response = await fetch('${t}', {
33  method: 'POST',
34  headers: {
35    'x-api-key': process.env.${n.apiKeyEnv},
36    'anthropic-version': '2023-06-01',
37    'Content-Type': 'application/json',
38  },
39  body: JSON.stringify({
40    model: '${n.modelName}',
41    max_tokens: 1024,
42    messages: [{ role: 'user', content: '${a}' }],
43  }),
44})
45
46const data = await response.json()
47console.log(data.content[0].text)`}if("gemini"===t){let t=`${n.baseUrl}${n.endpointPath}?key=$${n.apiKeyEnv}`,a="Explain quantum entanglement in one paragraph.";if("curl"===e){let e=JSON.stringify({contents:[{parts:[{text:a}]}]},null,2);return`curl '${t}' \\
48  -H 'Content-Type: application/json' \\
49  -d '${e.replace(/\n/g,"\n     ")}'`}return"python"===e?`import google.generativeai as genai
50
51genai.configure(api_key="<YOUR_API_KEY>")
52
53model = genai.GenerativeModel("${n.modelName}")
54response = model.generate_content("${a}")
55
56print(response.text)`:"typescript"===e?`import { GoogleGenerativeAI } from '@google/generative-ai'
57
58const genAI = new GoogleGenerativeAI(process.env.${n.apiKeyEnv}!)
59const model = genAI.getGenerativeModel({ model: '${n.modelName}' })
60
61const result = await model.generateContent('${a}')
62console.log(result.response.text())`:`const response = await fetch('${t}', {
63  method: 'POST',
64  headers: { 'Content-Type': 'application/json' },
65  body: JSON.stringify({
66    contents: [{ parts: [{ text: '${a}' }] }],
67  }),
68})
69
70const data = await response.json()
71console.log(data.candidates[0].content.parts[0].text)`}if("embeddings"===t||"jina-rerank"===t){let t=`${n.baseUrl}${n.endpointPath}`,a="The food was delicious and the waiter…";if("curl"===e){let e=JSON.stringify({model:n.modelName,input:a},null,2);return`curl ${t} \\
72  -H "Authorization: Bearer $${n.apiKeyEnv}" \\
73  -H "Content-Type: application/json" \\
74  -d '${e.replace(/\n/g,"\n     ")}'`}return"python"===e?`from openai import OpenAI
75
76client = OpenAI(base_url="${n.baseUrl}/v1", api_key="<YOUR_API_KEY>")
77
78response = client.embeddings.create(
79    model="${n.modelName}",
80    input="${a}",
81)
82
83print(response.data[0].embedding[:8])`:"typescript"===e?`import OpenAI from 'openai'
84
85const client = new OpenAI({
86  baseURL: '${n.baseUrl}/v1',
87  apiKey: process.env.${n.apiKeyEnv},
88})
89
90const response = await client.embeddings.create({
91  model: '${n.modelName}',
92  input: '${a}',
93})
94
95console.log(response.data[0].embedding.slice(0, 8))`:`const response = await fetch('${t}', {
96  method: 'POST',
97  headers: {
98    Authorization: \`Bearer \${process.env.${n.apiKeyEnv}}\`,
99    'Content-Type': 'application/json',
100  },
101  body: JSON.stringify({
102    model: '${n.modelName}',
103    input: '${a}',
104  }),
105})
106
107const data = await response.json()
108console.log(data.data[0].embedding.slice(0, 8))`}if("image-generation"===t){let t=`${n.baseUrl}${n.endpointPath}`,a="A serene koi pond at sunset, ukiyo-e style.";if("curl"===e){let e=JSON.stringify({model:n.modelName,prompt:a,size:"1024x1024",n:1},null,2);return`curl ${t} \\
109  -H "Authorization: Bearer $${n.apiKeyEnv}" \\
110  -H "Content-Type: application/json" \\
111  -d '${e.replace(/\n/g,"\n     ")}'`}return"python"===e?`from openai import OpenAI
112
113client = OpenAI(base_url="${n.baseUrl}/v1", api_key="<YOUR_API_KEY>")
114
115response = client.images.generate(
116    model="${n.modelName}",
117    prompt="${a}",
118    size="1024x1024",
119    n=1,
120)
121
122print(response.data[0].url)`:"typescript"===e?`import OpenAI from 'openai'
123
124const client = new OpenAI({
125  baseURL: '${n.baseUrl}/v1',
126  apiKey: process.env.${n.apiKeyEnv},
127})
128
129const response = await client.images.generate({
130  model: '${n.modelName}',
131  prompt: '${a}',
132  size: '1024x1024',
133  n: 1,
134})
135
136console.log(response.data[0].url)`:`const response = await fetch('${t}', {
137  method: 'POST',
138  headers: {
139    Authorization: \`Bearer \${process.env.${n.apiKeyEnv}}\`,
140    'Content-Type': 'application/json',
141  },
142  body: JSON.stringify({
143    model: '${n.modelName}',
144    prompt: '${a}',
145    size: '1024x1024',
146    n: 1,
147  }),
148})
149
150const data = await response.json()
151console.log(data.data[0].url)`}return a=`${n.baseUrl}${n.endpointPath}`,r="openai-response"===n.endpointType,s=/^o[1-4]|reasoning|thinking|deepseek-r/i.test(n.modelName),i="Explain quantum entanglement in one paragraph.",o=r?JSON.stringify({model:n.modelName,input:i},null,2):JSON.stringify({model:n.modelName,messages:[{role:"user",content:i}],...s?{}:{temperature:.7}}
151,null,2),l=r?"responses.create":"chat.completions.create","curl"===e?`curl ${a} \\
152  -H "Authorization: Bearer $${n.apiKeyEnv}" \\
153  -H "Content-Type: application/json" \\
154  -d '${o.replace(/\n/g,"\n     ")}'`:"python"===e?["from openai import OpenAI\n\nclient = OpenAI(",`    base_url="${n.baseUrl}/v1",`,'    api_key="<YOUR_API_KEY>",\n)\n',r?`response = client.${l}(
155    model="${n.modelName}",
156    input="${i}",
157)
158
159print(response.output_text)`:`completion = client.${l}(
160    model="${n.modelName}",
161    messages=[
162        {"role": "user", "content": "${i}"}
163    ],
164)
165
166print(completion.choices[0].message.content)`].join("\n"):"typescript"===e?["import OpenAI from 'openai'\n\nconst client = new OpenAI({",`  baseURL: '${n.baseUrl}/v1',`,`  apiKey: process.env.${n.apiKeyEnv},`,"})\n",r?`const response = await client.${l}({
167  model: '${n.modelName}',
168  input: '${i}',
169})
170
171console.log(response.output_text)`:`const completion = await client.${l}({
172  model: '${n.modelName}',
173  messages: [{ role: 'user', content: '${i}' }],
174})
175
176console.log(completion.choices[0].message.content)`].join("\n"):`const response = await fetch('${a}', {
177  method: 'POST',
178  headers: {
179    Authorization: \`Bearer \${process.env.${n.apiKeyEnv}}\`,
180    'Content-Type': 'application/json',
181  },
182  body: JSON.stringify(${o}),
183})
184
185const data = await response.json()
186console.log(data)`}(l,c.type,{baseUrl:r,apiKeyEnv:"NEW_API_KEY",modelName:e.model.model_name||"",endpointType:c.type,endpointPath:c.path});return(0,a.jsxs)("section",{children:[(0,a.jsx)(em,{icon:U,children:t("Code samples")}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[s.length>1&&(0,a.jsx)(C.tU,{value:i,onValueChange:o,children:(0,a.jsx)(C.j7,{className:"bg-muted/40 h-8 p-0.5",children:s.map(e=>(0,a.jsx)(C.Xi,{value:e.type,className:"h-7 px-2.5 text-xs",children:e.type},e.type))})}),(0,a.jsx)(C.tU,{value:l,onValueChange:e=>d(e),className:"ml-auto",children:(0,a.jsx)(C.j7,{className:"bg-muted/40 h-8 p-0.5",children:Object.keys(ea).map(e=>(0,a.jsx)(C.Xi,{value:e,className:"h-7 px-2.5 text-xs",children:ea[e]},e))})})]}),(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)(q.NG,{code:m,language:er[l],children:(0,a.jsx)(q.gZ,{})})}),(0,a.jsxs)("p",{className:"text-muted-foreground mt-2 text-xs",children:[t("Replace")," ",(0,a.jsx)("code",{className:"bg-muted rounded px-1 py-0.5 font-mono text-[11px]",children:"<YOUR_API_KEY>"})," ",t("with the API key from your token settings.")]})]})}function ei(e){let{t}=(0,N.Bd)(),n=(0,y.useMemo)(()=>{let t;return"reasoning"===(t=et(e.model))?Q:"embedding"===t?Z:"image"===t?X:"video"===t?ee:W},[e.model]);return 0===n.length?null:(0,a.jsxs)("section",{children:[(0,a.jsx)(em,{icon:B,children:t("Supported parameters")}),(0,a.jsx)(j.hm,{className:j.n$.sectionContainer,headerRowClassName:j.n$.mutedHeaderRow,data:n,getRowKey:e=>e.name,getRowClassName:()=>"hover:bg-muted/20",columns:[{id:"parameter",header:t("Parameter"),className:"h-9 w-44",cellClassName:j.n$.topCell,cell:e=>(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("code",{className:"font-mono text-sm font-medium",children:e.name}),e.required&&(0,a.jsx)(V.E,{variant:"outline",className:"h-6 border-rose-500/40 px-2 text-sm text-rose-600 dar
186k:text-rose-400",children:t("required")})]})},{id:"type",header:t("Type"),className:"h-9 w-24",cellClassName:j.n$.topCell,cell:e=>(0,a.jsx)(V.E,{variant:"secondary",className:"h-7 rounded-full px-2.5 font-mono text-sm font-normal",children:e.type})},{id:"range",header:t("Default / range"),className:"h-9 w-32",cellClassName:j.n$.topCell,cell:e=>(0,a.jsx)(eo,{param:e})},{id:"description",header:t("Description"),className:"h-9",cellClassName:j.n$.topMutedCell,cell:e=>t(e.descriptionKey)}]})]})}function eo(e){let{defaultValue:t,range:n,enumValues:r}=e.param;return void 0!==t?(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,a.jsx)("span",{className:"text-muted-foreground text-sm",children:"="}),(0,a.jsx)("code",{className:"bg-muted rounded px-1.5 py-0.5 font-mono text-sm",children:String(t)}),n&&(0,a.jsx)("span",{className:"text-muted-foreground text-sm",children:n})]}):n?(0,a.jsx)("span",{className:"text-muted-foreground font-mono text-sm",children:n}):r&&r.length>0?(0,a.jsx)("div",{className:"flex flex-wrap gap-0.5",children:r.map(e=>(0,a.jsx)("code",{className:"bg-muted text-muted-foreground rounded px-1.5 py-0.5 font-mono text-sm",children:e},e))}):(0,a.jsx)("span",{className:"text-muted-foreground/60 text-sm",children:"—"})}function el(e){let{t}=(0,N.Bd)(),n=(0,y.useMemo)(()=>{var t;let n,a,r,s,i,o,l,d,c;return a=(n=((t=e.model).enable_groups??[]).filter(e=>e&&"auto"!==e)).length>0?n:["default"],r=et(t),s=J(`${t.model_name}:rl`),i="image"===r||"video"===r,o="embedding"===r,l=i?60:o?5e3:500,d=i?0:o?1e6:2e5,c=i?1e3:o?1e5:1e4,a.slice().sort((e,t)=>e.localeCompare(t)).map(e=>{let t,n=.6+1.4*(t=(s^J(e)||1)>>>0,()=>(t=1664525*t+0x3c6ef35f>>>0)/0x100000000)();return{group:e,rpm:10*Math.round(l*n/10),tpm:0===d?0:1e3*Math.round(d*n/1e3),rpd:100*Math.round(c*n/100)}})},[e.model]);return 0===n.length?null:(0,a.jsxs)("section",{children:[(0,a.jsx)(em,{icon:G.A,children:t("Rate limits")}),(0,a.jsx)(j.hm,{className:j.n$.sectionContainer,headerRowClassName:j.n$.mutedHeaderRow,data:n,getRowKey:e=>e.group,getRowClassName:()=>"hover:bg-muted/20",columns:[{id:"group",header:t("Group"),className:"h-9",cellClassName:"py-2 font-mono",cell:e=>e.group},{id:"rpm",header:"RPM",className:"h-9 text-right",cellClassName:j.n$.topNumericCell,cell:e=>en(e.rpm)},{id:"tpm",header:"TPM",className:"h-9 text-right",cellClassName:j.n$.topNumericCell,cell:e=>en(e.tpm)},{id:"rpd",header:"RPD",className:"h-9 text-right",cellClassName:j.n$.topNumericCell,cell:e=>en(e.rpd)}]}),(0,a.jsx)("p",{className:"text-muted-foreground mt-2 text-[11px] leading-relaxed",children:t("RPM = requests per minute, TPM = tokens per minute, RPD = requests per day. Limits apply per token group.")})]})}function ed(){let{t:e}=(0,N.Bd)();return(0,a.jsxs)("section",{children:[(0,a.jsx)(em,{icon:H.A,children:e("Authentication")}),(0,a.jsxs)("div",{className:"border-border/60 bg-muted/20 flex items-start gap-2 rounded-lg border p-3",children:[(0,a.jsx)(D.A,{className:"text-muted-foreground mt-0.5 size-3.5 shrink-0"}),(0,a.jsxs)("div",{className:"space-y-1.5 text-xs leading-relaxed",children:[(0,a.jsxs)("p",{children:[e("All requests must include")," ",(0,a.jsx)("code",{className:"bg-muted rounded px-1 py-0.5 font-mono text-[11px]",children:"Authorization: Bearer <TOKEN>"})," ",e("header. Anthropic-formatted endpoints accept the")," ",(0,a.jsx)("code",{className:"bg-muted rounded px-1 py-0.5 font-mono text-[11px]",children:"x-api-key"})," ",e("header instead.")]}),(0,a.jsx)("p",{className:"text-muted-foreground",children:e("Generate tokens from the Tokens page; you can scope them to specific models, groups, IPs, and rate-limits.")})]})]})]})}function ec(e){return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)(es,{model:e.model,endpointMap:e.endpointMap}),(0,a.jsx)(ed,{}),(0,a.jsx)(ei,{model:e.model}),(0,a.jsx)(el,{model:e.model})]})}function em(e){let t=e.icon;return(0,a.jsxs)("h3",{className:"text-foreground mb-3 flex items-center gap-1.5 text-sm font-semibold",children:[(0,a.jsx)(t,{className:"text-muted-foreground/70 size-3.5"}),e.children]})}var eu=n(60033),ep=n(59399);n(80825),n(59740);var eg=n(54974),ex=n(76380);function eh(e){return{textColor:"dark"===e?"rgba(255, 255, 255, 0.68)":"rgba(15, 23, 42, 0.58)",gridColor:"dark"===e?"rgba(255, 255, 255, 0.12)":"rgba(15, 23, 42, 0.12)"}}function ef(e){return e.replace(/__(start|end)$/,"")}function eb(e){let{t}=(0,N.Bd)(),{resolvedTheme:n,themeReady:r}=(0,eg.R)(),{textColor:s,gridColor:i}=eh(n),o=(0,y.useMemo)(()=>0===e.series.length?null:{type:"line",data:[{id:"latency",values:e.series.map(e=>{let t;return{time:(t=new Date(e.timestamp).getHours(),`${String(t).padStart(2,"0")}:00`),group:e.group,ttft:e.ttft_ms}})}
186],xField:"time",yField:"ttft",seriesField:"group",smooth:!0,point:{visible:!0,style:{size:5,stroke:"#ffffff",lineWidth:1.5}},line:{style:{lineWidth:2}},legends:{visible:!1},tooltip:{mark:{title:{value:e=>e.time},content:[{key:t("Average TTFT"),value:e=>`${Math.round(e.ttft)} ms`}]}},axes:[{orient:"bottom",label:{style:{fill:s,fontSize:10}},tick:{visible:!1}},{orient:"left",label:{formatMethod:e=>`${e} ms`,style:{fill:s,fontSize:10}},grid:{visible:!0,style:{lineDash:[3,3],stroke:i}}}]},[i,e.series,t,s]);return 0===e.series.length?(0,a.jsx)("div",{className:(0,P.cn)("text-muted-foreground flex h-48 items-center justify-center rounded-lg border text-xs",e.className),children:t("No latency data available")}):(0,a.jsx)("div",{className:(0,P.cn)("h-64 sm:h-72",e.className),children:r&&o&&(0,a.jsx)(ep.F,{spec:{...o,theme:"dark"===n?"dark":"light",background:"transparent"},option:ex.X},`latency-${n}`)})}function ey(e){let{t}=(0,N.Bd)(),{resolvedTheme:n,themeReady:r}=(0,eg.R)(),{textColor:s,gridColor:i}=eh(n),o=(0,y.useMemo)(()=>{if(0===e.series.length)return null;let n=e.series.map(e=>{var t,n;let a;return{date:(a=new Date(t=e.date),t.includes("T")?a.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit"}):a.toLocaleDateString(void 0,{month:"short",day:"numeric"})),uptime:Number.isFinite(n=e.uptime_pct)?Math.min(100,Math.max(0,n)):0,incidents:e.incidents,outage:e.outage_minutes}}),a=1===n.length?[{...n[0],date:`${n[0].date}__start`},{...n[0],date:`${n[0].date}__end`}]:n,r=function(e){let t=e.filter(e=>Number.isFinite(e));if(0===t.length)return 95;let n=Math.max(0,Math.min(...t));return n>=95?95:n>=90?90:Math.max(0,10*Math.floor((n-5)/10))}(n.map(e=>e.uptime));return{type:"line",data:[{id:"uptime",values:a}],xField:"date",yField:"uptime",smooth:!0,line:{style:{stroke:"#10b981",lineWidth:2}},point:{visible:!0,style:{size:5,stroke:"#ffffff",lineWidth:1.5,fill:e=>(0,M.tN)(e.uptime)}},tooltip:{mark:{title:{value:e=>ef(e.date)},content:[{key:t("Uptime"),value:e=>`${e.uptime.toFixed(2)}%`},{key:t("Incidents"),value:e=>`${e.incidents}`},{key:t("Outage"),value:e=>`${e.outage} ${t("minutes")}`}]}},axes:[{orient:"bottom",label:{formatMethod:e=>ef(String(e)),style:{fill:s,fontSize:10},autoLimit:!0},tick:{visible:!1}},{orient:"left",min:r,max:100,label:{formatMethod:e=>`${e}%`,style:{fill:s,fontSize:10}},grid:{visible:!0,style:{lineDash:[3,3],stroke:i}}}]}},[i,e.series,t,s]);return 0===e.series.length?(0,a.jsx)("div",{className:(0,P.cn)("text-muted-foreground flex h-48 items-center justify-center rounded-lg border text-xs",e.className),children:t("No uptime data available")}):(0,a.jsx)("div",{className:(0,P.cn)("h-56 sm:h-64",e.className),children:r&&o&&(0,a.jsx)(ep.F,{spec:{...o,theme:"dark"===n?"dark":"light",background:"transparent"},option:ex.X},`uptime-trend-${n}`)})}var eN=n(52909);function ev(e){let t=e.size??"md",n=e.showOverall??!0;if(0===e.series.length)return(0,a.jsx)("span",{className:(0,P.cn)("text-muted-foreground text-xs",e.className),children:e.emptyLabel??"—"});let r=e.series.reduce((e,t)=>e+t.uptime_pct,0)/e.series.length,s="sm"===t?"h-3.5":"h-5",i="sm"===t?"w-[3px]":"w-1";return(0,a.jsxs)("div",{className:(0,P.cn)("flex items-center gap-2",e.className),children:[(0,a.jsx)("div",{className:(0,P.cn)("flex items-end",s,"sm"===t?"gap-px":"gap-[2px]"),role:"img","aria-label":`30 day uptime ${r.toFixed(2)}%`,children:e.series.map(e=>{var t;return(0,a.jsxs)(eN.m_,{children:[(0,a.jsx)(eN.k$,{render:(0,a.jsx)("div",{className:(0,P.cn)("rounded-sm transition-opacity hover:opacity-80",i,s,"flex items-end")}),children:(0,a.jsx)("div",{className:(0,P.cn)("w-full rounded-sm",(0,M.NY)(e.uptime_pct),(t=e.uptime_pct)>=99.9?"h-full":t>=99?"h-[88%]":t>=95?"h-[72%]":t>=90?"h-[55%]":"h-[40%]"),"aria-hidden":!0})}),(0,a.jsxs)(eN.ZI,{side:"top",className:"font-mono text-xs",children:[(0,a.jsx)("div",{className:"font-medium",children:e.date}),(0,a.jsxs)("div",{children:[e.uptime_pct.toFixed(2),"%"]}),e.outage_minutes>0&&(0,a.jsxs)("div",{className:"text-muted-foreground",children:[e.outage_minutes," min outage"]})]})]},e.date)})}),n&&(0,a.jsxs)("span",{className:(0,P.cn)("font-mono text-sm font-semibold tabular-nums",(0,M.NA)(r)),children:[r.toFixed(1),"%"]})]})}function ej(e){let t=e.icon;return(0,a.jsxs)("div",{className:"bg-background flex flex-col gap-1 rounded-lg border p-3",children:[(0,a.jsxs)("span",{className:"text-muted-foreground inline-flex items-center gap-1.5 text-[10px] font-medium tracking-wider up
186percase",children:[(0,a.jsx)(t,{className:"size-3"}),e.label]}),(0,a.jsx)("span",{className:(0,P.cn)("text-foreground font-mono text-lg font-semibold tabular-nums",e.valueClassName),children:e.value}),e.hint&&(0,a.jsx)("span",{className:"text-muted-foreground/70 text-[11px]",children:e.hint})]})}function e_(e){return Number.isFinite(e)?Math.round(100*Math.min(100,Math.max(0,e)))/100:0}function ew(e){let t,{t:n}=(0,N.Bd)(),s=(0,r.I)({queryKey:["perf-metrics",e.model.model_name],queryFn:()=>(0,R.J)(e.model.model_name,24),staleTime:6e4}),i=(0,y.useMemo)(()=>s.data?.data.groups??[],[s.data]),o=(0,y.useMemo)(()=>i.map(e=>({group:e.group,avg_ttft_ms:e.avg_ttft_ms,avg_latency_ms:e.avg_latency_ms,success_rate:e.success_rate,avg_tps:e.avg_tps})),[i]),c=(0,y.useMemo)(()=>(function(e){let t=new Map;for(let n of e)for(let e of n.series){if(e.avg_ttft_ms<=0)continue;let n=t.get(e.ts)??[];n.push(e.avg_ttft_ms),t.set(e.ts,n)}return Array.from(t.entries()).sort((e,t)=>{let[n]=e,[a]=t;return n-a}).map(e=>{let[t,n]=e;return{timestamp:new Date(1e3*t).toISOString(),group:"latency",ttft_ms:Math.round(n.reduce((e,t)=>e+t,0)/n.length)}})})(i),[i]),m=(0,y.useMemo)(()=>(function(e){let t=new Map;for(let n of e)for(let e of n.series){let n=t.get(e.ts)??{rates:[],incidents:0};if(Number.isFinite(e.success_rate)){let t=e_(e.success_rate);n.rates.push(t),t<100&&(n.incidents+=1)}t.set(e.ts,n)}return Array.from(t.entries()).sort((e,t)=>{let[n]=e,[a]=t;return n-a}).map(e=>{let[t,n]=e,a=n.rates.length>0?n.rates.reduce((e,t)=>e+t,0)/n.rates.length:0;return{date:new Date(1e3*t).toISOString(),uptime_pct:e_(a),incidents:n.incidents,outage_minutes:0}})})(i),[i]),u=(0,y.useMemo)(()=>{let e={};for(let t of i)e[t.group]=t.series.map(e=>{let t=e_(e.success_rate);return{date:new Date(1e3*e.ts).toISOString(),uptime_pct:t,incidents:+(t<100),outage_minutes:0}});return e},[i]);if(s.isLoading||0===o.length)return(0,a.jsx)("div",{className:"text-muted-foreground rounded-lg border p-6 text-center text-sm",children:n("Performance data is not yet available for this model.")});let p=o.map(e=>e.avg_tps).filter(e=>e>0),g=p.length>0?p.reduce((e,t)=>e+t,0)/p.length:0,x=0===(t=o.map(e=>e.avg_latency_ms).filter(e=>e>0)).length?0:Math.round(t.reduce((e,t)=>e+t,0)/t.length),h=o.map(e=>e.success_rate).filter(e=>Number.isFinite(e)),f=h.length>0?h.reduce((e,t)=>e+t,0)/h.length:0,b=m.reduce((e,t)=>e+t.incidents,0);return(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3",children:[(0,a.jsx)(ej,{icon:l.A,label:"TPS",value:(0,M.Y5)(g),hint:n("Sustained tokens per second")}),(0,a.jsx)(ej,{icon:l.A,label:n("Average latency"),value:(0,M.YL)(x)}),(0,a.jsx)(ej,{icon:d.A,label:n("Success rate"),value:(0,M.Fm)(f),hint:b>0?n("{{count}} incidents in the last 24 hours",{count:b}):n("No incidents in the last 24 hours"),valueClassName:(0,M.NA)(f)})]}),(0,a.jsxs)("section",{children:[(0,a.jsx)(ek,{icon:d.A,title:n("Per-group performance"),description:n("Average latency, TTFT, TPS, and success rate")}),(0,a.jsx)(j.hm,{className:"rounded-lg",tableClassName:"text-sm",headerRowClassName:j.n$.compactHeaderRow,data:o,getRowKey:e=>e.group,columns:[{id:"group",header:n("Group"),className:j.n$.compactHeaderCell,cellClassName:j.n$.compactCell,cell:e=>(0,a.jsx)(w.d,{group:e.group,size:"sm"})},{id:"tps",header:"TPS",className:j.n$.compactHeaderCellRight,cellClassName:j.n$.compactNumericCell,cell:e=>(0,M.Y5)(e.avg_tps)},{id:"ttft",header:n("Average TTFT"),className:j.n$.compactHeaderCellRight,cellClassName:j.n$.compactNumericCell,cell:e=>(0,M.YL)(e.avg_ttft_ms)},{id:"latency",header:n("Average latency"),className:j.n$.compactHeaderCellRight,cellClassName:j.n$.compactMutedNumericCell,cell:e=>(0,M.YL)(e.avg_latency_ms)},{id:"success",header:n("Success rate"),className:(0,P.cn)(j.n$.compactHeaderCell,"min-w-[180px]"),cellClassName:j.n$.compactCell,cell:e=>(0,a.jsx)(ev,{size:"sm",series:u[e.group]??[]})}]})]}),(0,a.jsxs)("section",{children:[(0,a.jsx)(ek,{icon:l.A,title:n("Latency trend (last 24h)"),description:n("Average TTFT")}),(0,a.jsx)(eb,{series:c})]}),(0,a.jsxs)("section",{children:[(0,a.jsx)(ek,{icon:d.A,title:n("Availability (last 24h)"),description:b>0?n("Request success rate; {{incidents}} incident buckets in the last 24 hours",{incidents:b}):n("Request success rate sampled over the last 24 hours"),accent:b>0?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 text-amber-600 dar
186k:text-amber-400",children:[(0,a.jsx)(eu.A,{className:"size-3.5"}),n("{{count}} incidents",{count:b})]}):null}),(0,a.jsx)(ey,{series:m})]})]})}function ek(e){let t=e.icon;return(0,a.jsxs)("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,a.jsx)(t,{className:"text-muted-foreground/70 size-3.5 shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"text-foreground text-sm font-semibold",children:e.title}),e.description&&(0,a.jsx)("p",{className:"text-muted-foreground/80 text-xs",children:e.description})]})]}),e.accent&&(0,a.jsx)("div",{className:"shrink-0 text-xs font-medium",children:e.accent})]})}function e$(e){return(0,a.jsx)("h2",{className:"text-muted-foreground mb-3 text-xs font-semibold tracking-wider uppercase",children:e.children})}let eA={function_calling:"Function calling",streaming:"Streaming",vision:"Vision",json_mode:"JSON mode",structured_output:"Structured output",reasoning:"Reasoning",tools:"Tools",system_prompt:"System prompt",web_search:"Web search",code_interpreter:"Code interpreter",caching:"Prompt caching",embeddings:"Embeddings"},eE={text:"Text",image:"Image",audio:"Audio",video:"Video",file:"File"},eC=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),eR=["first","second","third","fourth"];function eM(e){return!Number.isFinite(e)||e<=0?"":e>=1e6?`${eC.format(e/1e6)}M`:e>=1e3?`${eC.format(e/1e3)}K`:eC.format(e)}function eK(e){if(!e)return"";let[t,n]=e.split("-"),a=Number(t),r=Number(n);return Number.isFinite(a)&&Number.isFinite(r)?new Date(Date.UTC(a,r-1,1)).toLocaleString(void 0,{year:"numeric",month:"short"}):e}function eP(e){return e?e.filter(e=>e.trim().length>0):[]}function eF(e){let t=e.icon;return(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2 px-3 py-2",children:[(0,a.jsx)(t,{className:"text-muted-foreground/70 size-3.5 shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-muted-foreground truncate text-[10px] font-medium tracking-wider uppercase",children:e.label}),(0,a.jsx)("div",{className:(0,P.cn)("text-foreground truncate font-mono text-sm font-semibold tabular-nums",e.valueClassName),children:e.value})]})]})}function eS(e){let{t}=(0,N.Bd)(),n=(0,r.I)({queryKey:["perf-metrics",e.model.model_name],queryFn:()=>(0,R.J)(e.model.model_name,24),staleTime:6e4}),s=n.data?.data.groups??[],i=s.map(e=>e.success_rate).filter(e=>Number.isFinite(e)),o=i.length>0?i.reduce((e,t)=>e+t,0)/i.length:NaN,c=s.map(e=>e.avg_tps).filter(e=>e>0),m=c.length>0?c.reduce((e,t)=>e+t,0)/c.length:0,u=s.map(e=>e.avg_latency_ms).filter(e=>e>0),p=u.length>0?Math.round(u.reduce((e,t)=>e+t,0)/u.length):0;return(0,a.jsxs)("div",{className:"bg-muted/20 grid overflow-hidden rounded-lg border sm:grid-cols-3 sm:divide-x",children:[(0,a.jsx)(eF,{icon:l.A,label:"TPS",value:(0,M.Y5)(m)}),(0,a.jsx)(eF,{icon:l.A,label:t("Average latency"),value:(0,M.YL)(p)}),(0,a.jsx)(eF,{icon:d.A,label:t("Success rate"),value:(0,M.Fm)(o),valueClassName:(0,M.NA)(o)})]})}function eT(e){return(0,a.jsx)("div",{className:"flex min-w-0 flex-wrap gap-1.5",children:e.items.map(e=>(0,a.jsx)("span",{className:"bg-muted text-muted-foreground rounded-md px-2 py-1 text-xs font-medium",children:e},e))})}function eO(e){return(0,a.jsx)("span",{className:"text-foreground min-w-0 truncate text-sm font-semibold",children:e.children})}function eL(e){return(0,a.jsxs)("div",{className:"bg-card flex min-w-0 flex-col gap-1 px-3 py-2.5",children:[(0,a.jsx)("span",{className:"text-muted-foreground text-[10px] font-medium tracking-wider uppercase",children:e.label}),e.children]})}function eI(e){let{t}=(0,N.Bd)();return 0===e.items.length?null:(0,a.jsx)("span",{className:"inline-flex items-center gap-1 align-middle",children:e.items.map(e=>(0,a.jsx)("span",{className:"font-medium",children:t(eE[e]??e)},e))})}function ez(e){let{t}=(0,N.Bd)(),n=e.model,r=eP(n.input_modalities),s=eP(n.output_modalities),i=n.context_length??0,o=n.max_output_tokens??0,l=eK(n.knowledge_cutoff),d=eK(n.release_date),x=[];return(i>0&&x.push({key:"context",icon:c.A,label:t("Context"),value:eM(i),hint:t("Maximum input window")}),o>0&&x.push({key:"max-output",icon:m.A,label:t("Max output"),value:eM(o),hint:t("Maximum tokens per response")}),(r.length>0||s.length>0)&&x.push({key:"modalities",icon:u.A,label:t("Modalities"),value:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,a.jsx)(eI,{items:r}),r.length>0&&s.length>
1860&&(0,a.jsx)("span",{className:"text-muted-foreground/40",children:"→"}),(0,a.jsx)(eI,{items:s})]})}),l&&x.push({key:"knowledge",icon:p.A,label:t("Knowledge cutoff"),value:l}),d&&x.push({key:"release",icon:g.A,label:t("Released"),value:d}),0===x.length)?null:(0,a.jsx)("div",{className:"bg-muted/20 grid grid-cols-2 gap-px overflow-hidden rounded-lg border @md/details:grid-cols-3 @2xl/details:grid-cols-5",children:x.map(e=>{let t=e.icon;return(0,a.jsxs)("div",{className:"bg-background flex min-w-0 flex-col gap-0.5 px-3 py-2.5",children:[(0,a.jsxs)("span",{className:"text-muted-foreground inline-flex min-w-0 items-center gap-1 text-[10px] font-medium tracking-wider uppercase",children:[(0,a.jsx)(t,{className:"size-3 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e.label})]}),(0,a.jsx)("span",{className:"text-foreground truncate text-sm font-semibold tabular-nums",children:e.value}),e.hint&&(0,a.jsx)("span",{className:"text-muted-foreground/60 truncate text-[10px]",children:e.hint})]},e.key)})})}function eU(e){let{t}=(0,N.Bd)(),n=eP(e.model.capabilities),r=eP(e.model.input_modalities),s=eP(e.model.output_modalities);return 0===n.length&&0===r.length&&0===s.length?null:(0,a.jsxs)("section",{children:[(0,a.jsxs)(e$,{children:[t("Capabilities")," / ",t("Supported modalities")]}),(0,a.jsxs)("div",{className:"grid gap-3 rounded-xl border p-3 @2xl/details:grid-cols-[minmax(0,1.5fr)_minmax(260px,1fr)]",children:[n.length>0?(0,a.jsx)(eT,{items:n.map(e=>t(eA[e]??e))}):(0,a.jsx)("div",{}),(r.length>0||s.length>0)&&(0,a.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[r.length>0&&(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border px-3 py-2",children:[(0,a.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:t("Input")}),(0,a.jsx)(eO,{children:(0,a.jsx)(eI,{items:r})})]}),s.length>0&&(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border px-3 py-2",children:[(0,a.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:t("Output")}),(0,a.jsx)(eO,{children:(0,a.jsx)(eI,{items:s})})]})]})]})]})}function eB(e){let{t}=(0,N.Bd)(),n=e.model,r=eP(n.enable_groups),s=eP(n.supported_endpoint_types),i=(0,T.rL)(n.tags),o=[];return(n.vendor_name&&o.push((0,a.jsx)(eL,{label:t("Provider"),children:(0,a.jsx)(eO,{children:n.vendor_name})},"provider")),o.push((0,a.jsx)(eL,{label:t("Type"),children:(0,a.jsx)(z.v,{model:n})},"type")),r.length>0&&o.push((0,a.jsx)(eL,{label:t("Groups"),children:(0,a.jsx)(eT,{items:r})},"groups")),s.length>0&&o.push((0,a.jsx)(eL,{label:t("Endpoints"),children:(0,a.jsx)(eT,{items:s})},"endpoints")),i.length>0&&o.push((0,a.jsx)(eL,{label:t("Tags"),children:(0,a.jsx)(eT,{items:i})},"tags")),n.parameter_count&&o.push((0,a.jsx)(eL,{label:t("Parameters"),children:(0,a.jsx)(eO,{children:n.parameter_count})},"parameters")),0===o.length)?null:(0,a.jsxs)("section",{children:[(0,a.jsx)(e$,{children:t("Model")}),(0,a.jsx)("div",{className:"border-border/60 bg-border/60 grid grid-cols-1 gap-px overflow-hidden rounded-lg border sm:grid-cols-2",children:o})]})}function eG(e){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ez,{model:e.model}),(0,a.jsx)(eU,{model:e.model}),(0,a.jsx)(eB,{model:e.model})]})}function eH(e){let{t}=(0,N.Bd)(),n=e.model,r=n.icon||n.vendor_icon,s=r?(0,K.Y)(r,20):null,i=n.description||n.vendor_description||null;return(0,a.jsxs)("header",{className:"pb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[s,(0,a.jsx)("h1",{className:"font-mono text-xl font-bold tracking-tight sm:text-2xl",children:n.model_name}),(0,a.jsx)(v.i,{value:n.model_name||"",className:"size-6",iconClassName:"size-3",tooltip:t("Copy model name"),successTooltip:t("Copied!"),"aria-label":t("Copy model name")})]}),(0,a.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-xs",children:[n.vendor_name&&(0,a.jsx)("span",{className:"text-muted-foreground",children:n.vendor_name}),(0,a.jsx)("span",{className:"text-muted-foreground/30",children:"·"}),(0,a.jsx)(z.v,{model:n})]}),i&&(0,a.jsx)("p",{className:"text-muted-foreground mt-2 text-sm leading-relaxed",children:i})]})}function eD(e){let{t}=(0,N.Bd)(),n=(0,O.ow)(e.model),r="K"===e.tokenUnit?"1K":"1M",s="_base",i={[s]:1},o=(0,S.kK)(e.model,{tokenUnit:e.tokenUnit,showRechargePrice:e.showRechargePrice,priceRate:e.priceRate,usdExchangeRate:e.usdExchangeRate,groupRatioMultiplier:1}),l=[{label:t("Input"),type:"input"},{label:t("Output"),type:"output"}],d=[{label:t("Cached input"),type:"cache",available:null!=e.model.cache_ratio},{label:t("Cache write"),type:"create_cache",available:null!=e.model.create_cache_ratio},{label:t("Image input"),type:"image",available:null!=e.model.image_ratio},{label:t("Audio input"),type:"audio_input",available:null!=e.model.audio_ratio},{label:t("Audio output"),type:"audio_output",available:null!=e.model.audio_ratio&&null!=e.model.audio_completion_ratio}];if(o)return o.isSpecialExpression?(0,a.jsxs)("section",{children:[(0,a.jsx)(e$,{children:t("Base Price")}),(0,a.jsxs)("div",{className:"rounded-lg border border-amber-200/70 bg-amber-50/70 p-3 dark:border-amber-500/20 dark:bg-amber-500/10",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:t("Special billing expression")}),(0,a.jsx)("p",{className:"text-muted-foreground mt-1 text-xs",children:t("Unable to parse structured pricing")}),(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("div",{className:"text-muted-foreground mb-1 text-[10px] font-medium tracking-wider up
186percase",children:t("Raw expression")}),(0,a.jsx)("code",{className:"text-muted-foreground bg-background/80 block max-h-28 overflow-auto rounded-md border px-2 py-1.5 font-mono text-xs break-all",children:o.rawExpression})]})]})]}):(0,a.jsxs)("section",{children:[(0,a.jsx)(e$,{children:t("Base Price")}),o.primaryEntries.length>0?(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2",children:o.primaryEntries.map(e=>(0,a.jsxs)("div",{className:"bg-muted/20 rounded-lg border p-3",children:[(0,a.jsx)("div",{className:"text-muted-foreground text-xs",children:t(e.shortLabel)}),(0,a.jsxs)("div",{className:"text-foreground mt-1 font-mono text-base font-semibold tabular-nums",children:[e.formatted,(0,a.jsxs)("span",{className:"text-muted-foreground/40 ml-1 text-xs font-normal",children:["/ ",r]})]})]},e.key))}):(0,a.jsx)("p",{className:"text-muted-foreground text-sm",children:t("Dynamic Pricing")}),o.secondaryEntries.length>0&&(0,a.jsx)("div",{className:"bg-muted/20 mt-3 rounded-lg border px-3 py-2.5",children:(0,a.jsx)("div",{className:"space-y-1.5",children:o.secondaryEntries.map(e=>(0,a.jsxs)("div",{className:"flex items-baseline justify-between gap-4",children:[(0,a.jsx)("span",{className:"text-muted-foreground/70 text-sm",children:t(e.shortLabel)}),(0,a.jsxs)("span",{className:"text-muted-foreground font-mono text-sm tabular-nums",children:[e.formatted,(0,a.jsxs)("span",{className:"text-muted-foreground/40 ml-1 text-xs font-normal",children:["/ ",r]})]})]},e.key))})})]});if(!n)return(0,a.jsxs)("section",{children:[(0,a.jsx)(e$,{children:t("Base Price")}),(0,a.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,a.jsx)("span",{className:"text-muted-foreground text-sm",children:t("Per request")}),(0,a.jsx)("span",{className:"text-foreground font-mono text-sm font-semibold tabular-nums",children:(0,L.PB)(e.model,s,e.showRechargePrice,e.priceRate,e.usdExchangeRate,i)})]})]});let c=d.filter(e=>e.available),m=t=>(0,a.jsxs)(a.Fragment,{children:[(0,L.e$)(e.model,s,t,e.tokenUnit,e.showRechargePrice,e.priceRate,e.usdExchangeRate,i),(0,a.jsxs)("span",{className:"text-muted-foreground/40 ml-1 text-xs font-normal",children:["/ ",r]})]});return(0,a.jsxs)("section",{children:[(0,a.jsx)(e$,{children:t("Base Price")}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2",children:l.map(e=>(0,a.jsxs)("div",{className:"bg-muted/20 rounded-lg border p-3",children:[(0,a.jsx)("div",{className:"text-muted-foreground text-xs",children:e.label}),(0,a.jsx)("div",{className:"text-foreground mt-1 font-mono text-base font-semibold tabular-nums",children:m(e.type)})]},e.type))}),c.length>0&&(0,a.jsx)("div",{className:"bg-muted/20 mt-3 rounded-lg border px-3 py-2.5",children:(0,a.jsx)("div",{className:"space-y-1.5",children:c.map(e=>(0,a.jsxs)("div",{className:"flex items-baseline justify-between gap-4",children:[(0,a.jsx)("span",{className:"text-muted-foreground/70 text-sm",children:e.label}),(0,a.jsx)("span",{className:"text-muted-foreground font-mono text-sm tabular-nums",children:m(e.type)})]},e.type))})})]})}function eq(e){let{t}=(0,N.Bd)(),n=Array.isArray(e.model.enable_groups)?e.model.enable_groups:[],r=e.autoGroups.filter(e=>n.includes(e));return 0===r.length?null:(0,a.jsxs)("div",{className:"text-muted-foreground mb-3 flex flex-wrap items-center gap-1 text-xs",children:[(0,a.jsx)("span",{className:"font-medium",children:t("Auto Group Chain")}),(0,a.jsx)("span",{className:"text-muted-foreground/40",children:"→"}),r.map((e,t)=>(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(w.d,{group:e,size:"sm"}),t<r.length-1&&(0,a.jsx)("span",{className:"text-muted-foreground/40",children:"→"})]},e))]})}function eV(e){let{t}=(0,N.Bd)(),n=e.showRechargePrice??!1,r=(0,y.useMemo)(()=>(0,O.sK)(e.model,e.usableGroup||{}),[e.model,e.usableGroup]),s=(0,O.ow)(e.model),i="K"===e.tokenUnit?"1K":"1M",o=(0,y.useMemo)(()=>{let n=[];return null!=e.model.cache_ratio&&n.push({label:t("Cache"),type:"cache"}),null!=e.model.create_cache_ratio&&n.push({label:t("Cache Write"),type:"create_cache"}),null!=e.model.image_ratio&&n.push({label:t("Image"),type:"image"}),null!=e.model.audio_ratio&&n.push({label:t("Audio In"),type:"audio_input"}),null!=e.model.audio_ratio&&null!=e.model.audio_completion_ratio&&n.push({label:t("Audio Out"),type:"audio_output"}),n},[e.model,t]);if(0===r.length)return(0,a.jsxs)("section",{children:[(0,a.jsx)(e$,{children:t("Pricing by Group")}),(0,a.jsx)(eq,{model:e.model,autoGroups:e.autoGroups}),(0,a.jsx)("p",{className:"text-muted-foreground text-sm",children:t("This model is not available in any group, or no group pricing information is configured.")})]});let l="text-muted-foreground py-2 text-[10px] font-medium tracking-wider up
186percase";if((0,S.h8)(e.model)){var d;let s=(0,S.ZP)(e.model);if(0===s.length)return(0,a.jsxs)("section",{children:[(0,a.jsx)(e$,{children:t("Pricing by Group")}),(0,a.jsx)(eq,{model:e.model,autoGroups:e.autoGroups}),(0,a.jsxs)("div",{className:"rounded-lg border border-amber-200/70 bg-amber-50/70 p-3 dark:border-amber-500/20 dark:bg-amber-500/10",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:t("Special billing expression")}),(0,a.jsx)("p",{className:"text-muted-foreground mt-1 text-xs",children:t("Group prices cannot be expanded because this expression is not a standard tiered pricing expression.")}),(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("div",{className:"text-muted-foreground mb-1 text-[10px] font-medium tracking-wider uppercase",children:t("Raw expression")}),(0,a.jsx)("code",{className:"text-muted-foreground bg-background/80 block max-h-28 overflow-auto rounded-md border px-2 py-1.5 font-mono text-xs break-all",children:e.model.billing_expr})]})]})]});let o=(d={tokenUnit:e.tokenUnit,showRechargePrice:n,priceRate:e.priceRate,usdExchangeRate:e.usdExchangeRate,groupRatioMultiplier:1},[...new Map(s.flatMap(e=>(0,S.XY)(e,d)).map(e=>[e.field,e])).values()]),c=new Map(r.map(t=>{var a;let r=e.groupRatio[t]||1;return[t,(a={tokenUnit:e.tokenUnit,showRechargePrice:n,priceRate:e.priceRate,usdExchangeRate:e.usdExchangeRate,groupRatioMultiplier:r},new Map(s.map(e=>[e,new Map((0,S.XY)(e,a).map(e=>[e.field,e.formatted]))])))]}));return(0,a.jsxs)("section",{children:[(0,a.jsx)(e$,{children:t("Pricing by Group")}),(0,a.jsx)(eq,{model:e.model,autoGroups:e.autoGroups}),(0,a.jsxs)("div",{className:"space-y-3",children:[r.map(n=>{let r=e.groupRatio[n]||1,i=c.get(n)??new Map;return(0,a.jsxs)("div",{className:"overflow-hidden rounded-lg border",children:[(0,a.jsxs)("div",{className:"bg-muted/20 flex items-center justify-between gap-3 border-b px-3 py-2",children:[(0,a.jsx)(w.d,{group:n,size:"sm"}),(0,a.jsxs)("span",{className:"text-muted-foreground font-mono text-xs",children:[r,"x"]})]}),(0,a.jsx)(j.hm,{className:"rounded-none border-0",tableClassName:"text-sm",headerRowClassName:"hover:bg-transparent",data:s,getRowKey:(e,t)=>`${n}-${e.label||t}`,columns:[{id:"tier",header:t("Tier"),className:l,cellClassName:"text-muted-foreground py-2.5",cell:e=>e.label||t("Default")},...o.map(e=>({id:e.field,header:t(e.shortLabel),className:`${l} text-right`,cellClassName:"py-2.5 text-right font-mono",cell:t=>i.get(t)?.get(e.field)??"-"}))]})]},n)}),(0,a.jsxs)("p",{className:"text-muted-foreground/40 mt-1.5 text-[10px]",children:[t("Prices shown per")," ",i," tokens"]})]})]})}let c=(t,a)=>(0,L.e$)(e.model,t,a,e.tokenUnit,n,e.priceRate,e.usdExchangeRate,e.groupRatio);return(0,a.jsxs)("section",{children:[(0,a.jsx)(e$,{children:t("Pricing by Group")}),(0,a.jsx)(eq,{model:e.model,autoGroups:e.autoGroups}),(0,a.jsx)(j.hm,{className:"-mx-4 rounded-none border-0 sm:mx-0",tableClassName:"text-sm",headerRowClassName:"hover:bg-transparent",data:r,getRowKey:e=>e,columns:[{id:"group",header:t("Group"),className:l,cellClassName:"py-2.5",cell:e=>(0,a.jsx)(w.d,{group:e,size:"sm"})},{id:"ratio",header:t("Ratio"),className:l,cellClassName:"text-muted-foreground py-2.5 font-mono",cell:t=>`${e.groupRatio[t]||1}x`},...s?[{id:"input",header:t("Input"),className:`${l} text-right`,cellClassName:"py-2.5 text-right font-mono",cell:e=>c(e,"input")},{id:"output",header:t("Output"),className:`${l} text-right`,cellClassName:"py-2.5 text-right font-mono",cell:e=>c(e,"output")},...o.map(e=>({id:e.type,header:e.label,className:`${l} text-right`,cellClassName:"py-2.5 text-right font-mono",cell:t=>c(t,e.type)}))]:[{id:"price",header:t("Price"),className:`${l} text-right`,cellClassName:"py-2.5 text-right font-mono",cell:t=>(0,L.PB)(e.model,t,n,e.priceRate,e.usdExchangeRate,e.groupRatio)}]]}),(0,a.jsx)("div",{className:"-mx-4 sm:mx-0",children:s&&(0,a.jsxs)("p",{className:"text-muted-foreground/40 mt-1.5 px-4 text-[10px] sm:px-0",children:[t("Prices shown per")," ",i," tokens"]})})]})}let eY=["overview","performance","api"],eJ={overview:{icon:x.A,labelKey:"Overview"},performance:{icon:d.A,labelKey:"Performance"},api:{icon:h.A,labelKey:"API"}};function eW(e){let{t}=(0,N.Bd)(),n=e.showRechargePrice??!1,r="tiered_expr"===e.model.billing_mode&&!!e.model.billing_expr;
186return(0,a.jsxs)("div",{className:"@container/details space-y-4",children:[(0,a.jsx)(eH,{model:e.model}),(0,a.jsxs)(C.tU,{defaultValue:"overview",className:"gap-4",children:[(0,a.jsx)(C.j7,{className:"bg-muted/60 grid w-full grid-cols-3 gap-1 rounded-lg p-1 group-data-horizontal/tabs:h-auto",children:eY.map(e=>{let n=eJ[e].icon;return(0,a.jsxs)(C.Xi,{value:e,className:"h-8 min-w-0 gap-1.5 rounded-md px-3 text-xs sm:text-sm",children:[(0,a.jsx)(n,{className:"size-3.5"}),(0,a.jsx)("span",{className:"truncate",children:t(eJ[e].labelKey)})]},e)})}),(0,a.jsxs)(C.av,{value:"overview",className:"space-y-6 outline-none",children:[(0,a.jsx)(eS,{model:e.model}),(0,a.jsxs)("section",{className:"bg-card/60 space-y-5 rounded-xl border p-4 shadow-sm",children:[(0,a.jsx)(e$,{children:t("Pricing")}),(0,a.jsx)(eD,{model:e.model,priceRate:e.priceRate,usdExchangeRate:e.usdExchangeRate,tokenUnit:e.tokenUnit,showRechargePrice:n}),r&&(0,a.jsx)(I.N,{billingExpr:e.model.billing_expr}),(0,a.jsx)(eV,{model:e.model,groupRatio:e.groupRatio,usableGroup:e.usableGroup,autoGroups:e.autoGroups,priceRate:e.priceRate,usdExchangeRate:e.usdExchangeRate,tokenUnit:e.tokenUnit,showRechargePrice:n})]}),(0,a.jsx)(eG,{model:e.model})]}),(0,a.jsx)(C.av,{value:"performance",className:"outline-none",children:(0,a.jsx)(ew,{model:e.model})}),(0,a.jsx)(C.av,{value:"api",className:"outline-none",children:(0,a.jsx)(ec,{model:e.model,endpointMap:e.endpointMap})})]})]})}function eQ(e){let{t}=(0,N.Bd)(),{open:n,onOpenChange:r,...s}=e;return(0,a.jsx)(A.cj,{open:n,onOpenChange:r,children:(0,a.jsxs)(A.h,{side:"right",className:(0,_.jW)("sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-5xl"),children:[(0,a.jsxs)(A.Fm,{className:"sr-only",children:[(0,a.jsx)(A.qp,{children:e.model.model_name}),(0,a.jsx)(A.Qs,{children:t("Model details")})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto px-4 pt-11 pb-5 sm:px-6 sm:pt-12 sm:pb-6",children:(0,a.jsx)(eW,{...s})})]})})}function eZ(){let{t:e}=(0,N.Bd)(),{modelId:t}=(0,s.g)({from:"/pricing/$modelId/"}),n=(0,i.S)({from:"/pricing/$modelId/"}),r=(0,o.Z)(),{models:l,groupRatio:d,usableGroup:c,endpointMap:m,autoGroups:u,isLoading:p,priceRate:g,usdExchangeRate:x}=(0,F.y)(),h="K"===n.tokenUnit?"K":"M",f=(0,y.useMemo)(()=>l&&t&&l.find(e=>e.model_name===t)||null,[l,t]),v=()=>{r({to:"/pricing",search:n})};return p?(0,a.jsx)(k.si,{children:(0,a.jsxs)("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[(0,a.jsx)(E.E,{className:"mb-4 h-5 w-16"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(E.E,{className:"h-7 w-64"}),(0,a.jsx)(E.E,{className:"h-4 w-40"}),(0,a.jsx)(E.E,{className:"h-4 w-full max-w-md"})]}),(0,a.jsx)("div",{className:"mt-6 grid grid-cols-2 gap-2 sm:grid-cols-4",children:eR.map(e=>(0,a.jsx)(E.E,{className:"h-16 w-full"},`metric-${e}`))}),(0,a.jsx)("div",{className:"mt-6 space-y-3",children:eR.map(e=>(0,a.jsx)(E.E,{className:"h-24 w-full"},`section-${e}`))})]})}):f?(0,a.jsx)(k.si,{children:(0,a.jsxs)("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[(0,a.jsxs)($.$,{variant:"ghost",size:"sm",onClick:v,className:"text-muted-foreground hover:text-foreground mb-4 h-auto gap-1 px-0 py-1 text-xs",children:[(0,a.jsx)(b,{className:"size-3.5"}),e("Back")]}),(0,a.jsx)(eW,{model:f,groupRatio:d||{},usableGroup:c||{},autoGroups:u||[],priceRate:g??1,usdExchangeRate:x??1,tokenUnit:h,showRechargePrice:n.rechargePrice??!1,endpointMap:m||{}})]})}):(0,a.jsx)(k.si,{children:(0,a.jsxs)("div",{className:"mx-auto max-w-2xl px-4 text-center sm:px-6",children:[(0,a.jsx)("h2",{className:"mb-1 text-base font-semibold",children:e("Model not found")}),(0,a.jsx)("p",{className:"text-muted-foreground mb-4 text-sm",children:e("The model you're looking for doesn't exist.")}),(0,a.jsx)($.$,{onClick:v,variant:"outline",size:"sm",children:e("Back to Models")})]})})}},75498(e,t,n){let a={NAME:"name",PRICE_LOW:"price-low",PRICE_HIGH:"price-high"};function r(e){return{[a.NAME]:e("Name"),[a.PRICE_LOW]:e("Price: Low to High"),[a.PRICE_HIGH]:e("Price: High to Low")}}let s={ALL:"all",TOKEN:"token",REQUEST:"request"};function i(e){return{[s.ALL]:e("All Models"),[s.TOKEN]:e("Token-based"),[s.REQUEST]:e("Per Request")}}let o={ALL:"all",OPENAI:"openai",OPENAI_RESPONSE:"openai-response",ANTHROPIC:"anthropic",GEMINI:"gemini",JINA_RERANK:"jina-rerank",IMAGE_GENERATION:"image-generation",EMBEDDINGS:"embeddings",OPENAI_VIDEO:"openai-video"};function l(e){return{[o.ALL]:e("All Types"),[o.OPENAI]:"Chat",[o.OPENAI_RESPONSE]:"Response",[o.ANTHROPIC]:"Anthropic",[o.GEMINI]:"Gemini",[o.JINA_RERANK]:"Rerank",[o.IMAGE_GENERATION]:e("Image"),[o.EMBEDDINGS]:e("Embeddings"),[o.OPENAI_VIDEO]:e("Video")}}n.d(t,{SZ:()=>i,WU:()=>r,fb:()=>l},{$P:{M:1,K:1e3},An:["","auto"],LW:{TOKEN:0,REQUEST:1},QB:a,pV:{CARD:"card",TABLE:"table"},s4:o,zH:s})},69474(e,t,n){n.d(t,{y:()=>l});var a=n(43866),r=n(65311),s=n(43303),i=n(63228);async function o(){return(await i.FH.get("/api/pricing")).data}function l(){let{status:e}=(0,s.s)(),{data:t,isLoading:n,error:i,refetch:l}=(0,a.I)({queryKey:["pricing"],queryFn:o,staleTime:3e5}),d=(0,r.useMemo)(()=>Math.max(e?.price??1,.001),[e?.price]),c=(0,r.useMemo)(()=>Math.max(e?.usd_exchange_rate??d,.001),[e?.usd_exchange_rate,d]);return{models:(0,r.useMemo)(()=>
186{if(!t?.data||!t?.vendors)return[];let e=new Map(t.vendors.map(e=>[e.id,e]));return t.data.map(n=>{let a=n.vendor_id?e.get(n.vendor_id):void 0;return{...n,key:n.model_name,vendor_name:a?.name,vendor_icon:a?.icon,vendor_description:a?.description,group_ratio:t.group_ratio}})},[t]),vendors:t?.vendors??[],groupRatio:t?.group_ratio??{},usableGroup:t?.usable_group??{},endpointMap:t?.supported_endpoint??{},autoGroups:t?.auto_groups??[],isLoading:n,error:i,refetch:l,priceRate:d,usdExchangeRate:c}}},61574(e,t,n){var a=n(78373),r=n(75498),s=n(91078),i=n(60866);let o=new Set(["inputPrice","outputPrice"]);function l(e){return"tiered_expr"===e.billing_mode&&!!e.billing_expr}function d(e,t){return(0,i.NO)(e,t)}function c(e){if(!l(e))return[];let{billingExpr:t}=(0,s.U8)(e.billing_expr||"");return(0,s.oK)(t)}function m(e,t){return e?s.mq.flatMap(n=>{var s,i;let o,l,d,c;if(!n.field)return[];let m=Number(e[n.field]);return!Number.isFinite(m)||m<=0?[]:[{key:n.key,field:n.field,label:n.label,shortLabel:n.shortLabel,value:m,formatted:(o=t.groupRatioMultiplier??1,l=t.priceRate??1,d=t.usdExchangeRate??1,s=m*o/r.$P[t.tokenUnit],i=t.showRechargePrice??!1,c=i?s*l/d:s,(0,a.AM)(c,{digitsLarge:4,digitsSmall:6,abbreviate:!1})),variable:n}]}).sort((e,t)=>{let n=o.has(e.field);return n!==o.has(t.field)?n?-1:1:0}):[]}function u(e,t){if(!l(e))return null;let n=c(e),a=n[0]||null,r=m(a,t),i=e.billing_expr||"";return{tiers:n,tier:a,tierCount:n.length,hasRequestRules:function(e){if(!l(e))return!1;let{requestRuleExpr:t}=(0,s.U8)(e.billing_expr||"");return!!(0,s.TS)(t||"")?.length}(e),isSpecialExpression:i.trim().length>0&&0===n.length,rawExpression:i,entries:r,primaryEntries:r.filter(e=>o.has(e.field)),secondaryEntries:r.filter(e=>!o.has(e.field))}}n.d(t,{XY:()=>m,ZP:()=>c,h8:()=>l,kK:()=>u,kt:()=>d})},58028(e,t,n){var a=n(75498);function r(e){return 0===e.quota_type?e.model_ratio:e.model_price||0}function s(e,t){var n,s,o,l,d,c;let m=function(e,t){if(!t)return e;let n=t.toLowerCase();return e.filter(e=>e.model_name?.toLowerCase().includes(n)||e.description?.toLowerCase().includes(n)||e.tags?.toLowerCase().includes(n)||e.vendor_name?.toLowerCase().includes(n))}(e,t.search);return n=m,o=m="all"===(s=t.vendor)?n:n.filter(e=>e.vendor_name===s),d=m=function(e,t){if(t===a.zH.ALL)return e;let n=t===a.zH.TOKEN?a.LW.TOKEN:a.LW.REQUEST;return e.filter(e=>e.quota_type===n)}(m="all"===(l=t.group)?o:o.filter(e=>e.enable_groups?.includes(l)),t.quotaType),m=function(e,t){let n=[...e];switch(t){case a.QB.NAME:n.sort((e,t)=>(e.model_name||"").localeCompare(t.model_name||""));break;case a.QB.PRICE_LOW:n.sort((e,t)=>r(e)-r(t));break;case a.QB.PRICE_HIGH:n.sort((e,t)=>r(t)-r(e))}return n}(m=function(e,t){if("all"===t)return e;let n=t.toLowerCase();return e.filter(e=>!!e.tags&&i(e.tags).map(e=>e.toLowerCase()).includes(n))}(m=(c=t.endpointType)===a.s4.ALL?d:d.filter(e=>e.supported_endpoint_types?.includes(c)),t.tag),t.sortBy)}function i(e){return e?e.split(/[,;|\s]+/).map(e=>e.trim()).filter(Boolean):[]}function o(e){let t=new Set;return e.forEach(e=>{e.tags&&i(e.tags).forEach(e=>{t.add(e.toLowerCase())})}),Array.from(t).sort((e,t)=>e.localeCompare(t))}n.d(t,{Mt:()=>o,mv:()=>s,rL:()=>i})},60866(e,t,n){var a=n(75498);function r(e,t){let n=Array.isArray(e.enable_groups)?e.enable_groups:[];return Object.keys(t).filter(e=>!a.An.includes(e)).filter(e=>n.includes(e))}function s(e,t){let n=e[t];return"number"==typeof n&&Number.isFinite(n)?n:1}function i(e,t){let n=Array.isArray(e.enable_groups)?e.enable_groups:[],a=e.group_ratio||{};if(t&&"all"!==t&&n.includes(t))return s(a,t);if(0===n.length)return 1;let r=1/0;for(let e of n){let t=a[e];"number"==typeof t&&Number.isFinite(t)&&t<r&&(r=t)}return r===1/0?1:r}function o(e,t){return e.replaceAll("{model}",t)}function l(e){return e.quota_type===a.LW.TOKEN}n.d(t,{JY:()=>s,NO:()=>i,Oi:()=>o,ow:()=>l,sK:()=>r})},79458(e,t,n){var a=n(78373),r=n(75498),s=n(60866);function i(e){let t=e.match(/^([^\d-]*)([-\d,]+\.?\d*)(k?)$/);if(!t)return e;let[,n,a,r]=t,s=Number.parseFloat(a.replaceAll(",",""));if(Number.isNaN(s))return e;let i=s.toString();return i.includes("e")&&(i=s.toFixed(20).replace(/\.?0+$/,"")),`${n}${i}${r}`}function o(e,t,n){let a=2*e.model_ratio*n;switch(t){case"input":return a;case"output":return a*e.completion_ratio;
186case"cache":return l(e.cache_ratio)?a*Number(e.cache_ratio):NaN;case"create_cache":return l(e.create_cache_ratio)?a*Number(e.create_cache_ratio):NaN;case"image":return l(e.image_ratio)?a*Number(e.image_ratio):NaN;case"audio_input":return l(e.audio_ratio)?a*Number(e.audio_ratio):NaN;case"audio_output":return l(e.audio_ratio)&&l(e.audio_completion_ratio)?a*Number(e.audio_ratio)*Number(e.audio_completion_ratio):NaN}}function l(e){return null!=e&&Number.isFinite(Number(e))}function d(e,t,n){var i,l,d,c;let m=arguments.length>3&&void 0!==arguments[3]&&arguments[3],u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,g=arguments.length>6?arguments[6]:void 0;if(e.quota_type===r.LW.REQUEST)return"-";let x=(0,s.NO)(e,g),h=o(e,t,x),f=(i=h,l=m,d=u,c=p,(h=l?i*d/c:i)/r.$P[n]);return(0,a.J5)(f,{digitsLarge:4,digitsSmall:6,abbreviate:!1})}function c(e,t,n,i){var l,d,c,m;let u=arguments.length>4&&void 0!==arguments[4]&&arguments[4],p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,g=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,x=arguments.length>7?arguments[7]:void 0;if(e.quota_type===r.LW.REQUEST)return"-";let h=o(e,n,(0,s.JY)(x,t)),f=(l=h,d=u,c=p,m=g,(h=d?l*c/m:l)/r.$P[i]);return(0,a.J5)(f,{digitsLarge:4,digitsSmall:6,abbreviate:!1})}function m(e,t){var n,i,o,l;let d=arguments.length>2&&void 0!==arguments[2]&&arguments[2],c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,m=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,u=arguments.length>5?arguments[5]:void 0;if(e.quota_type!==r.LW.REQUEST)return"-";let p=(0,s.JY)(u,t),g=(e.model_price||0)*p;
186return n=g,i=d,o=c,l=m,g=i?n*o/l:n,(0,a.J5)(g,{digitsLarge:4,digitsSmall:4,abbreviate:!1})}function u(e){var t,n,i,o;let l=arguments.length>1&&void 0!==arguments[1]&&arguments[1],d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,m=arguments.length>4?arguments[4]:void 0;if(e.quota_type!==r.LW.REQUEST)return"-";let u=(0,s.NO)(e,m),p=(e.model_price||0)*u;return t=p,n=l,i=d,o=c,p=n?t*i/o:t,(0,a.J5)(p,{digitsLarge:4,digitsSmall:4,abbreviate:!1})}n.d(t,{$g:()=>d,CG:()=>i,PB:()=>m,Yj:()=>u,e$:()=>c})},59740(e,t,n){var a=n(65311);function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"--radius-md",t=arguments.length>1?arguments[1]:void 0,[n,r]=(0,a.useState)();return(0,a.useEffect)(()=>{r(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"--radius-md";if("u"<typeof document)return;let t=document.createElement("div");t.style.borderRadius=`var(${e})`,t.style.pointerEvents="none",t.style.position="absolute",t.style.visibility="hidden",document.documentElement.appendChild(t);let n=getComputedStyle(t).borderTopLeftRadius;t.remove();let a=Number.parseFloat(n);return Number.isFinite(a)?a:void 0}(e))},[e,t]),n}n.d(t,{P:()=>r})},54974(e,t,n){var a=n(65311),r=n(66197);let s=null;function i(){let{resolvedTheme:e}=(0,r.D)(),[t,i]=(0,a.useState)(!1),o=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let t=!1;return(async()=>{i(!1),s||(s=Promise.resolve().then(n.bind(n,89059)).then(e=>e.ThemeManager));let a=await s;
186t||(o.current=a,a.setCurrentTheme("dark"===e?"dark":"light"),i(!0))})(),()=>{t=!0}},[e]),{resolvedTheme:e,themeReady:t}}n.d(t,{R:()=>i})},76380(e,t,n){n.d(t,{},{X:{mode:"desktop-browser"}})},8223(e,t,n){let a=(0,n(40946).A)("calendar-clock",[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);n.d(t,{},{A:a})},37417(e,t,n){let a=(0,n(40946).A)("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);n.d(t,{},{A:a})},85052(e,t,n){let a=(0,n(40946).A)("heart-pulse",[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}],["path",{d:"M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"auskq0"}]]);n.d(t,{},{A:a})},32115(e,t,n){let a=(0,n(40946).A)("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);n.d(t,{},{A:a})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.