mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-29 07:20:43 +00:00
Savings (components/sales/Savings, lib/savings): the tokens a team uses a month, by model or by spend, at the providers' list rates, on Hanzo Cloud moved to an Enso SKU plus the members on Team, and on the reader's own GPUs on all month. Every rate is read when the page opens: the price list (GET /v1/pricing, its on-demand GPU hour too), the plan list (Team's member month) and the model list (what Hanzo bills a provider's model). The volumes, people and GPUs are the reader's, and the page says it opens with an example. Each figure says what it assumes; the GPU figure leaves the agreement out and says so, with where it meets list and that sizing is done with the customer. /calculator carries the same calculator. Your own GPUs: Zen 6's prefill as Hanzo measured it on one DGX Spark (lib/data/zen6-spark.json, scripts/zen6.py, from the enterprise-story branch) and what a Zen 6 Max rack is made of, from NVIDIA's pages (Rack, with Zen 6 Max's page). That branch's Cloud against Enterprise board is left off /benchmarks: it prints a 96.0% the page's gate refuses. Proof shows six of the data room's case studies. Partners are the programmes that exist: affiliates, White-label and the agency's plans as the plan list sells them, and the clouds Hanzo deploys on, captioned as vendors, not partners. No company is called a partner: none is on record.
70 lines
3.2 KiB
TypeScript
70 lines
3.2 KiB
TypeScript
/**
|
|
* /enterprise's savings: the same monthly tokens priced three ways, every rate
|
|
* read from a live document and every other number one the reader puts in.
|
|
*
|
|
* at list each model's input and output rate per million tokens as
|
|
* the price list carries the provider's (GET /v1/pricing
|
|
* `thirdPartyModels`)
|
|
* Hanzo Cloud the same tokens on a Hanzo model at the price list's rate
|
|
* (`hanzoModels`), plus the members on Team at the plan
|
|
* list's per-member price (GET /v1/billing/plans)
|
|
* your GPUs no per-token charge: the GPUs, on all month, at an hourly
|
|
* rate (the price list's on-demand `infrastructure.gpu`, or
|
|
* the reader's own). The Enterprise agreement is quoted, so it
|
|
* is never in a total here.
|
|
*
|
|
* Nothing here holds a price. What it holds is arithmetic and one fact: a
|
|
* month is 730 hours (8,760 a year over twelve).
|
|
*/
|
|
|
|
/** Dollars per million tokens, in and out. */
|
|
export type Rates = { input: number; output: number }
|
|
|
|
/** Tokens a month, in millions. */
|
|
export type Tokens = { input: number; output: number }
|
|
|
|
/** The hours in a month: 8,760 a year over twelve. */
|
|
export const HOURS = (365 * 24) / 12
|
|
|
|
/** What tokens cost at a rate, in dollars. */
|
|
export const cost = (t: Tokens, r: Rates): number => t.input * r.input + t.output * r.output
|
|
|
|
/**
|
|
* The tokens a monthly spend buys at a rate, given the share of tokens that are
|
|
* output (0 to 1). Null where the rate prices nothing.
|
|
*/
|
|
export function bought(spend: number, share: number, r: Rates): Tokens | null {
|
|
const each = (1 - share) * r.input + share * r.output
|
|
if (!(each > 0) || !(spend >= 0)) return null
|
|
const total = spend / each
|
|
return { input: total * (1 - share), output: total * share }
|
|
}
|
|
|
|
/** What GPUs on all month cost: how many, at an hourly rate each. */
|
|
export const gpus = (count: number, hourly: number): number => count * hourly * HOURS
|
|
|
|
/** One minus `of` over `against`, as a share: what `of` saves against `against`. Null when `against` is nothing. */
|
|
export const saves = (of: number, against: number): number | null => (against > 0 ? 1 - of / against : null)
|
|
|
|
/**
|
|
* Where GPUs on all month cost what the same tokens cost at list: the monthly
|
|
* tokens, in millions, at the usage's own mix of input and output, and that as
|
|
* tokens a second, around the clock. Null when the usage prices nothing.
|
|
*/
|
|
export function even(monthly: number, usage: Tokens, listed: number): { millions: number; perSecond: number } | null {
|
|
const total = usage.input + usage.output
|
|
if (!(total > 0) || !(listed > 0)) return null
|
|
const millions = monthly / (listed / total)
|
|
return { millions, perSecond: (millions * 1e6) / (HOURS * 3600) }
|
|
}
|
|
|
|
/** Dollars: a whole amount bare, whole above a hundred, and to the cent below. */
|
|
export const usd = (v: number): string =>
|
|
`$${v.toLocaleString('en-US', v >= 100 || Number.isInteger(v) ? { maximumFractionDigits: 0 } : { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`
|
|
|
|
/** A rate as the price list states it: every digit it gives. */
|
|
export const rate = (v: number): string => `$${v}`
|
|
|
|
/** A share as a whole percent. */
|
|
export const percent = (v: number): string => `${Math.round(v * 100)}%`
|