feat(db): gemini_usage-tabell för token-telemetri
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
CREATE TABLE "gemini_usage" (
|
||||||
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||||
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||||
|
"task_type" text NOT NULL,
|
||||||
|
"prompt_tokens" integer NOT NULL,
|
||||||
|
"output_tokens" integer NOT NULL,
|
||||||
|
"total_tokens" integer NOT NULL,
|
||||||
|
"cost_microcents" bigint
|
||||||
|
);
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { bigint, integer, pgTable, text, uuid } from "drizzle-orm/pg-core";
|
||||||
|
import { createdAt } from "./_shared.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Token-telemetri för Gemini-anrop (spec §EOC):
|
||||||
|
* Rådata för /ops/v1/summary och framtida kostnadsuppföljning.
|
||||||
|
*/
|
||||||
|
export const geminiUsage = pgTable("gemini_usage", {
|
||||||
|
id: uuid("id").primaryKey().defaultRandom(),
|
||||||
|
createdAt: createdAt(),
|
||||||
|
taskType: text("task_type").notNull(),
|
||||||
|
promptTokens: integer("prompt_tokens").notNull(),
|
||||||
|
outputTokens: integer("output_tokens").notNull(),
|
||||||
|
totalTokens: integer("total_tokens").notNull(),
|
||||||
|
costMicrocents: bigint("cost_microcents", { mode: "number" }),
|
||||||
|
});
|
||||||
@@ -22,3 +22,4 @@ export * from "./feedback.js";
|
|||||||
export * from "./ops.js";
|
export * from "./ops.js";
|
||||||
export * from "./platform.js";
|
export * from "./platform.js";
|
||||||
export * from "./releaseGates.js";
|
export * from "./releaseGates.js";
|
||||||
|
export * from "./gemini-usage.js";
|
||||||
|
|||||||
Reference in New Issue
Block a user