(input: ModelsDev.Model["cost"])
| 11 | } |
| 12 | |
| 13 | function cost(input: ModelsDev.Model["cost"]): ModelV2Info["cost"] { |
| 14 | const base = { |
| 15 | input: input?.input ?? 0, |
| 16 | output: input?.output ?? 0, |
| 17 | cache: { |
| 18 | read: input?.cache_read ?? 0, |
| 19 | write: input?.cache_write ?? 0, |
| 20 | }, |
| 21 | } |
| 22 | return [ |
| 23 | base, |
| 24 | ...(input?.tiers?.map((item) => ({ |
| 25 | tier: item.tier, |
| 26 | input: item.input, |
| 27 | output: item.output, |
| 28 | cache: { |
| 29 | read: item.cache_read ?? 0, |
| 30 | write: item.cache_write ?? 0, |
| 31 | }, |
| 32 | })) ?? []), |
| 33 | ...(input?.context_over_200k |
| 34 | ? [ |
| 35 | { |
| 36 | tier: { |
| 37 | type: "context" as const, |
| 38 | size: 200_000, |
| 39 | }, |
| 40 | input: input.context_over_200k.input, |
| 41 | output: input.context_over_200k.output, |
| 42 | cache: { |
| 43 | read: input.context_over_200k.cache_read ?? 0, |
| 44 | write: input.context_over_200k.cache_write ?? 0, |
| 45 | }, |
| 46 | }, |
| 47 | ] |
| 48 | : []), |
| 49 | ] |
| 50 | } |
| 51 | |
| 52 | function mergeCost(base: ModelV2Info["cost"], override: ModelsDev.Model["cost"] | undefined) { |
| 53 | if (!override) return base |
no outgoing calls
no test coverage detected