Skip to content
Merged
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
10 changes: 7 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,13 @@ jobs:
done
fly_secrets=$(flyctl secrets list --app postil-web --json)
if ! jq -e --slurpfile source "${RUNNER_TEMP}/postil-source-secrets.json" '
(map({name, digest, status}) | sort_by(.name)) ==
($source[0] | map(if .name == "POSTIL_REVIEW_FEEDBACK_ENABLED" and
.status == "Staged" then .status = "Deployed" else . end))
(map({name, digest}) | sort_by(.name)) ==
($source[0] | map({name, digest}) | sort_by(.name)) and
all(.[]; . as $secret | any($source[0][];
.name == $secret.name and
(if .name == "POSTIL_REVIEW_FEEDBACK_ENABLED" and .status == "Staged"
then ($secret.status == "Partial" or $secret.status == "Deployed")
else .status == $secret.status end)))
' <<<"${fly_secrets}" >/dev/null; then
echo "::error::Fly secret metadata changed during deployment; target verification failed."
exit 1
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ services:
# whatever binary is at vendor/postil (see the header comment).
# Override alongside a new vendor/postil binary to upgrade the
# reviewer version.
POSTIL_CLI_REV: ${POSTIL_CLI_REV:-v0.9.21}
POSTIL_CLI_REV: ${POSTIL_CLI_REV:-v0.9.22}
NEXT_PUBLIC_POSTHOG_HOST: ${NEXT_PUBLIC_POSTHOG_HOST:-https://eu.i.posthog.com}
env_file: .env
environment:
Expand All @@ -55,7 +55,7 @@ services:
build:
context: .
args:
POSTIL_CLI_REV: ${POSTIL_CLI_REV:-v0.9.21}
POSTIL_CLI_REV: ${POSTIL_CLI_REV:-v0.9.22}
NEXT_PUBLIC_POSTHOG_HOST: ${NEXT_PUBLIC_POSTHOG_HOST:-https://eu.i.posthog.com}
command: ["bun", "scripts/start-managed-process.ts", "worker"]
env_file: .env
Expand All @@ -71,7 +71,7 @@ services:
build:
context: .
args:
POSTIL_CLI_REV: ${POSTIL_CLI_REV:-v0.9.21}
POSTIL_CLI_REV: ${POSTIL_CLI_REV:-v0.9.22}
NEXT_PUBLIC_POSTHOG_HOST: ${NEXT_PUBLIC_POSTHOG_HOST:-https://eu.i.posthog.com}
command: ["bun", "scripts/start-managed-process.ts", "monitor"]
env_file: .env
Expand Down
16 changes: 16 additions & 0 deletions src/app/changelog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ const LABEL_STYLE: Record<Change["label"], string> = {
};

const RELEASES: Release[] = [
{
version: "0.9.22",
date: "November 19, 2026",
summary:
"CLI v0.9.22 accepts valid empty-file and rename-only diffs.",
changes: [
{
label: "Fixed",
text: "Reconstructed diffs accept complete markers for empty additions, deletions and renames without text hunks. Malformed change sections still fail validation.",
},
{
label: "Changed",
text: "The default review model is GPT-6 Luna.",
},
],
},
{
version: "0.9.21",
date: "November 7, 2026",
Expand Down
7 changes: 5 additions & 2 deletions src/components/model-catalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,20 @@ export function ModelCatalog() {
</td>
<td className="border-b border-stone py-3 pr-3 align-top">
<PriceCell price={model.pricePerToken} />
{model.pricingNote && (
<p className="mt-1 text-xs text-charcoal/70">{model.pricingNote}</p>
)}
</td>
</tr>
))}
</tbody>
</table>
<p className="mt-3 text-xs text-charcoal/60">
Price values are a committed public snapshot from the{" "}
Price values are committed public snapshots from the{" "}
<a href="https://openrouter.ai/models" rel="noopener noreferrer" className="text-rust underline">
OpenRouter catalog
</a>
, captured {captureDate}. Re-check provider pricing before committing to
, last updated {captureDate}. Re-check provider pricing before committing to
a procurement number. Capability badges are maintained in this repo.
</p>
</div>
Expand Down
27 changes: 26 additions & 1 deletion src/data/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@
// entry stays after a model leaves the docs table if usage was ever attributed
// to its id.

export const MODEL_CATALOG_CAPTURE_DATE = "2026-08-19";
// Latest catalog update; existing rows retain their earlier price snapshots.
export const MODEL_CATALOG_CAPTURE_DATE = "2026-11-19";

export type ParamClass = "unknown" | "<40B" | "40B-200B" | ">200B";

export interface ModelPrice {
input: number;
output: number;
longContext?: {
fromPromptTokens: number;
input: number;
output: number;
};
}

export interface CatalogModel {
Expand All @@ -30,6 +36,8 @@ export interface CatalogModel {
tested: boolean;
/** Public OpenRouter price per token for docs display. */
pricePerToken: ModelPrice;
/** Conditions or tiers that qualify the displayed price. */
pricingNote?: string;
}

export const MODELS: CatalogModel[] = [
Expand Down Expand Up @@ -121,6 +129,23 @@ export const MODELS: CatalogModel[] = [
tested: false,
pricePerToken: { input: 0.000000083, output: 0.000000165 },
},
{
// Azure standard-context route, captured from OpenRouter on 2026-11-19.
id: "openai/gpt-6-luna",
name: "GPT-6 Luna",
contextLength: 1_050_000,
vision: true,
openWeights: false,
paramClass: "unknown",
locallyRunnable: false,
tested: false,
pricePerToken: {
input: 0.0000001,
output: 0.0000005,
longContext: { fromPromptTokens: 272_000, input: 0.0000002, output: 0.00000075 },
},
pricingNote: "Below 272,000 prompt tokens. At 272,000 or more: $0.20 input / $0.75 output per 1M tokens.",
},
{
id: "openai/gpt-5.6-luna",
name: "GPT-5.6 Luna",
Expand Down
10 changes: 5 additions & 5 deletions src/data/public-cli-release.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"cliRelease": "v0.7.2",
"cliCommit": "dcf4e34c4804d4bf64705ab6367c883cea23b33a",
"hostedCliRelease": "v0.9.21",
"hostedCliCommit": "edf15d9deb65ad023c5247f8a3dce0c8ce4b7b0c",
"hostedCliLinuxX86_64Sha256": "e560b1cdc5a323051ff077ee414b9fc11dc420a9b9adda2e6eb97c04c9985728",
"hostedCliDefaultModel": "openai/gpt-5.6-luna",
"hostedCliRelease": "v0.9.22",
"hostedCliCommit": "a86cb91b0ca424ac5857a36723e20fd5394e58ac",
"hostedCliLinuxX86_64Sha256": "50dfa6b2c541c66a71b9530cf84d076ee039b2f3ec281788f9032dcac4512315",
"hostedCliDefaultModel": "openai/gpt-6-luna",
"hostedCliManagedProfile": {
"apiBase": "https://openrouter.ai/api/v1",
"apiFormat": "openai-compatible",
"model": "openai/gpt-5.6-luna",
"model": "openai/gpt-6-luna",
"providerName": "Azure",
"providerRoute": "azure/eu",
"reasoningEffort": "low",
Expand Down
7 changes: 5 additions & 2 deletions src/lib/billing-credits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ export function calculateUsageCostMicrosForModel(
completionTokens: number,
): number | null {
if (!modelUsed) return null;
const price = MODEL_PRICES.get(modelUsed);
if (!price) return null;
const modelPrice = MODEL_PRICES.get(modelUsed);
if (!modelPrice) return null;
const price = modelPrice.longContext && promptTokens >= modelPrice.longContext.fromPromptTokens
? modelPrice.longContext
: modelPrice;
const dollars = promptTokens * price.input + completionTokens * price.output;
if (dollars <= 0) return 0;
return Math.ceil(dollars * 1_000_000 - 1e-9);
Expand Down
22 changes: 21 additions & 1 deletion tests/billing-credits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,30 @@ describe("billing credit calculations", () => {
test.each([
["anthropic/claude-haiku-4.5", 6_000_000],
["openai/gpt-5-mini", 2_250_000],
] as const)("prices configured scorer %s", (model, expected) => {
["openai/gpt-6-luna", 950_000],
] as const)("prices configured inference model %s", (model, expected) => {
expect(calculateUsageCostMicrosForModel(model, 1_000_000, 1_000_000)).toBe(expected);
});

test.each([
[128_000, 8_000, 16_800],
[271_999, 1_000, 27_700],
[272_000, 1_000, 55_150],
] as const)("prices Luna's prompt threshold at %i input tokens", (input, output, expected) => {
expect(calculateUsageCostMicrosForModel("openai/gpt-6-luna", input, output)).toBe(expected);
});

test("preserves an already recorded Luna charge across rate tiers", () => {
expect(usageEventCostMicros({
id: 1,
promptTokens: 272_000,
completionTokens: 1_000,
modelUsed: "openai/gpt-6-luna",
costMicros: 27_700,
createdAt: new Date("2026-11-19T00:00:00Z"),
})).toBe(27_700);
});

test("snapshots sub-cent usage in USD micros from the model catalog", () => {
const costMicros = calculateUsageCostMicrosForModel(
"deepseek/deepseek-v4-pro",
Expand Down
23 changes: 13 additions & 10 deletions tests/cli-inference-gateway.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ test("resolves and applies the complete managed gateway policy", async () => {
expect(profile).toEqual({
apiBase: "https://openrouter.ai/api/v1",
apiFormat: "openai-compatible",
model: "openai/gpt-5.6-luna",
model: "openai/gpt-6-luna",
providerName: "Azure",
providerRoute: "azure/eu",
reasoningEffort: "low",
Expand Down Expand Up @@ -78,7 +78,7 @@ test("resolves and applies the complete managed gateway policy", async () => {
messages: [{ role: "user", content: "review" }],
max_tokens: 8000,
temperature: 0.1,
model: "openai/gpt-5.6-luna",
model: "openai/gpt-6-luna",
reasoning: { effort: "low" },
provider: {
data_collection: "deny",
Expand Down Expand Up @@ -560,7 +560,7 @@ describeDb("POST /api/inference/v1/chat/completions", () => {
model_used: release.hostedCliDefaultModel,
prompt_tokens: 10,
completion_tokens: 2,
cost_micros: "5",
cost_micros: "2",
}]);
});

Expand Down Expand Up @@ -666,7 +666,7 @@ describeDb("POST /api/inference/v1/chat/completions", () => {
model_used: returnedModel ?? "server/default",
prompt_tokens: 10,
completion_tokens: 2,
cost_micros: returnedModel ? "5" : "0",
cost_micros: returnedModel ? "2" : "0",
}]);
}
});
Expand Down Expand Up @@ -793,8 +793,11 @@ describeDb("POST /api/inference/v1/chat/completions", () => {
expect(upstreamCalled).toBe(false);
});

test("a successful call records a private_hosted usage_events row and reconciles the reservation", async () => {
mockUpstreamSuccess(120, 30);
test.each([
[120, 30, "27"],
[272_000, 8_000, "60400"],
] as const)("a successful call records usage and reconciles the reservation at %i prompt tokens", async (promptTokens, completionTokens, costMicros) => {
mockUpstreamSuccess(promptTokens, completionTokens);
const { POST } =
await import("@/app/api/inference/v1/chat/completions/route");
const orgId = await createOrgWithHostedEntitlement();
Expand All @@ -807,7 +810,7 @@ describeDb("POST /api/inference/v1/chat/completions", () => {
const body = (await response.json()) as {
usage: { prompt_tokens: number };
};
expect(body.usage.prompt_tokens).toBe(120);
expect(body.usage.prompt_tokens).toBe(promptTokens);

const usage = await pool!.query<{
billing_scope: string;
Expand All @@ -830,10 +833,10 @@ describeDb("POST /api/inference/v1/chat/completions", () => {
trigger_source: "unknown",
repository_id: null,
review_id: null,
prompt_tokens: 120,
completion_tokens: 30,
prompt_tokens: promptTokens,
completion_tokens: completionTokens,
model_used: release.hostedCliDefaultModel,
cost_micros: "60",
cost_micros: costMicros,
},
]);

Expand Down
Loading