MCPcopy Index your code
hub / github.com/anomalyco/opencode / cost

Function cost

packages/core/src/plugin/models-dev.ts:13–50  ·  view source on GitHub ↗
(input: ModelsDev.Model["cost"])

Source from the content-addressed store, hash-verified

11}
12
13function 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
52function mergeCost(base: ModelV2Info["cost"], override: ModelsDev.Model["cost"] | undefined) {
53 if (!override) return base

Callers 5

mergeCostFunction · 0.70
applyModelFunction · 0.70
models-dev.tsFile · 0.70
ViewFunction · 0.50
tooltipValueFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected