Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ai/src/ai/config/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const gateway = createGateway({
export const modelNames = {
tiny: "openai/gpt-oss-120b",
quick: "google/gemini-2.5-flash-lite",
balanced: "openai/gpt-5.6-terra",
balanced: "openai/gpt-5.6-luna",
deep: "deepseek/deepseek-v4-flash",
} as const;

Expand Down
21 changes: 21 additions & 0 deletions packages/ai/src/lib/usage-telemetry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,25 @@ describe("summarizeAgentUsage", () => {
expect(summary.cost_total_usd).toBe(20.875);
expect(summary.agent_credits_used).toBe(417.5);
});

test("bills Luna input, output, and cached tokens at its own rates", () => {
const summary = summarizeAgentUsage("openai/gpt-5.6-luna", {
inputTokens: 30_000,
outputTokens: 10_000,
inputTokenDetails: {
cacheReadTokens: 10_000,
cacheWriteTokens: 10_000,
},
});

expect(summary.cost_fallback).toBe(false);
expect(summary.cost_model_id).toBe("openai/gpt-5.6-luna");
expect(summary.fresh_input_tokens).toBe(10_000);
expect(summary.cost_input_usd).toBeCloseTo(0.002, 8);
expect(summary.cost_cache_read_usd).toBeCloseTo(0.0002, 8);
expect(summary.cost_cache_write_usd).toBeCloseTo(0.0025, 8);
expect(summary.cost_output_usd).toBeCloseTo(0.012, 8);
expect(summary.cost_total_usd).toBeCloseTo(0.0167, 8);
expect(summary.agent_credits_used).toBeCloseTo(0.334, 8);
});
});
6 changes: 6 additions & 0 deletions packages/shared/src/agent-credits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ export const AGENT_MODEL_COSTS_USD_PER_MILLION: Record<
cache_read: 0.25,
cache_write: 3.125,
},
"openai/gpt-5.6-luna": {
input: 0.2,
output: 1.2,
cache_read: 0.02,
cache_write: 0.25,
},
};

export const AGENT_PRICING_BASELINE_MODEL_ID =
Expand Down
Loading