From 048ace7128c71e525e3395b2d512596b7c96afbc Mon Sep 17 00:00:00 2001 From: steebchen Date: Sun, 8 Feb 2026 10:08:30 +0000 Subject: [PATCH 01/24] feat: add project hourly stats aggregation for faster dashboards Add aggregation tables to pre-compute dashboard statistics hourly, significantly improving dashboard load times by avoiding expensive queries on the raw log table. Changes: - Add project_hourly_stats and project_hourly_model_stats tables - Add worker service to refresh aggregations every minute (configurable) - Update activity API route to use aggregation tables - Fallback to raw log queries when filtering by apiKeyId - Include backfill logic for missing historical data Environment variables: - PROJECT_STATS_REFRESH_INTERVAL_SECONDS (default: 60) - PROJECT_STATS_BACKFILL_HOURS (default: 24) Co-Authored-By: Claude Opus 4.5 --- apps/api/src/routes/activity.ts | 295 +- .../src/services/project-stats-aggregator.ts | 400 + apps/worker/src/worker.ts | 45 + .../1770544954_parallel_mindworm.sql | 48 + .../migrations/meta/1770544954_snapshot.json | 8505 +++++++++++++++++ packages/db/migrations/meta/_journal.json | 7 + packages/db/src/schema.ts | 91 + 7 files changed, 9337 insertions(+), 54 deletions(-) create mode 100644 apps/worker/src/services/project-stats-aggregator.ts create mode 100644 packages/db/migrations/1770544954_parallel_mindworm.sql create mode 100644 packages/db/migrations/meta/1770544954_snapshot.json diff --git a/apps/api/src/routes/activity.ts b/apps/api/src/routes/activity.ts index 6ba49a760d..360db39786 100644 --- a/apps/api/src/routes/activity.ts +++ b/apps/api/src/routes/activity.ts @@ -4,7 +4,18 @@ import { z } from "zod"; import { getUserOrganizationIds } from "@/utils/authorization.js"; -import { db, sql, tables, inArray, and, gte, lte, eq } from "@llmgateway/db"; +import { + db, + sql, + tables, + inArray, + and, + gte, + lte, + eq, + projectHourlyStats, + projectHourlyModelStats, +} from "@llmgateway/db"; import type { ServerTypes } from "@/vars.js"; @@ -122,103 +133,279 @@ activity.openapi(getActivity, async (c) => { }); } - // Query daily aggregated data using database-level aggregation - const dailyAggregates = await db + // If filtering by apiKeyId, we need to fall back to raw log table queries + // since aggregation tables don't track per-API-key stats + if (apiKeyId) { + // Query daily aggregated data from raw logs (fallback for apiKeyId filter) + const dailyAggregates = await db + .select({ + date: sql`DATE(${tables.log.createdAt})`.as("date"), + requestCount: sql`COUNT(*)`.as("requestCount"), + inputTokens: + sql`COALESCE(SUM(CAST(${tables.log.promptTokens} AS NUMERIC)), 0)`.as( + "inputTokens", + ), + outputTokens: + sql`COALESCE(SUM(CAST(${tables.log.completionTokens} AS NUMERIC)), 0)`.as( + "outputTokens", + ), + totalTokens: + sql`COALESCE(SUM(CAST(${tables.log.totalTokens} AS NUMERIC)), 0)`.as( + "totalTokens", + ), + cost: sql`COALESCE(SUM(${tables.log.cost}), 0)`.as("cost"), + inputCost: sql`COALESCE(SUM(${tables.log.inputCost}), 0)`.as( + "inputCost", + ), + outputCost: sql`COALESCE(SUM(${tables.log.outputCost}), 0)`.as( + "outputCost", + ), + requestCost: + sql`COALESCE(SUM(${tables.log.requestCost}), 0)`.as( + "requestCost", + ), + dataStorageCost: + sql`COALESCE(SUM(${tables.log.dataStorageCost}), 0)`.as( + "dataStorageCost", + ), + errorCount: + sql`SUM(CASE WHEN ${tables.log.hasError} = true THEN 1 ELSE 0 END)`.as( + "errorCount", + ), + cacheCount: + sql`SUM(CASE WHEN ${tables.log.cached} = true THEN 1 ELSE 0 END)`.as( + "cacheCount", + ), + discountSavings: sql`COALESCE( + SUM( + CASE + WHEN ${tables.log.discount} > 0 AND ${tables.log.discount} < 1 + THEN ${tables.log.cost} * ${tables.log.discount} / (1 - ${tables.log.discount}) + ELSE 0 + END + ), + 0 + )`.as("discountSavings"), + }) + .from(tables.log) + .where( + and( + inArray(tables.log.projectId, projectIds), + gte(tables.log.createdAt, startDate), + lte(tables.log.createdAt, endDate), + eq(tables.log.apiKeyId, apiKeyId), + ), + ) + .groupBy(sql`DATE(${tables.log.createdAt})`) + .orderBy(sql`DATE(${tables.log.createdAt}) ASC`); + + // Query model breakdown data from raw logs + const modelBreakdowns = await db + .select({ + date: sql`DATE(${tables.log.createdAt})`.as("date"), + usedModel: tables.log.usedModel, + usedProvider: tables.log.usedProvider, + requestCount: sql`COUNT(*)`.as("requestCount"), + inputTokens: + sql`COALESCE(SUM(CAST(${tables.log.promptTokens} AS NUMERIC)), 0)`.as( + "inputTokens", + ), + outputTokens: + sql`COALESCE(SUM(CAST(${tables.log.completionTokens} AS NUMERIC)), 0)`.as( + "outputTokens", + ), + totalTokens: + sql`COALESCE(SUM(CAST(${tables.log.totalTokens} AS NUMERIC)), 0)`.as( + "totalTokens", + ), + cost: sql`COALESCE(SUM(${tables.log.cost}), 0)`.as("cost"), + }) + .from(tables.log) + .where( + and( + inArray(tables.log.projectId, projectIds), + gte(tables.log.createdAt, startDate), + lte(tables.log.createdAt, endDate), + eq(tables.log.apiKeyId, apiKeyId), + ), + ) + .groupBy( + sql`DATE(${tables.log.createdAt}), ${tables.log.usedModel}, ${tables.log.usedProvider}`, + ) + .orderBy( + sql`DATE(${tables.log.createdAt}) ASC, ${tables.log.usedModel} ASC`, + ); + + // Create a map to organize model breakdowns by date + const modelBreakdownByDate = new Map< + string, + z.infer[] + >(); + for (const breakdown of modelBreakdowns) { + if (!modelBreakdownByDate.has(breakdown.date)) { + modelBreakdownByDate.set(breakdown.date, []); + } + modelBreakdownByDate.get(breakdown.date)!.push({ + id: breakdown.usedModel || "unknown", + provider: breakdown.usedProvider || "unknown", + requestCount: Number(breakdown.requestCount), + inputTokens: Number(breakdown.inputTokens), + outputTokens: Number(breakdown.outputTokens), + totalTokens: Number(breakdown.totalTokens), + cost: Number(breakdown.cost), + }); + } + + // Process daily aggregates and add calculated fields + const activityData = dailyAggregates.map((day) => { + const requestCount = Number(day.requestCount); + const inputTokens = Number(day.inputTokens); + const outputTokens = Number(day.outputTokens); + const totalTokens = Number(day.totalTokens); + const cost = Number(day.cost); + const inputCost = Number(day.inputCost); + const outputCost = Number(day.outputCost); + const requestCost = Number(day.requestCost); + const dataStorageCost = Number(day.dataStorageCost); + const errorCount = Number(day.errorCount); + const cacheCount = Number(day.cacheCount); + const discountSavings = Number(day.discountSavings); + + const errorRate = + requestCount > 0 ? (errorCount / requestCount) * 100 : 0; + const cacheRate = + requestCount > 0 ? (cacheCount / requestCount) * 100 : 0; + + return { + date: day.date, + requestCount, + inputTokens, + outputTokens, + totalTokens, + cost, + inputCost, + outputCost, + requestCost, + dataStorageCost, + errorCount, + errorRate, + cacheCount, + cacheRate, + discountSavings, + modelBreakdown: modelBreakdownByDate.get(day.date) || [], + }; + }); + + return c.json({ + activity: activityData, + }); + } + + // Use aggregation tables for fast queries (when not filtering by apiKeyId) + // Query hourly aggregated data from projectHourlyStats table + const hourlyAggregates = await db .select({ - date: sql`DATE(${tables.log.createdAt})`.as("date"), - requestCount: sql`COUNT(*)`.as("requestCount"), + date: sql`DATE(${projectHourlyStats.hourTimestamp})`.as("date"), + requestCount: + sql`COALESCE(SUM(${projectHourlyStats.requestCount}), 0)`.as( + "requestCount", + ), inputTokens: - sql`COALESCE(SUM(CAST(${tables.log.promptTokens} AS NUMERIC)), 0)`.as( + sql`COALESCE(SUM(CAST(${projectHourlyStats.inputTokens} AS NUMERIC)), 0)`.as( "inputTokens", ), outputTokens: - sql`COALESCE(SUM(CAST(${tables.log.completionTokens} AS NUMERIC)), 0)`.as( + sql`COALESCE(SUM(CAST(${projectHourlyStats.outputTokens} AS NUMERIC)), 0)`.as( "outputTokens", ), totalTokens: - sql`COALESCE(SUM(CAST(${tables.log.totalTokens} AS NUMERIC)), 0)`.as( + sql`COALESCE(SUM(CAST(${projectHourlyStats.totalTokens} AS NUMERIC)), 0)`.as( "totalTokens", ), - cost: sql`COALESCE(SUM(${tables.log.cost}), 0)`.as("cost"), - inputCost: sql`COALESCE(SUM(${tables.log.inputCost}), 0)`.as( - "inputCost", - ), - outputCost: sql`COALESCE(SUM(${tables.log.outputCost}), 0)`.as( - "outputCost", - ), - requestCost: sql`COALESCE(SUM(${tables.log.requestCost}), 0)`.as( - "requestCost", + cost: sql`COALESCE(SUM(${projectHourlyStats.cost}), 0)`.as( + "cost", ), + inputCost: + sql`COALESCE(SUM(${projectHourlyStats.inputCost}), 0)`.as( + "inputCost", + ), + outputCost: + sql`COALESCE(SUM(${projectHourlyStats.outputCost}), 0)`.as( + "outputCost", + ), + requestCost: + sql`COALESCE(SUM(${projectHourlyStats.requestCost}), 0)`.as( + "requestCost", + ), dataStorageCost: - sql`COALESCE(SUM(${tables.log.dataStorageCost}), 0)`.as( + sql`COALESCE(SUM(${projectHourlyStats.dataStorageCost}), 0)`.as( "dataStorageCost", ), errorCount: - sql`SUM(CASE WHEN ${tables.log.hasError} = true THEN 1 ELSE 0 END)`.as( + sql`COALESCE(SUM(${projectHourlyStats.errorCount}), 0)`.as( "errorCount", ), cacheCount: - sql`SUM(CASE WHEN ${tables.log.cached} = true THEN 1 ELSE 0 END)`.as( + sql`COALESCE(SUM(${projectHourlyStats.cacheCount}), 0)`.as( "cacheCount", ), - discountSavings: sql`COALESCE( - SUM( - CASE - WHEN ${tables.log.discount} > 0 AND ${tables.log.discount} < 1 - THEN ${tables.log.cost} * ${tables.log.discount} / (1 - ${tables.log.discount}) - ELSE 0 - END + discountSavings: + sql`COALESCE(SUM(${projectHourlyStats.discountSavings}), 0)`.as( + "discountSavings", ), - 0 - )`.as("discountSavings"), }) - .from(tables.log) + .from(projectHourlyStats) .where( and( - inArray(tables.log.projectId, projectIds), - gte(tables.log.createdAt, startDate), - lte(tables.log.createdAt, endDate), - ...(apiKeyId ? [eq(tables.log.apiKeyId, apiKeyId)] : []), + inArray(projectHourlyStats.projectId, projectIds), + gte(projectHourlyStats.hourTimestamp, startDate), + lte(projectHourlyStats.hourTimestamp, endDate), ), ) - .groupBy(sql`DATE(${tables.log.createdAt})`) - .orderBy(sql`DATE(${tables.log.createdAt}) ASC`); + .groupBy(sql`DATE(${projectHourlyStats.hourTimestamp})`) + .orderBy(sql`DATE(${projectHourlyStats.hourTimestamp}) ASC`); - // Query model breakdown data using database-level aggregation + // Query model breakdown from projectHourlyModelStats table const modelBreakdowns = await db .select({ - date: sql`DATE(${tables.log.createdAt})`.as("date"), - usedModel: tables.log.usedModel, - usedProvider: tables.log.usedProvider, - requestCount: sql`COUNT(*)`.as("requestCount"), + date: sql`DATE(${projectHourlyModelStats.hourTimestamp})`.as( + "date", + ), + usedModel: projectHourlyModelStats.usedModel, + usedProvider: projectHourlyModelStats.usedProvider, + requestCount: + sql`COALESCE(SUM(${projectHourlyModelStats.requestCount}), 0)`.as( + "requestCount", + ), inputTokens: - sql`COALESCE(SUM(CAST(${tables.log.promptTokens} AS NUMERIC)), 0)`.as( + sql`COALESCE(SUM(CAST(${projectHourlyModelStats.inputTokens} AS NUMERIC)), 0)`.as( "inputTokens", ), outputTokens: - sql`COALESCE(SUM(CAST(${tables.log.completionTokens} AS NUMERIC)), 0)`.as( + sql`COALESCE(SUM(CAST(${projectHourlyModelStats.outputTokens} AS NUMERIC)), 0)`.as( "outputTokens", ), totalTokens: - sql`COALESCE(SUM(CAST(${tables.log.totalTokens} AS NUMERIC)), 0)`.as( + sql`COALESCE(SUM(CAST(${projectHourlyModelStats.totalTokens} AS NUMERIC)), 0)`.as( "totalTokens", ), - cost: sql`COALESCE(SUM(${tables.log.cost}), 0)`.as("cost"), + cost: sql`COALESCE(SUM(${projectHourlyModelStats.cost}), 0)`.as( + "cost", + ), }) - .from(tables.log) + .from(projectHourlyModelStats) .where( and( - inArray(tables.log.projectId, projectIds), - gte(tables.log.createdAt, startDate), - lte(tables.log.createdAt, endDate), - ...(apiKeyId ? [eq(tables.log.apiKeyId, apiKeyId)] : []), + inArray(projectHourlyModelStats.projectId, projectIds), + gte(projectHourlyModelStats.hourTimestamp, startDate), + lte(projectHourlyModelStats.hourTimestamp, endDate), ), ) .groupBy( - sql`DATE(${tables.log.createdAt}), ${tables.log.usedModel}, ${tables.log.usedProvider}`, + sql`DATE(${projectHourlyModelStats.hourTimestamp}), ${projectHourlyModelStats.usedModel}, ${projectHourlyModelStats.usedProvider}`, ) .orderBy( - sql`DATE(${tables.log.createdAt}) ASC, ${tables.log.usedModel} ASC`, + sql`DATE(${projectHourlyModelStats.hourTimestamp}) ASC, ${projectHourlyModelStats.usedModel} ASC`, ); // Create a map to organize model breakdowns by date @@ -241,8 +428,8 @@ activity.openapi(getActivity, async (c) => { }); } - // Process daily aggregates and add calculated fields - const activityData = dailyAggregates.map((day) => { + // Process hourly aggregates (summed to daily) and add calculated fields + const activityData = hourlyAggregates.map((day) => { // Convert database strings to numbers const requestCount = Number(day.requestCount); const inputTokens = Number(day.inputTokens); diff --git a/apps/worker/src/services/project-stats-aggregator.ts b/apps/worker/src/services/project-stats-aggregator.ts new file mode 100644 index 0000000000..0d47cd8f50 --- /dev/null +++ b/apps/worker/src/services/project-stats-aggregator.ts @@ -0,0 +1,400 @@ +import { + db, + log, + projectHourlyStats, + projectHourlyModelStats, + sql, + gte, + lt, + and, +} from "@llmgateway/db"; +import { logger } from "@llmgateway/logger"; + +// Configuration for project stats refresh interval (defaults to 60 seconds) +export const PROJECT_STATS_REFRESH_INTERVAL_SECONDS = + Number(process.env.PROJECT_STATS_REFRESH_INTERVAL_SECONDS) || 60; + +// Configuration for backfill duration in hours (defaults to 24 hours) +const PROJECT_STATS_BACKFILL_HOURS = + Number(process.env.PROJECT_STATS_BACKFILL_HOURS) || 24; + +/** + * Helper function to round any date to the start of its hour (00 minutes, 00 seconds, 00 milliseconds) + */ +function roundToHourStart(date: Date): Date { + return new Date( + date.getFullYear(), + date.getMonth(), + date.getDate(), + date.getHours(), + 0, + 0, + 0, + ); +} + +/** + * Helper function to get the current hour start + */ +function getCurrentHourStart(): Date { + return roundToHourStart(new Date()); +} + +/** + * Helper function to get the previous hour start + */ +function getPreviousHourStart(): Date { + const currentHour = getCurrentHourStart(); + return new Date(currentHour.getTime() - 60 * 60 * 1000); +} + +/** + * Calculate and store hourly statistics for all projects for a specific hour + * @param targetHour The specific hour to calculate stats for + */ +async function calculateProjectHourlyStatsForHour(targetHour: Date) { + const roundedTargetHour = roundToHourStart(targetHour); + const hourEnd = new Date(roundedTargetHour.getTime() + 60 * 60 * 1000); + const database = db; + + logger.debug( + `Calculating project hourly stats for ${roundedTargetHour.toISOString()}`, + ); + + // Aggregate logs by project for this hour + const projectStats = await database + .select({ + projectId: log.projectId, + requestCount: sql`count(*)::int`.as("requestCount"), + errorCount: + sql`sum(case when ${log.hasError} = true then 1 else 0 end)::int`.as( + "errorCount", + ), + cacheCount: + sql`sum(case when ${log.cached} = true then 1 else 0 end)::int`.as( + "cacheCount", + ), + inputTokens: + sql`coalesce(sum(cast(${log.promptTokens} as numeric)), 0)`.as( + "inputTokens", + ), + outputTokens: + sql`coalesce(sum(cast(${log.completionTokens} as numeric)), 0)`.as( + "outputTokens", + ), + totalTokens: + sql`coalesce(sum(cast(${log.totalTokens} as numeric)), 0)`.as( + "totalTokens", + ), + reasoningTokens: + sql`coalesce(sum(cast(${log.reasoningTokens} as numeric)), 0)`.as( + "reasoningTokens", + ), + cachedTokens: + sql`coalesce(sum(cast(${log.cachedTokens} as numeric)), 0)`.as( + "cachedTokens", + ), + cost: sql`coalesce(sum(${log.cost}), 0)`.as("cost"), + inputCost: sql`coalesce(sum(${log.inputCost}), 0)`.as( + "inputCost", + ), + outputCost: sql`coalesce(sum(${log.outputCost}), 0)`.as( + "outputCost", + ), + requestCost: sql`coalesce(sum(${log.requestCost}), 0)`.as( + "requestCost", + ), + dataStorageCost: + sql`coalesce(sum(cast(${log.dataStorageCost} as real)), 0)`.as( + "dataStorageCost", + ), + serviceFee: sql`coalesce(sum(${log.serviceFee}), 0)`.as( + "serviceFee", + ), + discountSavings: sql`coalesce( + sum( + case + when ${log.discount} > 0 and ${log.discount} < 1 + then ${log.cost} * ${log.discount} / (1 - ${log.discount}) + else 0 + end + ), + 0 + )`.as("discountSavings"), + }) + .from(log) + .where( + and(gte(log.createdAt, roundedTargetHour), lt(log.createdAt, hourEnd)), + ) + .groupBy(log.projectId); + + // Upsert project hourly stats + for (const stat of projectStats) { + await database + .insert(projectHourlyStats) + .values({ + projectId: stat.projectId, + hourTimestamp: roundedTargetHour, + requestCount: stat.requestCount, + errorCount: stat.errorCount, + cacheCount: stat.cacheCount, + inputTokens: stat.inputTokens, + outputTokens: stat.outputTokens, + totalTokens: stat.totalTokens, + reasoningTokens: stat.reasoningTokens, + cachedTokens: stat.cachedTokens, + cost: stat.cost, + inputCost: stat.inputCost, + outputCost: stat.outputCost, + requestCost: stat.requestCost, + dataStorageCost: stat.dataStorageCost, + serviceFee: stat.serviceFee, + discountSavings: stat.discountSavings, + }) + .onConflictDoUpdate({ + target: [ + projectHourlyStats.projectId, + projectHourlyStats.hourTimestamp, + ], + set: { + requestCount: stat.requestCount, + errorCount: stat.errorCount, + cacheCount: stat.cacheCount, + inputTokens: stat.inputTokens, + outputTokens: stat.outputTokens, + totalTokens: stat.totalTokens, + reasoningTokens: stat.reasoningTokens, + cachedTokens: stat.cachedTokens, + cost: stat.cost, + inputCost: stat.inputCost, + outputCost: stat.outputCost, + requestCost: stat.requestCost, + dataStorageCost: stat.dataStorageCost, + serviceFee: stat.serviceFee, + discountSavings: stat.discountSavings, + updatedAt: new Date(), + }, + }); + } + + return projectStats.length; +} + +/** + * Calculate and store hourly model statistics for all projects for a specific hour + * @param targetHour The specific hour to calculate stats for + */ +async function calculateProjectHourlyModelStatsForHour(targetHour: Date) { + const roundedTargetHour = roundToHourStart(targetHour); + const hourEnd = new Date(roundedTargetHour.getTime() + 60 * 60 * 1000); + const database = db; + + logger.debug( + `Calculating project hourly model stats for ${roundedTargetHour.toISOString()}`, + ); + + // Aggregate logs by project, model, and provider for this hour + const modelStats = await database + .select({ + projectId: log.projectId, + usedModel: log.usedModel, + usedProvider: log.usedProvider, + requestCount: sql`count(*)::int`.as("requestCount"), + errorCount: + sql`sum(case when ${log.hasError} = true then 1 else 0 end)::int`.as( + "errorCount", + ), + cacheCount: + sql`sum(case when ${log.cached} = true then 1 else 0 end)::int`.as( + "cacheCount", + ), + inputTokens: + sql`coalesce(sum(cast(${log.promptTokens} as numeric)), 0)`.as( + "inputTokens", + ), + outputTokens: + sql`coalesce(sum(cast(${log.completionTokens} as numeric)), 0)`.as( + "outputTokens", + ), + totalTokens: + sql`coalesce(sum(cast(${log.totalTokens} as numeric)), 0)`.as( + "totalTokens", + ), + cost: sql`coalesce(sum(${log.cost}), 0)`.as("cost"), + inputCost: sql`coalesce(sum(${log.inputCost}), 0)`.as( + "inputCost", + ), + outputCost: sql`coalesce(sum(${log.outputCost}), 0)`.as( + "outputCost", + ), + }) + .from(log) + .where( + and(gte(log.createdAt, roundedTargetHour), lt(log.createdAt, hourEnd)), + ) + .groupBy(log.projectId, log.usedModel, log.usedProvider); + + // Upsert project hourly model stats + for (const stat of modelStats) { + await database + .insert(projectHourlyModelStats) + .values({ + projectId: stat.projectId, + hourTimestamp: roundedTargetHour, + usedModel: stat.usedModel, + usedProvider: stat.usedProvider, + requestCount: stat.requestCount, + errorCount: stat.errorCount, + cacheCount: stat.cacheCount, + inputTokens: stat.inputTokens, + outputTokens: stat.outputTokens, + totalTokens: stat.totalTokens, + cost: stat.cost, + inputCost: stat.inputCost, + outputCost: stat.outputCost, + }) + .onConflictDoUpdate({ + target: [ + projectHourlyModelStats.projectId, + projectHourlyModelStats.hourTimestamp, + projectHourlyModelStats.usedModel, + projectHourlyModelStats.usedProvider, + ], + set: { + requestCount: stat.requestCount, + errorCount: stat.errorCount, + cacheCount: stat.cacheCount, + inputTokens: stat.inputTokens, + outputTokens: stat.outputTokens, + totalTokens: stat.totalTokens, + cost: stat.cost, + inputCost: stat.inputCost, + outputCost: stat.outputCost, + updatedAt: new Date(), + }, + }); + } + + return modelStats.length; +} + +/** + * Refresh project hourly stats for the current hour and previous hour + * Previous hour is also refreshed to handle logs that arrived just after the hour boundary + */ +export async function refreshProjectHourlyStats() { + const currentHour = getCurrentHourStart(); + const previousHour = getPreviousHourStart(); + + logger.debug("Starting project hourly stats refresh..."); + + try { + // Refresh current hour (for real-time data) + const currentProjectCount = + await calculateProjectHourlyStatsForHour(currentHour); + const currentModelCount = + await calculateProjectHourlyModelStatsForHour(currentHour); + + // Refresh previous hour (to catch late-arriving logs) + const previousProjectCount = + await calculateProjectHourlyStatsForHour(previousHour); + const previousModelCount = + await calculateProjectHourlyModelStatsForHour(previousHour); + + logger.debug( + `Project hourly stats refresh complete. Current hour: ${currentProjectCount} projects, ${currentModelCount} model entries. Previous hour: ${previousProjectCount} projects, ${previousModelCount} model entries.`, + ); + } catch (error) { + logger.error( + "Error refreshing project hourly stats", + error instanceof Error ? error : new Error(String(error)), + ); + throw error; + } +} + +/** + * Backfill project hourly stats for missing hours + * Called on worker startup + */ +export async function backfillProjectHourlyStatsIfNeeded() { + logger.info("Checking for missing project hourly stats to backfill..."); + + try { + const database = db; + + // Get the most recent hourly stats entry + const latestStats = await database + .select({ hourTimestamp: projectHourlyStats.hourTimestamp }) + .from(projectHourlyStats) + .orderBy(sql`${projectHourlyStats.hourTimestamp} DESC`) + .limit(1); + + const previousHour = getPreviousHourStart(); + const backfillStartHour = new Date( + Date.now() - PROJECT_STATS_BACKFILL_HOURS * 60 * 60 * 1000, + ); + const backfillStartRounded = roundToHourStart(backfillStartHour); + + let startFromHour: Date; + + if (latestStats.length === 0) { + // No existing stats, start from backfill start + logger.info( + `No existing project hourly stats found. Starting backfill from ${backfillStartRounded.toISOString()}`, + ); + startFromHour = backfillStartRounded; + } else { + const lastHour = latestStats[0]!.hourTimestamp; + const hoursBehind = Math.floor( + (previousHour.getTime() - lastHour.getTime()) / (60 * 60 * 1000), + ); + + if (hoursBehind > 1) { + // We're missing some hours, backfill from after the last recorded hour + logger.info( + `Found gap of ${hoursBehind} hours. Backfilling from ${lastHour.toISOString()}`, + ); + startFromHour = new Date(lastHour.getTime() + 60 * 60 * 1000); + } else { + logger.info( + `Project hourly stats are up to date. Last entry: ${lastHour.toISOString()}`, + ); + return; + } + } + + // Backfill each missing hour + let hour = startFromHour; + let hoursProcessed = 0; + const maxHours = PROJECT_STATS_BACKFILL_HOURS + 1; // Safety limit + + while (hour <= previousHour && hoursProcessed < maxHours) { + const projectCount = await calculateProjectHourlyStatsForHour(hour); + const modelCount = await calculateProjectHourlyModelStatsForHour(hour); + + logger.info( + `Backfilled project hourly stats for ${hour.toISOString()}: ${projectCount} projects, ${modelCount} model entries`, + ); + + hour = new Date(hour.getTime() + 60 * 60 * 1000); + hoursProcessed++; + } + + if (hoursProcessed >= maxHours) { + logger.warn( + `Backfill stopped at limit of ${maxHours} hours to prevent excessive processing`, + ); + } + + logger.info( + `Project hourly stats backfill complete. Processed ${hoursProcessed} hours.`, + ); + } catch (error) { + logger.error( + "Error during project hourly stats backfill", + error instanceof Error ? error : new Error(String(error)), + ); + throw error; + } +} diff --git a/apps/worker/src/worker.ts b/apps/worker/src/worker.ts index dda6dacf4b..37f982ea92 100644 --- a/apps/worker/src/worker.ts +++ b/apps/worker/src/worker.ts @@ -26,6 +26,11 @@ import { logger } from "@llmgateway/logger"; import { hasErrorCode } from "@llmgateway/models"; import { BYOK_FEE_PERCENTAGE, calculateFees } from "@llmgateway/shared"; +import { + backfillProjectHourlyStatsIfNeeded, + PROJECT_STATS_REFRESH_INTERVAL_SECONDS, + refreshProjectHourlyStats, +} from "./services/project-stats-aggregator.js"; import { backfillHistoryIfNeeded, calculateAggregatedStatistics, @@ -857,6 +862,7 @@ let shouldStop = false; let minutelyIntervalId: NodeJS.Timeout | null = null; let currentMinuteIntervalId: NodeJS.Timeout | null = null; let aggregatedIntervalId: NodeJS.Timeout | null = null; +let projectStatsIntervalId: NodeJS.Timeout | null = null; let activeLoops = 0; let stopFailed = false; @@ -1047,6 +1053,18 @@ export async function startWorker() { ); }); + // Backfill project hourly stats if needed (for dashboard aggregations) + void backfillProjectHourlyStatsIfNeeded() + .then(() => { + logger.info("Project hourly stats backfill check completed"); + }) + .catch((error) => { + logger.error( + "Error during project hourly stats backfill", + error instanceof Error ? error : new Error(String(error)), + ); + }); + // Start statistics calculator logger.info("Starting statistics calculator..."); logger.info("- Minutely history: runs at the first second of every minute"); @@ -1175,6 +1193,27 @@ export async function startWorker() { scheduleAggregatedStats(); + // Start project hourly stats refresh (for dashboard aggregations) + logger.info( + `- Project hourly stats: runs every ${PROJECT_STATS_REFRESH_INTERVAL_SECONDS} seconds for dashboard aggregations`, + ); + + refreshProjectHourlyStats().catch((error) => { + logger.error( + "Error in initial project hourly stats refresh", + error instanceof Error ? error : new Error(String(error)), + ); + }); + + projectStatsIntervalId = setInterval(() => { + refreshProjectHourlyStats().catch((error) => { + logger.error( + "Error in interval project hourly stats refresh", + error instanceof Error ? error : new Error(String(error)), + ); + }); + }, PROJECT_STATS_REFRESH_INTERVAL_SECONDS * 1000); + // Start all parallel worker loops void runLogQueueLoop(); void runAutoTopUpLoop(); @@ -1210,6 +1249,12 @@ export async function stopWorker(): Promise { logger.info("Aggregated statistics calculator stopped"); } + if (projectStatsIntervalId) { + clearInterval(projectStatsIntervalId); + projectStatsIntervalId = null; + logger.info("Project hourly stats refresh stopped"); + } + // Wait for all loops to finish by polling activeLoops counter const maxWaitTime = 15000; // 15 seconds timeout const pollInterval = 100; // 100ms per iteration diff --git a/packages/db/migrations/1770544954_parallel_mindworm.sql b/packages/db/migrations/1770544954_parallel_mindworm.sql new file mode 100644 index 0000000000..c991736c38 --- /dev/null +++ b/packages/db/migrations/1770544954_parallel_mindworm.sql @@ -0,0 +1,48 @@ +CREATE TABLE "project_hourly_model_stats" ( + "id" text PRIMARY KEY, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + "project_id" text NOT NULL, + "hour_timestamp" timestamp NOT NULL, + "used_model" text NOT NULL, + "used_provider" text NOT NULL, + "request_count" integer DEFAULT 0 NOT NULL, + "error_count" integer DEFAULT 0 NOT NULL, + "cache_count" integer DEFAULT 0 NOT NULL, + "input_tokens" numeric DEFAULT '0' NOT NULL, + "output_tokens" numeric DEFAULT '0' NOT NULL, + "total_tokens" numeric DEFAULT '0' NOT NULL, + "cost" real DEFAULT 0 NOT NULL, + "input_cost" real DEFAULT 0 NOT NULL, + "output_cost" real DEFAULT 0 NOT NULL, + CONSTRAINT "project_hourly_model_stats_project_id_hour_timestamp_used_model_used_provider_unique" UNIQUE("project_id","hour_timestamp","used_model","used_provider") +); +--> statement-breakpoint +CREATE TABLE "project_hourly_stats" ( + "id" text PRIMARY KEY, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + "project_id" text NOT NULL, + "hour_timestamp" timestamp NOT NULL, + "request_count" integer DEFAULT 0 NOT NULL, + "error_count" integer DEFAULT 0 NOT NULL, + "cache_count" integer DEFAULT 0 NOT NULL, + "input_tokens" numeric DEFAULT '0' NOT NULL, + "output_tokens" numeric DEFAULT '0' NOT NULL, + "total_tokens" numeric DEFAULT '0' NOT NULL, + "reasoning_tokens" numeric DEFAULT '0' NOT NULL, + "cached_tokens" numeric DEFAULT '0' NOT NULL, + "cost" real DEFAULT 0 NOT NULL, + "input_cost" real DEFAULT 0 NOT NULL, + "output_cost" real DEFAULT 0 NOT NULL, + "request_cost" real DEFAULT 0 NOT NULL, + "data_storage_cost" real DEFAULT 0 NOT NULL, + "service_fee" real DEFAULT 0 NOT NULL, + "discount_savings" real DEFAULT 0 NOT NULL, + CONSTRAINT "project_hourly_stats_project_id_hour_timestamp_unique" UNIQUE("project_id","hour_timestamp") +); +--> statement-breakpoint +CREATE INDEX "project_hourly_model_stats_project_id_hour_timestamp_idx" ON "project_hourly_model_stats" ("project_id","hour_timestamp");--> statement-breakpoint +CREATE INDEX "project_hourly_model_stats_hour_timestamp_idx" ON "project_hourly_model_stats" ("hour_timestamp");--> statement-breakpoint +CREATE INDEX "project_hourly_stats_project_id_hour_timestamp_idx" ON "project_hourly_stats" ("project_id","hour_timestamp");--> statement-breakpoint +CREATE INDEX "project_hourly_stats_hour_timestamp_idx" ON "project_hourly_stats" ("hour_timestamp"); \ No newline at end of file diff --git a/packages/db/migrations/meta/1770544954_snapshot.json b/packages/db/migrations/meta/1770544954_snapshot.json new file mode 100644 index 0000000000..b9a82995ea --- /dev/null +++ b/packages/db/migrations/meta/1770544954_snapshot.json @@ -0,0 +1,8505 @@ +{ + "version": "8", + "dialect": "postgres", + "id": "e702d7a7-b85f-42ef-b3ab-351077dce738", + "prevId": "afccd9a7-b9e3-405e-ae16-89d16e6b336d", + "ddl": [ + { + "isRlsEnabled": false, + "name": "account", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key_iam_rule", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "audit_log", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "chat", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_config", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_rule", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_violation", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "installation", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "lock", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "log", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "message", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_history", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_provider_mapping", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_provider_mapping_history", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "organization", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "organization_action", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "passkey", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "payment_method", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project_hourly_model_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project_hourly_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "provider", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "provider_key", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "referral", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "session", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "transaction", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "user", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "user_organization", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "verification", + "entityType": "tables", + "schema": "public" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "account_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "access_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refresh_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "access_token_expires_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refresh_token_expires_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "scope", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "password", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "usage_limit", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "usage", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_by", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_type", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_value", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "action", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_type", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "title", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "web_search", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "true", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "enabled", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'{\"prompt_injection\":{\"enabled\":true,\"action\":\"block\"},\"jailbreak\":{\"enabled\":true,\"action\":\"block\"},\"pii_detection\":{\"enabled\":true,\"action\":\"redact\"},\"secrets\":{\"enabled\":true,\"action\":\"block\"},\"file_types\":{\"enabled\":true,\"action\":\"block\"},\"document_leakage\":{\"enabled\":false,\"action\":\"warn\"}}'" + }, + "generated": null, + "identity": null, + "name": "system_rules", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "10", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "max_file_size_mb", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 1, + "default": { + "value": "'{image/jpeg,image/png,image/gif,image/webp}'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "allowed_file_types", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'redact'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "pii_action", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "config", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "100", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "priority", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "true", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "enabled", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'block'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "action", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "log_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_name", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "category", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "action_taken", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "matched_pattern", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "matched_content", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content_hash", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "uuid", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "key", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "duration", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "requested_model", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "requested_provider", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model_mapping", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_provider", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "response_size", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_content", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tool_choice", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tool_results", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "finish_reason", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "unified_finish_reason", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "prompt_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "completion_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "messages", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "temperature", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "max_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "top_p", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "frequency_penalty", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "presence_penalty", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_effort", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "effort", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "response_format", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "has_error", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "error_details", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_input_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "web_search_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "estimated_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "discount", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "pricing_tier", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "mode", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_mode", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "source", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "custom_headers", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "routing_metadata", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "processed_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "raw_request", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "raw_response", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "upstream_request", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "upstream_response", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trace_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_retention_cleaned_up", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "params", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_agent", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plugins", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plugin_results", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "chat_id", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "images", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "sequence", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "released_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'(empty)'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'[]'" + }, + "generated": null, + "identity": null, + "name": "aliases", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'(empty)'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "family", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "free", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'[\"text\"]'" + }, + "generated": null, + "identity": null, + "name": "output", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'stable'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "stability", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "minute_timestamp", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_input_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_output_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_duration", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_name", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "output_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "context_size", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "max_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streaming", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "vision", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "json_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "json_output_schema", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "web_search", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "web_search_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'stable'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "stability", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "supported_parameters", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "test", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deprecated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deactivated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_provider_mapping_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "minute_timestamp", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_input_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_output_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_duration", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_email", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_company", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_address", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_tax_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_notes", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_customer_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_subscription_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_enabled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'10'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_threshold", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'10'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_amount", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'free'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "plan", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plan_expires_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "subscription_cancelled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trial_start_date", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trial_end_date", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_trial_active", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'none'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "retention_level", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "referral_earnings", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "payment_failure_count", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_payment_failure_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_personal", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'none'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_credits_used", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_credits_limit", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_billing_cycle_start", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_stripe_subscription_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_cancelled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_expires_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_allow_all_models", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "amount", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "public_key", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "credential_id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "counter", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "device_type", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "backed_up", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "transports", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_payment_method_id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_default", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "caching_enabled", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "60", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_duration_seconds", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'hybrid'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "mode", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_provider", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "streaming", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cancellation", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "color", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "website", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "announcement", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "base_url", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "options", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "referrer_organization_id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "referred_organization_id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ip_address", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_agent", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "amount", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "credit_amount", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'USD'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "currency", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'completed'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_payment_intent_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_invoice_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "related_transaction_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refund_reason", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "email", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "email_verified", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "onboarding_completed", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'owner'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "identifier", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "value", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "account_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_project_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_by", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_created_by_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_api_key_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "rule_type", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_rule_type_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_api_key_id_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_organization_id_created_at_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "action", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_action_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "resource_type", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_resource_type_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "chat_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "chat" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_config_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_config" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_rule_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "priority", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_rule_priority_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_violation_org_created_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "rule_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_violation_rule_created_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_project_id_created_at_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_model", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_provider", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_created_at_used_model_used_provider_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "data_retention_cleaned_up = false", + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_data_retention_pending_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_model", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_project_id_used_model_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "processed_at IS NULL", + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_processed_at_null_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "chat_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "message_chat_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "message" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "model" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_history_minute_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "provider_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_provider_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "model_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_model_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "organization_action_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "organization_action" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "passkey_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "passkey" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "payment_method_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "payment_method" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "project" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_model_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_model_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "provider_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "provider" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "provider_key_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "referrer_organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "referral_referrer_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "referred_organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "referral_referred_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "session_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "session" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "transaction_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "transaction" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "user_organization_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "user_organization_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "account_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": false, + "columns": [ + "project_id" + ], + "schemaTo": "public", + "tableTo": "project", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_project_id_project_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": false, + "columns": [ + "created_by" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_created_by_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": false, + "columns": [ + "api_key_id" + ], + "schemaTo": "public", + "tableTo": "api_key", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_iam_rule_api_key_id_api_key_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "audit_log_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "audit_log_user_id_user_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "chat_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "chat" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_config_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_config" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_rule_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_violation_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": false, + "columns": [ + "chat_id" + ], + "schemaTo": "public", + "tableTo": "chat", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "message_chat_id_chat_id_fk", + "entityType": "fks", + "schema": "public", + "table": "message" + }, + { + "nameExplicit": false, + "columns": [ + "model_id" + ], + "schemaTo": "public", + "tableTo": "model", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "model_provider_mapping_model_id_model_id_fk", + "entityType": "fks", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "provider_id" + ], + "schemaTo": "public", + "tableTo": "provider", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "model_provider_mapping_provider_id_provider_id_fk", + "entityType": "fks", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "organization_action_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "organization_action" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "passkey_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "passkey" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "payment_method_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "payment_method" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "project_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "project" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "provider_key_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": false, + "columns": [ + "referrer_organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "referral_referrer_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": false, + "columns": [ + "referred_organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "referral_referred_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "session_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "session" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "transaction_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "transaction" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "user_organization_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "user_organization_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "user_organization" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "account_pkey", + "schema": "public", + "table": "account", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_pkey", + "schema": "public", + "table": "api_key", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_iam_rule_pkey", + "schema": "public", + "table": "api_key_iam_rule", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "audit_log_pkey", + "schema": "public", + "table": "audit_log", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "chat_pkey", + "schema": "public", + "table": "chat", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_config_pkey", + "schema": "public", + "table": "guardrail_config", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_rule_pkey", + "schema": "public", + "table": "guardrail_rule", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_violation_pkey", + "schema": "public", + "table": "guardrail_violation", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "installation_pkey", + "schema": "public", + "table": "installation", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "lock_pkey", + "schema": "public", + "table": "lock", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "log_pkey", + "schema": "public", + "table": "log", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "message_pkey", + "schema": "public", + "table": "message", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_pkey", + "schema": "public", + "table": "model", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_history_pkey", + "schema": "public", + "table": "model_history", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_provider_mapping_pkey", + "schema": "public", + "table": "model_provider_mapping", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_provider_mapping_history_pkey", + "schema": "public", + "table": "model_provider_mapping_history", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "organization_pkey", + "schema": "public", + "table": "organization", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "organization_action_pkey", + "schema": "public", + "table": "organization_action", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "passkey_pkey", + "schema": "public", + "table": "passkey", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "payment_method_pkey", + "schema": "public", + "table": "payment_method", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_pkey", + "schema": "public", + "table": "project", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_hourly_model_stats_pkey", + "schema": "public", + "table": "project_hourly_model_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_hourly_stats_pkey", + "schema": "public", + "table": "project_hourly_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "provider_pkey", + "schema": "public", + "table": "provider", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "provider_key_pkey", + "schema": "public", + "table": "provider_key", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "referral_pkey", + "schema": "public", + "table": "referral", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "session_pkey", + "schema": "public", + "table": "session", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "transaction_pkey", + "schema": "public", + "table": "transaction", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "user_pkey", + "schema": "public", + "table": "user", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "user_organization_pkey", + "schema": "public", + "table": "user_organization", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "verification_pkey", + "schema": "public", + "table": "verification", + "entityType": "pks" + }, + { + "nameExplicit": false, + "columns": [ + "model_id", + "minute_timestamp" + ], + "nullsNotDistinct": false, + "name": "model_history_model_id_minute_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_history" + }, + { + "nameExplicit": false, + "columns": [ + "model_id", + "provider_id" + ], + "nullsNotDistinct": false, + "name": "model_provider_mapping_model_id_provider_id_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "model_provider_mapping_id", + "minute_timestamp" + ], + "nullsNotDistinct": false, + "name": "model_provider_mapping_history_model_provider_mapping_id_minute_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": false, + "columns": [ + "project_id", + "hour_timestamp", + "used_model", + "used_provider" + ], + "nullsNotDistinct": false, + "name": "project_hourly_model_stats_project_id_hour_timestamp_used_model_used_provider_unique", + "entityType": "uniques", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": false, + "columns": [ + "project_id", + "hour_timestamp" + ], + "nullsNotDistinct": false, + "name": "project_hourly_stats_project_id_hour_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id", + "name" + ], + "nullsNotDistinct": false, + "name": "provider_key_organization_id_name_unique", + "entityType": "uniques", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": false, + "columns": [ + "token" + ], + "nullsNotDistinct": false, + "name": "api_key_token_unique", + "schema": "public", + "table": "api_key", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "nullsNotDistinct": false, + "name": "guardrail_config_organization_id_key", + "schema": "public", + "table": "guardrail_config", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "uuid" + ], + "nullsNotDistinct": false, + "name": "installation_uuid_unique", + "schema": "public", + "table": "installation", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "key" + ], + "nullsNotDistinct": false, + "name": "lock_key_unique", + "schema": "public", + "table": "lock", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "stripe_customer_id" + ], + "nullsNotDistinct": false, + "name": "organization_stripe_customer_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "stripe_subscription_id" + ], + "nullsNotDistinct": false, + "name": "organization_stripe_subscription_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "dev_plan_stripe_subscription_id" + ], + "nullsNotDistinct": false, + "name": "organization_dev_plan_stripe_subscription_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "referred_organization_id" + ], + "nullsNotDistinct": false, + "name": "referral_referred_organization_id_key", + "schema": "public", + "table": "referral", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "token" + ], + "nullsNotDistinct": false, + "name": "session_token_unique", + "schema": "public", + "table": "session", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "email" + ], + "nullsNotDistinct": false, + "name": "user_email_unique", + "schema": "public", + "table": "user", + "entityType": "uniques" + } + ], + "renames": [] +} \ No newline at end of file diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index 2c5856e213..4a7b9ea48c 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -610,6 +610,13 @@ "when": 1770068951667, "tag": "1770068951_simple_magma", "breakpoints": true + }, + { + "idx": 87, + "version": "8", + "when": 1770544954811, + "tag": "1770544954_parallel_mindworm", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts index 9941c2149a..e55b38fcf4 100644 --- a/packages/db/src/schema.ts +++ b/packages/db/src/schema.ts @@ -1129,3 +1129,94 @@ export const guardrailViolation = pgTable( ), ], ); + +// Project hourly statistics aggregation - used for fast dashboard queries +export const projectHourlyStats = pgTable( + "project_hourly_stats", + { + id: text().primaryKey().notNull().$defaultFn(shortid), + createdAt: timestamp().notNull().defaultNow(), + updatedAt: timestamp() + .notNull() + .defaultNow() + .$onUpdate(() => new Date()), + projectId: text().notNull(), + hourTimestamp: timestamp().notNull(), // Start of the hour bucket + // Request counts + requestCount: integer().notNull().default(0), + errorCount: integer().notNull().default(0), + cacheCount: integer().notNull().default(0), + // Token counts + inputTokens: decimal().notNull().default("0"), + outputTokens: decimal().notNull().default("0"), + totalTokens: decimal().notNull().default("0"), + reasoningTokens: decimal().notNull().default("0"), + cachedTokens: decimal().notNull().default("0"), + // Costs + cost: real().notNull().default(0), + inputCost: real().notNull().default(0), + outputCost: real().notNull().default(0), + requestCost: real().notNull().default(0), + dataStorageCost: real().notNull().default(0), + serviceFee: real().notNull().default(0), + discountSavings: real().notNull().default(0), + }, + (table) => [ + // Unique constraint for one record per project-hour + unique().on(table.projectId, table.hourTimestamp), + // Index for dashboard queries (project + time range) + index("project_hourly_stats_project_id_hour_timestamp_idx").on( + table.projectId, + table.hourTimestamp, + ), + // Index for worker refresh queries (find hours to update) + index("project_hourly_stats_hour_timestamp_idx").on(table.hourTimestamp), + ], +); + +// Project hourly model statistics aggregation - model breakdown per hour +export const projectHourlyModelStats = pgTable( + "project_hourly_model_stats", + { + id: text().primaryKey().notNull().$defaultFn(shortid), + createdAt: timestamp().notNull().defaultNow(), + updatedAt: timestamp() + .notNull() + .defaultNow() + .$onUpdate(() => new Date()), + projectId: text().notNull(), + hourTimestamp: timestamp().notNull(), // Start of the hour bucket + usedModel: text().notNull(), + usedProvider: text().notNull(), + // Request counts + requestCount: integer().notNull().default(0), + errorCount: integer().notNull().default(0), + cacheCount: integer().notNull().default(0), + // Token counts + inputTokens: decimal().notNull().default("0"), + outputTokens: decimal().notNull().default("0"), + totalTokens: decimal().notNull().default("0"), + // Costs + cost: real().notNull().default(0), + inputCost: real().notNull().default(0), + outputCost: real().notNull().default(0), + }, + (table) => [ + // Unique constraint for one record per project-hour-model-provider + unique().on( + table.projectId, + table.hourTimestamp, + table.usedModel, + table.usedProvider, + ), + // Index for dashboard queries (project + time range) + index("project_hourly_model_stats_project_id_hour_timestamp_idx").on( + table.projectId, + table.hourTimestamp, + ), + // Index for worker refresh queries + index("project_hourly_model_stats_hour_timestamp_idx").on( + table.hourTimestamp, + ), + ], +); From 1145618013e56a3bc9c6d14c21a195530b58b7fb Mon Sep 17 00:00:00 2001 From: steebchen Date: Mon, 9 Feb 2026 06:45:16 +0000 Subject: [PATCH 02/24] refactor: use statsAggregatedAt marker for accurate aggregation Instead of time-based backfill with PROJECT_STATS_BACKFILL_HOURS, now uses a marker field on logs to track which have been aggregated: - Add statsAggregatedAt column to log table - Add partial index for efficient queries on unprocessed logs - Process logs by finding those with NULL statsAggregatedAt - Mark logs as processed after aggregating their hour bucket - Works for any time range without configuration This ensures aggregation is always accurate regardless of how far back the data goes, and handles late-arriving logs correctly. Co-Authored-By: Claude Opus 4.5 --- .../src/services/project-stats-aggregator.ts | 378 +++++++++--------- apps/worker/src/worker.ts | 13 - ...m.sql => 1770619420_far_smiling_tiger.sql} | 2 + ...snapshot.json => 1770619420_snapshot.json} | 43 +- packages/db/migrations/meta/_journal.json | 7 + packages/db/src/schema.ts | 5 + 6 files changed, 254 insertions(+), 194 deletions(-) rename packages/db/migrations/{1770544954_parallel_mindworm.sql => 1770619420_far_smiling_tiger.sql} (91%) rename packages/db/migrations/meta/{1770544954_snapshot.json => 1770619420_snapshot.json} (99%) diff --git a/apps/worker/src/services/project-stats-aggregator.ts b/apps/worker/src/services/project-stats-aggregator.ts index 0d47cd8f50..c4c14e152f 100644 --- a/apps/worker/src/services/project-stats-aggregator.ts +++ b/apps/worker/src/services/project-stats-aggregator.ts @@ -7,6 +7,7 @@ import { gte, lt, and, + isNull, } from "@llmgateway/db"; import { logger } from "@llmgateway/logger"; @@ -14,10 +15,6 @@ import { logger } from "@llmgateway/logger"; export const PROJECT_STATS_REFRESH_INTERVAL_SECONDS = Number(process.env.PROJECT_STATS_REFRESH_INTERVAL_SECONDS) || 60; -// Configuration for backfill duration in hours (defaults to 24 hours) -const PROJECT_STATS_BACKFILL_HOURS = - Number(process.env.PROJECT_STATS_BACKFILL_HOURS) || 24; - /** * Helper function to round any date to the start of its hour (00 minutes, 00 seconds, 00 milliseconds) */ @@ -41,30 +38,19 @@ function getCurrentHourStart(): Date { } /** - * Helper function to get the previous hour start + * Calculate and store hourly statistics for a specific project and hour + * This recalculates the entire hour from the raw log table */ -function getPreviousHourStart(): Date { - const currentHour = getCurrentHourStart(); - return new Date(currentHour.getTime() - 60 * 60 * 1000); -} - -/** - * Calculate and store hourly statistics for all projects for a specific hour - * @param targetHour The specific hour to calculate stats for - */ -async function calculateProjectHourlyStatsForHour(targetHour: Date) { - const roundedTargetHour = roundToHourStart(targetHour); - const hourEnd = new Date(roundedTargetHour.getTime() + 60 * 60 * 1000); +async function recalculateProjectHourlyStats( + projectId: string, + hourTimestamp: Date, +) { + const hourEnd = new Date(hourTimestamp.getTime() + 60 * 60 * 1000); const database = db; - logger.debug( - `Calculating project hourly stats for ${roundedTargetHour.toISOString()}`, - ); - - // Aggregate logs by project for this hour - const projectStats = await database + // Aggregate all logs for this project and hour + const [projectStats] = await database .select({ - projectId: log.projectId, requestCount: sql`count(*)::int`.as("requestCount"), errorCount: sql`sum(case when ${log.hasError} = true then 1 else 0 end)::int`.as( @@ -124,79 +110,75 @@ async function calculateProjectHourlyStatsForHour(targetHour: Date) { }) .from(log) .where( - and(gte(log.createdAt, roundedTargetHour), lt(log.createdAt, hourEnd)), - ) - .groupBy(log.projectId); + and( + sql`${log.projectId} = ${projectId}`, + gte(log.createdAt, hourTimestamp), + lt(log.createdAt, hourEnd), + ), + ); - // Upsert project hourly stats - for (const stat of projectStats) { - await database - .insert(projectHourlyStats) - .values({ - projectId: stat.projectId, - hourTimestamp: roundedTargetHour, - requestCount: stat.requestCount, - errorCount: stat.errorCount, - cacheCount: stat.cacheCount, - inputTokens: stat.inputTokens, - outputTokens: stat.outputTokens, - totalTokens: stat.totalTokens, - reasoningTokens: stat.reasoningTokens, - cachedTokens: stat.cachedTokens, - cost: stat.cost, - inputCost: stat.inputCost, - outputCost: stat.outputCost, - requestCost: stat.requestCost, - dataStorageCost: stat.dataStorageCost, - serviceFee: stat.serviceFee, - discountSavings: stat.discountSavings, - }) - .onConflictDoUpdate({ - target: [ - projectHourlyStats.projectId, - projectHourlyStats.hourTimestamp, - ], - set: { - requestCount: stat.requestCount, - errorCount: stat.errorCount, - cacheCount: stat.cacheCount, - inputTokens: stat.inputTokens, - outputTokens: stat.outputTokens, - totalTokens: stat.totalTokens, - reasoningTokens: stat.reasoningTokens, - cachedTokens: stat.cachedTokens, - cost: stat.cost, - inputCost: stat.inputCost, - outputCost: stat.outputCost, - requestCost: stat.requestCost, - dataStorageCost: stat.dataStorageCost, - serviceFee: stat.serviceFee, - discountSavings: stat.discountSavings, - updatedAt: new Date(), - }, - }); + if (!projectStats || projectStats.requestCount === 0) { + return; } - return projectStats.length; + // Upsert project hourly stats + await database + .insert(projectHourlyStats) + .values({ + projectId, + hourTimestamp, + requestCount: projectStats.requestCount, + errorCount: projectStats.errorCount, + cacheCount: projectStats.cacheCount, + inputTokens: projectStats.inputTokens, + outputTokens: projectStats.outputTokens, + totalTokens: projectStats.totalTokens, + reasoningTokens: projectStats.reasoningTokens, + cachedTokens: projectStats.cachedTokens, + cost: projectStats.cost, + inputCost: projectStats.inputCost, + outputCost: projectStats.outputCost, + requestCost: projectStats.requestCost, + dataStorageCost: projectStats.dataStorageCost, + serviceFee: projectStats.serviceFee, + discountSavings: projectStats.discountSavings, + }) + .onConflictDoUpdate({ + target: [projectHourlyStats.projectId, projectHourlyStats.hourTimestamp], + set: { + requestCount: projectStats.requestCount, + errorCount: projectStats.errorCount, + cacheCount: projectStats.cacheCount, + inputTokens: projectStats.inputTokens, + outputTokens: projectStats.outputTokens, + totalTokens: projectStats.totalTokens, + reasoningTokens: projectStats.reasoningTokens, + cachedTokens: projectStats.cachedTokens, + cost: projectStats.cost, + inputCost: projectStats.inputCost, + outputCost: projectStats.outputCost, + requestCost: projectStats.requestCost, + dataStorageCost: projectStats.dataStorageCost, + serviceFee: projectStats.serviceFee, + discountSavings: projectStats.discountSavings, + updatedAt: new Date(), + }, + }); } /** - * Calculate and store hourly model statistics for all projects for a specific hour - * @param targetHour The specific hour to calculate stats for + * Calculate and store hourly model statistics for a specific project and hour */ -async function calculateProjectHourlyModelStatsForHour(targetHour: Date) { - const roundedTargetHour = roundToHourStart(targetHour); - const hourEnd = new Date(roundedTargetHour.getTime() + 60 * 60 * 1000); +async function recalculateProjectHourlyModelStats( + projectId: string, + hourTimestamp: Date, +) { + const hourEnd = new Date(hourTimestamp.getTime() + 60 * 60 * 1000); const database = db; - logger.debug( - `Calculating project hourly model stats for ${roundedTargetHour.toISOString()}`, - ); - - // Aggregate logs by project, model, and provider for this hour + // Aggregate logs by model and provider for this project and hour const modelStats = await database .select({ - projectId: log.projectId, usedModel: log.usedModel, usedProvider: log.usedProvider, requestCount: sql`count(*)::int`.as("requestCount"), @@ -230,17 +212,21 @@ async function calculateProjectHourlyModelStatsForHour(targetHour: Date) { }) .from(log) .where( - and(gte(log.createdAt, roundedTargetHour), lt(log.createdAt, hourEnd)), + and( + sql`${log.projectId} = ${projectId}`, + gte(log.createdAt, hourTimestamp), + lt(log.createdAt, hourEnd), + ), ) - .groupBy(log.projectId, log.usedModel, log.usedProvider); + .groupBy(log.usedModel, log.usedProvider); - // Upsert project hourly model stats + // Upsert each model's stats for (const stat of modelStats) { await database .insert(projectHourlyModelStats) .values({ - projectId: stat.projectId, - hourTimestamp: roundedTargetHour, + projectId, + hourTimestamp, usedModel: stat.usedModel, usedProvider: stat.usedProvider, requestCount: stat.requestCount, @@ -274,39 +260,93 @@ async function calculateProjectHourlyModelStatsForHour(targetHour: Date) { }, }); } - - return modelStats.length; } /** - * Refresh project hourly stats for the current hour and previous hour - * Previous hour is also refreshed to handle logs that arrived just after the hour boundary + * Process unprocessed logs and update aggregation tables + * This finds logs where statsAggregatedAt is NULL, determines which hour buckets + * need recalculation, recalculates them, and marks the logs as processed. */ -export async function refreshProjectHourlyStats() { - const currentHour = getCurrentHourStart(); - const previousHour = getPreviousHourStart(); +export async function processUnprocessedLogs() { + const database = db; + const now = new Date(); + const currentHourStart = getCurrentHourStart(); - logger.debug("Starting project hourly stats refresh..."); + logger.debug("Processing unprocessed logs for stats aggregation..."); try { - // Refresh current hour (for real-time data) - const currentProjectCount = - await calculateProjectHourlyStatsForHour(currentHour); - const currentModelCount = - await calculateProjectHourlyModelStatsForHour(currentHour); - - // Refresh previous hour (to catch late-arriving logs) - const previousProjectCount = - await calculateProjectHourlyStatsForHour(previousHour); - const previousModelCount = - await calculateProjectHourlyModelStatsForHour(previousHour); + // Find distinct project-hour combinations that have unprocessed logs + // Only process hours that are complete (not the current hour) + const unprocessedBuckets = await database + .select({ + projectId: log.projectId, + hourTimestamp: sql`date_trunc('hour', ${log.createdAt})`.as( + "hourTimestamp", + ), + }) + .from(log) + .where( + and( + isNull(log.statsAggregatedAt), + lt(log.createdAt, currentHourStart), // Only process completed hours + ), + ) + .groupBy(log.projectId, sql`date_trunc('hour', ${log.createdAt})`) + .limit(100); // Process up to 100 buckets per cycle to avoid long-running transactions - logger.debug( - `Project hourly stats refresh complete. Current hour: ${currentProjectCount} projects, ${currentModelCount} model entries. Previous hour: ${previousProjectCount} projects, ${previousModelCount} model entries.`, + if (unprocessedBuckets.length === 0) { + logger.debug("No unprocessed logs found for stats aggregation"); + return { bucketsProcessed: 0, logsMarked: 0 }; + } + + logger.info( + `Found ${unprocessedBuckets.length} project-hour buckets with unprocessed logs`, + ); + + let totalLogsMarked = 0; + + // Process each bucket + for (const bucket of unprocessedBuckets) { + const hourTimestamp = new Date(bucket.hourTimestamp); + const hourEnd = new Date(hourTimestamp.getTime() + 60 * 60 * 1000); + + // Recalculate aggregations for this project-hour + await recalculateProjectHourlyStats(bucket.projectId, hourTimestamp); + await recalculateProjectHourlyModelStats(bucket.projectId, hourTimestamp); + + // Mark logs in this bucket as processed + const result = await database + .update(log) + .set({ statsAggregatedAt: now }) + .where( + and( + sql`${log.projectId} = ${bucket.projectId}`, + gte(log.createdAt, hourTimestamp), + lt(log.createdAt, hourEnd), + isNull(log.statsAggregatedAt), + ), + ); + + // Count affected rows (drizzle returns the updated rows) + const affectedRows = Array.isArray(result) ? result.length : 0; + totalLogsMarked += affectedRows; + + logger.debug( + `Processed bucket ${bucket.projectId}/${hourTimestamp.toISOString()}, marked logs as aggregated`, + ); + } + + logger.info( + `Stats aggregation complete: ${unprocessedBuckets.length} buckets processed`, ); + + return { + bucketsProcessed: unprocessedBuckets.length, + logsMarked: totalLogsMarked, + }; } catch (error) { logger.error( - "Error refreshing project hourly stats", + "Error processing unprocessed logs for stats aggregation", error instanceof Error ? error : new Error(String(error)), ); throw error; @@ -314,85 +354,63 @@ export async function refreshProjectHourlyStats() { } /** - * Backfill project hourly stats for missing hours - * Called on worker startup + * Refresh the current hour's stats (for real-time dashboard data) + * This is separate from processUnprocessedLogs because the current hour + * is always incomplete and needs continuous updates. */ -export async function backfillProjectHourlyStatsIfNeeded() { - logger.info("Checking for missing project hourly stats to backfill..."); - - try { - const database = db; - - // Get the most recent hourly stats entry - const latestStats = await database - .select({ hourTimestamp: projectHourlyStats.hourTimestamp }) - .from(projectHourlyStats) - .orderBy(sql`${projectHourlyStats.hourTimestamp} DESC`) - .limit(1); - - const previousHour = getPreviousHourStart(); - const backfillStartHour = new Date( - Date.now() - PROJECT_STATS_BACKFILL_HOURS * 60 * 60 * 1000, - ); - const backfillStartRounded = roundToHourStart(backfillStartHour); +export async function refreshCurrentHourStats() { + const database = db; + const currentHourStart = getCurrentHourStart(); - let startFromHour: Date; + logger.debug( + `Refreshing current hour stats for ${currentHourStart.toISOString()}`, + ); - if (latestStats.length === 0) { - // No existing stats, start from backfill start - logger.info( - `No existing project hourly stats found. Starting backfill from ${backfillStartRounded.toISOString()}`, - ); - startFromHour = backfillStartRounded; - } else { - const lastHour = latestStats[0]!.hourTimestamp; - const hoursBehind = Math.floor( - (previousHour.getTime() - lastHour.getTime()) / (60 * 60 * 1000), - ); + try { + // Find all projects that have logs in the current hour + const projectsWithCurrentHourLogs = await database + .select({ + projectId: log.projectId, + }) + .from(log) + .where(gte(log.createdAt, currentHourStart)) + .groupBy(log.projectId); - if (hoursBehind > 1) { - // We're missing some hours, backfill from after the last recorded hour - logger.info( - `Found gap of ${hoursBehind} hours. Backfilling from ${lastHour.toISOString()}`, - ); - startFromHour = new Date(lastHour.getTime() + 60 * 60 * 1000); - } else { - logger.info( - `Project hourly stats are up to date. Last entry: ${lastHour.toISOString()}`, - ); - return; - } + for (const { projectId } of projectsWithCurrentHourLogs) { + await recalculateProjectHourlyStats(projectId, currentHourStart); + await recalculateProjectHourlyModelStats(projectId, currentHourStart); } - // Backfill each missing hour - let hour = startFromHour; - let hoursProcessed = 0; - const maxHours = PROJECT_STATS_BACKFILL_HOURS + 1; // Safety limit - - while (hour <= previousHour && hoursProcessed < maxHours) { - const projectCount = await calculateProjectHourlyStatsForHour(hour); - const modelCount = await calculateProjectHourlyModelStatsForHour(hour); + logger.debug( + `Refreshed current hour stats for ${projectsWithCurrentHourLogs.length} projects`, + ); + } catch (error) { + logger.error( + "Error refreshing current hour stats", + error instanceof Error ? error : new Error(String(error)), + ); + throw error; + } +} - logger.info( - `Backfilled project hourly stats for ${hour.toISOString()}: ${projectCount} projects, ${modelCount} model entries`, - ); +/** + * Main refresh function called by the worker interval + * Processes both unprocessed historical logs and refreshes current hour + */ +export async function refreshProjectHourlyStats() { + logger.debug("Starting project hourly stats refresh..."); - hour = new Date(hour.getTime() + 60 * 60 * 1000); - hoursProcessed++; - } + try { + // Process any unprocessed logs from completed hours + await processUnprocessedLogs(); - if (hoursProcessed >= maxHours) { - logger.warn( - `Backfill stopped at limit of ${maxHours} hours to prevent excessive processing`, - ); - } + // Refresh current hour for real-time data + await refreshCurrentHourStats(); - logger.info( - `Project hourly stats backfill complete. Processed ${hoursProcessed} hours.`, - ); + logger.debug("Project hourly stats refresh complete"); } catch (error) { logger.error( - "Error during project hourly stats backfill", + "Error refreshing project hourly stats", error instanceof Error ? error : new Error(String(error)), ); throw error; diff --git a/apps/worker/src/worker.ts b/apps/worker/src/worker.ts index 37f982ea92..7767244933 100644 --- a/apps/worker/src/worker.ts +++ b/apps/worker/src/worker.ts @@ -27,7 +27,6 @@ import { hasErrorCode } from "@llmgateway/models"; import { BYOK_FEE_PERCENTAGE, calculateFees } from "@llmgateway/shared"; import { - backfillProjectHourlyStatsIfNeeded, PROJECT_STATS_REFRESH_INTERVAL_SECONDS, refreshProjectHourlyStats, } from "./services/project-stats-aggregator.js"; @@ -1053,18 +1052,6 @@ export async function startWorker() { ); }); - // Backfill project hourly stats if needed (for dashboard aggregations) - void backfillProjectHourlyStatsIfNeeded() - .then(() => { - logger.info("Project hourly stats backfill check completed"); - }) - .catch((error) => { - logger.error( - "Error during project hourly stats backfill", - error instanceof Error ? error : new Error(String(error)), - ); - }); - // Start statistics calculator logger.info("Starting statistics calculator..."); logger.info("- Minutely history: runs at the first second of every minute"); diff --git a/packages/db/migrations/1770544954_parallel_mindworm.sql b/packages/db/migrations/1770619420_far_smiling_tiger.sql similarity index 91% rename from packages/db/migrations/1770544954_parallel_mindworm.sql rename to packages/db/migrations/1770619420_far_smiling_tiger.sql index c991736c38..14270cad93 100644 --- a/packages/db/migrations/1770544954_parallel_mindworm.sql +++ b/packages/db/migrations/1770619420_far_smiling_tiger.sql @@ -42,6 +42,8 @@ CREATE TABLE "project_hourly_stats" ( CONSTRAINT "project_hourly_stats_project_id_hour_timestamp_unique" UNIQUE("project_id","hour_timestamp") ); --> statement-breakpoint +ALTER TABLE "log" ADD COLUMN "stats_aggregated_at" timestamp;--> statement-breakpoint +CREATE INDEX "log_stats_aggregated_at_null_idx" ON "log" ("project_id","created_at") WHERE stats_aggregated_at IS NULL;--> statement-breakpoint CREATE INDEX "project_hourly_model_stats_project_id_hour_timestamp_idx" ON "project_hourly_model_stats" ("project_id","hour_timestamp");--> statement-breakpoint CREATE INDEX "project_hourly_model_stats_hour_timestamp_idx" ON "project_hourly_model_stats" ("hour_timestamp");--> statement-breakpoint CREATE INDEX "project_hourly_stats_project_id_hour_timestamp_idx" ON "project_hourly_stats" ("project_id","hour_timestamp");--> statement-breakpoint diff --git a/packages/db/migrations/meta/1770544954_snapshot.json b/packages/db/migrations/meta/1770619420_snapshot.json similarity index 99% rename from packages/db/migrations/meta/1770544954_snapshot.json rename to packages/db/migrations/meta/1770619420_snapshot.json index b9a82995ea..019ffaad16 100644 --- a/packages/db/migrations/meta/1770544954_snapshot.json +++ b/packages/db/migrations/meta/1770619420_snapshot.json @@ -1,7 +1,7 @@ { "version": "8", "dialect": "postgres", - "id": "e702d7a7-b85f-42ef-b3ab-351077dce738", + "id": "83306c1b-2fae-4157-b54d-1d362b7e77ba", "prevId": "afccd9a7-b9e3-405e-ae16-89d16e6b336d", "ddl": [ { @@ -2189,6 +2189,19 @@ "schema": "public", "table": "log" }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_aggregated_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, { "type": "jsonb", "typeSchema": null, @@ -7087,6 +7100,34 @@ "schema": "public", "table": "log" }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "stats_aggregated_at IS NULL", + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_stats_aggregated_at_null_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, { "nameExplicit": true, "columns": [ diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index 4a7b9ea48c..8e347c762c 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -617,6 +617,13 @@ "when": 1770544954811, "tag": "1770544954_parallel_mindworm", "breakpoints": true + }, + { + "idx": 88, + "version": "8", + "when": 1770619420657, + "tag": "1770619420_far_smiling_tiger", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts index e55b38fcf4..12ec32e004 100644 --- a/packages/db/src/schema.ts +++ b/packages/db/src/schema.ts @@ -481,6 +481,7 @@ export const log = pgTable( }>; }>(), processedAt: timestamp(), + statsAggregatedAt: timestamp(), // When this log was included in hourly stats aggregation rawRequest: jsonb(), rawResponse: jsonb(), upstreamRequest: jsonb(), @@ -522,6 +523,10 @@ export const log = pgTable( index("log_processed_at_null_idx") .on(table.createdAt) .where(sql`processed_at IS NULL`), + // Partial index for stats aggregation: only indexes logs not yet aggregated + index("log_stats_aggregated_at_null_idx") + .on(table.projectId, table.createdAt) + .where(sql`stats_aggregated_at IS NULL`), ], ); From 991d4a5b6ee15b4756c15bde7217be1a8e67f6f6 Mon Sep 17 00:00:00 2001 From: steebchen Date: Mon, 9 Feb 2026 07:01:22 +0000 Subject: [PATCH 03/24] feat: add API key aggregation and detailed breakdown fields - Add apiKeyHourlyStats table for per-API-key aggregations - Add detailed breakdown fields to all aggregation tables: - streamedCount, nonStreamedCount - completedCount, lengthLimitCount, contentFilterCount, toolCallsCount, canceledCount, unknownFinishCount (unified finish reasons) - clientErrorCount, gatewayErrorCount, upstreamErrorCount (error types) - reasoningTokens, cachedTokens - requestCost, dataStorageCost, serviceFee, discountSavings - Update activity route to use apiKeyHourlyStats when filtering by API key - Refactor aggregator to use shared getCommonAggregationFields() helper This enables fast dashboard queries with API key filtering and detailed breakdown analytics without falling back to raw log table scans. Co-Authored-By: Claude Opus 4.5 --- apps/api/src/routes/activity.ts | 134 +- .../src/services/project-stats-aggregator.ts | 338 +- .../1770619420_far_smiling_tiger.sql | 50 - .../1770620423_eager_big_bertha.sql | 117 + ...snapshot.json => 1770620423_snapshot.json} | 3725 +++++++++++------ packages/db/migrations/meta/_journal.json | 7 + packages/db/src/schema.ts | 95 + 7 files changed, 2822 insertions(+), 1644 deletions(-) delete mode 100644 packages/db/migrations/1770619420_far_smiling_tiger.sql create mode 100644 packages/db/migrations/1770620423_eager_big_bertha.sql rename packages/db/migrations/meta/{1770619420_snapshot.json => 1770620423_snapshot.json} (88%) diff --git a/apps/api/src/routes/activity.ts b/apps/api/src/routes/activity.ts index 360db39786..ac4db9e6b5 100644 --- a/apps/api/src/routes/activity.ts +++ b/apps/api/src/routes/activity.ts @@ -7,7 +7,6 @@ import { getUserOrganizationIds } from "@/utils/authorization.js"; import { db, sql, - tables, inArray, and, gte, @@ -15,6 +14,7 @@ import { eq, projectHourlyStats, projectHourlyModelStats, + apiKeyHourlyStats, } from "@llmgateway/db"; import type { ServerTypes } from "@/vars.js"; @@ -133,131 +133,77 @@ activity.openapi(getActivity, async (c) => { }); } - // If filtering by apiKeyId, we need to fall back to raw log table queries - // since aggregation tables don't track per-API-key stats + // If filtering by apiKeyId, use the apiKeyHourlyStats aggregation table if (apiKeyId) { - // Query daily aggregated data from raw logs (fallback for apiKeyId filter) - const dailyAggregates = await db + // Query daily aggregated data from apiKeyHourlyStats table + const hourlyAggregates = await db .select({ - date: sql`DATE(${tables.log.createdAt})`.as("date"), - requestCount: sql`COUNT(*)`.as("requestCount"), + date: sql`DATE(${apiKeyHourlyStats.hourTimestamp})`.as("date"), + requestCount: + sql`COALESCE(SUM(${apiKeyHourlyStats.requestCount}), 0)`.as( + "requestCount", + ), inputTokens: - sql`COALESCE(SUM(CAST(${tables.log.promptTokens} AS NUMERIC)), 0)`.as( + sql`COALESCE(SUM(CAST(${apiKeyHourlyStats.inputTokens} AS NUMERIC)), 0)`.as( "inputTokens", ), outputTokens: - sql`COALESCE(SUM(CAST(${tables.log.completionTokens} AS NUMERIC)), 0)`.as( + sql`COALESCE(SUM(CAST(${apiKeyHourlyStats.outputTokens} AS NUMERIC)), 0)`.as( "outputTokens", ), totalTokens: - sql`COALESCE(SUM(CAST(${tables.log.totalTokens} AS NUMERIC)), 0)`.as( + sql`COALESCE(SUM(CAST(${apiKeyHourlyStats.totalTokens} AS NUMERIC)), 0)`.as( "totalTokens", ), - cost: sql`COALESCE(SUM(${tables.log.cost}), 0)`.as("cost"), - inputCost: sql`COALESCE(SUM(${tables.log.inputCost}), 0)`.as( - "inputCost", - ), - outputCost: sql`COALESCE(SUM(${tables.log.outputCost}), 0)`.as( - "outputCost", + cost: sql`COALESCE(SUM(${apiKeyHourlyStats.cost}), 0)`.as( + "cost", ), + inputCost: + sql`COALESCE(SUM(${apiKeyHourlyStats.inputCost}), 0)`.as( + "inputCost", + ), + outputCost: + sql`COALESCE(SUM(${apiKeyHourlyStats.outputCost}), 0)`.as( + "outputCost", + ), requestCost: - sql`COALESCE(SUM(${tables.log.requestCost}), 0)`.as( + sql`COALESCE(SUM(${apiKeyHourlyStats.requestCost}), 0)`.as( "requestCost", ), dataStorageCost: - sql`COALESCE(SUM(${tables.log.dataStorageCost}), 0)`.as( + sql`COALESCE(SUM(${apiKeyHourlyStats.dataStorageCost}), 0)`.as( "dataStorageCost", ), errorCount: - sql`SUM(CASE WHEN ${tables.log.hasError} = true THEN 1 ELSE 0 END)`.as( + sql`COALESCE(SUM(${apiKeyHourlyStats.errorCount}), 0)`.as( "errorCount", ), cacheCount: - sql`SUM(CASE WHEN ${tables.log.cached} = true THEN 1 ELSE 0 END)`.as( + sql`COALESCE(SUM(${apiKeyHourlyStats.cacheCount}), 0)`.as( "cacheCount", ), - discountSavings: sql`COALESCE( - SUM( - CASE - WHEN ${tables.log.discount} > 0 AND ${tables.log.discount} < 1 - THEN ${tables.log.cost} * ${tables.log.discount} / (1 - ${tables.log.discount}) - ELSE 0 - END - ), - 0 - )`.as("discountSavings"), - }) - .from(tables.log) - .where( - and( - inArray(tables.log.projectId, projectIds), - gte(tables.log.createdAt, startDate), - lte(tables.log.createdAt, endDate), - eq(tables.log.apiKeyId, apiKeyId), - ), - ) - .groupBy(sql`DATE(${tables.log.createdAt})`) - .orderBy(sql`DATE(${tables.log.createdAt}) ASC`); - - // Query model breakdown data from raw logs - const modelBreakdowns = await db - .select({ - date: sql`DATE(${tables.log.createdAt})`.as("date"), - usedModel: tables.log.usedModel, - usedProvider: tables.log.usedProvider, - requestCount: sql`COUNT(*)`.as("requestCount"), - inputTokens: - sql`COALESCE(SUM(CAST(${tables.log.promptTokens} AS NUMERIC)), 0)`.as( - "inputTokens", - ), - outputTokens: - sql`COALESCE(SUM(CAST(${tables.log.completionTokens} AS NUMERIC)), 0)`.as( - "outputTokens", - ), - totalTokens: - sql`COALESCE(SUM(CAST(${tables.log.totalTokens} AS NUMERIC)), 0)`.as( - "totalTokens", + discountSavings: + sql`COALESCE(SUM(${apiKeyHourlyStats.discountSavings}), 0)`.as( + "discountSavings", ), - cost: sql`COALESCE(SUM(${tables.log.cost}), 0)`.as("cost"), }) - .from(tables.log) + .from(apiKeyHourlyStats) .where( and( - inArray(tables.log.projectId, projectIds), - gte(tables.log.createdAt, startDate), - lte(tables.log.createdAt, endDate), - eq(tables.log.apiKeyId, apiKeyId), + eq(apiKeyHourlyStats.apiKeyId, apiKeyId), + inArray(apiKeyHourlyStats.projectId, projectIds), + gte(apiKeyHourlyStats.hourTimestamp, startDate), + lte(apiKeyHourlyStats.hourTimestamp, endDate), ), ) - .groupBy( - sql`DATE(${tables.log.createdAt}), ${tables.log.usedModel}, ${tables.log.usedProvider}`, - ) - .orderBy( - sql`DATE(${tables.log.createdAt}) ASC, ${tables.log.usedModel} ASC`, - ); + .groupBy(sql`DATE(${apiKeyHourlyStats.hourTimestamp})`) + .orderBy(sql`DATE(${apiKeyHourlyStats.hourTimestamp}) ASC`); - // Create a map to organize model breakdowns by date - const modelBreakdownByDate = new Map< - string, - z.infer[] - >(); - for (const breakdown of modelBreakdowns) { - if (!modelBreakdownByDate.has(breakdown.date)) { - modelBreakdownByDate.set(breakdown.date, []); - } - modelBreakdownByDate.get(breakdown.date)!.push({ - id: breakdown.usedModel || "unknown", - provider: breakdown.usedProvider || "unknown", - requestCount: Number(breakdown.requestCount), - inputTokens: Number(breakdown.inputTokens), - outputTokens: Number(breakdown.outputTokens), - totalTokens: Number(breakdown.totalTokens), - cost: Number(breakdown.cost), - }); - } + // Note: We don't have per-apikey-model aggregation, so model breakdown is empty for apiKeyId filter + // This is a tradeoff to avoid exploding cardinality (apiKey * model * provider * hour) // Process daily aggregates and add calculated fields - const activityData = dailyAggregates.map((day) => { + const activityData = hourlyAggregates.map((day) => { const requestCount = Number(day.requestCount); const inputTokens = Number(day.inputTokens); const outputTokens = Number(day.outputTokens); @@ -292,7 +238,7 @@ activity.openapi(getActivity, async (c) => { cacheCount, cacheRate, discountSavings, - modelBreakdown: modelBreakdownByDate.get(day.date) || [], + modelBreakdown: [], // No per-apikey model breakdown to avoid cardinality explosion }; }); diff --git a/apps/worker/src/services/project-stats-aggregator.ts b/apps/worker/src/services/project-stats-aggregator.ts index c4c14e152f..f4a347ecbf 100644 --- a/apps/worker/src/services/project-stats-aggregator.ts +++ b/apps/worker/src/services/project-stats-aggregator.ts @@ -3,6 +3,7 @@ import { log, projectHourlyStats, projectHourlyModelStats, + apiKeyHourlyStats, sql, gte, lt, @@ -37,9 +38,118 @@ function getCurrentHourStart(): Date { return roundToHourStart(new Date()); } +/** + * Common aggregation select fields for all stats tables + */ +function getCommonAggregationFields() { + return { + requestCount: sql`count(*)::int`.as("requestCount"), + errorCount: + sql`sum(case when ${log.hasError} = true then 1 else 0 end)::int`.as( + "errorCount", + ), + cacheCount: + sql`sum(case when ${log.cached} = true then 1 else 0 end)::int`.as( + "cacheCount", + ), + streamedCount: + sql`sum(case when ${log.streamed} = true then 1 else 0 end)::int`.as( + "streamedCount", + ), + nonStreamedCount: + sql`sum(case when ${log.streamed} = false or ${log.streamed} is null then 1 else 0 end)::int`.as( + "nonStreamedCount", + ), + // Unified finish reason counts + completedCount: + sql`sum(case when ${log.unifiedFinishReason} = 'completed' then 1 else 0 end)::int`.as( + "completedCount", + ), + lengthLimitCount: + sql`sum(case when ${log.unifiedFinishReason} = 'length_limit' then 1 else 0 end)::int`.as( + "lengthLimitCount", + ), + contentFilterCount: + sql`sum(case when ${log.unifiedFinishReason} = 'content_filter' then 1 else 0 end)::int`.as( + "contentFilterCount", + ), + toolCallsCount: + sql`sum(case when ${log.unifiedFinishReason} = 'tool_calls' then 1 else 0 end)::int`.as( + "toolCallsCount", + ), + canceledCount: + sql`sum(case when ${log.unifiedFinishReason} = 'canceled' then 1 else 0 end)::int`.as( + "canceledCount", + ), + unknownFinishCount: + sql`sum(case when ${log.unifiedFinishReason} = 'unknown' or ${log.unifiedFinishReason} is null then 1 else 0 end)::int`.as( + "unknownFinishCount", + ), + // Error type counts + clientErrorCount: + sql`sum(case when ${log.unifiedFinishReason} = 'client_error' then 1 else 0 end)::int`.as( + "clientErrorCount", + ), + gatewayErrorCount: + sql`sum(case when ${log.unifiedFinishReason} = 'gateway_error' then 1 else 0 end)::int`.as( + "gatewayErrorCount", + ), + upstreamErrorCount: + sql`sum(case when ${log.unifiedFinishReason} = 'upstream_error' then 1 else 0 end)::int`.as( + "upstreamErrorCount", + ), + // Token counts + inputTokens: + sql`coalesce(sum(cast(${log.promptTokens} as numeric)), 0)`.as( + "inputTokens", + ), + outputTokens: + sql`coalesce(sum(cast(${log.completionTokens} as numeric)), 0)`.as( + "outputTokens", + ), + totalTokens: + sql`coalesce(sum(cast(${log.totalTokens} as numeric)), 0)`.as( + "totalTokens", + ), + reasoningTokens: + sql`coalesce(sum(cast(${log.reasoningTokens} as numeric)), 0)`.as( + "reasoningTokens", + ), + cachedTokens: + sql`coalesce(sum(cast(${log.cachedTokens} as numeric)), 0)`.as( + "cachedTokens", + ), + // Costs + cost: sql`coalesce(sum(${log.cost}), 0)`.as("cost"), + inputCost: sql`coalesce(sum(${log.inputCost}), 0)`.as("inputCost"), + outputCost: sql`coalesce(sum(${log.outputCost}), 0)`.as( + "outputCost", + ), + requestCost: sql`coalesce(sum(${log.requestCost}), 0)`.as( + "requestCost", + ), + dataStorageCost: + sql`coalesce(sum(cast(${log.dataStorageCost} as real)), 0)`.as( + "dataStorageCost", + ), + serviceFee: sql`coalesce(sum(${log.serviceFee}), 0)`.as( + "serviceFee", + ), + discountSavings: sql`coalesce( + sum( + case + when ${log.discount} > 0 and ${log.discount} < 1 + then ${log.cost} * ${log.discount} / (1 - ${log.discount}) + else 0 + end + ), + 0 + )`.as("discountSavings"), + }; +} + /** * Calculate and store hourly statistics for a specific project and hour - * This recalculates the entire hour from the raw log table */ async function recalculateProjectHourlyStats( projectId: string, @@ -48,66 +158,8 @@ async function recalculateProjectHourlyStats( const hourEnd = new Date(hourTimestamp.getTime() + 60 * 60 * 1000); const database = db; - // Aggregate all logs for this project and hour - const [projectStats] = await database - .select({ - requestCount: sql`count(*)::int`.as("requestCount"), - errorCount: - sql`sum(case when ${log.hasError} = true then 1 else 0 end)::int`.as( - "errorCount", - ), - cacheCount: - sql`sum(case when ${log.cached} = true then 1 else 0 end)::int`.as( - "cacheCount", - ), - inputTokens: - sql`coalesce(sum(cast(${log.promptTokens} as numeric)), 0)`.as( - "inputTokens", - ), - outputTokens: - sql`coalesce(sum(cast(${log.completionTokens} as numeric)), 0)`.as( - "outputTokens", - ), - totalTokens: - sql`coalesce(sum(cast(${log.totalTokens} as numeric)), 0)`.as( - "totalTokens", - ), - reasoningTokens: - sql`coalesce(sum(cast(${log.reasoningTokens} as numeric)), 0)`.as( - "reasoningTokens", - ), - cachedTokens: - sql`coalesce(sum(cast(${log.cachedTokens} as numeric)), 0)`.as( - "cachedTokens", - ), - cost: sql`coalesce(sum(${log.cost}), 0)`.as("cost"), - inputCost: sql`coalesce(sum(${log.inputCost}), 0)`.as( - "inputCost", - ), - outputCost: sql`coalesce(sum(${log.outputCost}), 0)`.as( - "outputCost", - ), - requestCost: sql`coalesce(sum(${log.requestCost}), 0)`.as( - "requestCost", - ), - dataStorageCost: - sql`coalesce(sum(cast(${log.dataStorageCost} as real)), 0)`.as( - "dataStorageCost", - ), - serviceFee: sql`coalesce(sum(${log.serviceFee}), 0)`.as( - "serviceFee", - ), - discountSavings: sql`coalesce( - sum( - case - when ${log.discount} > 0 and ${log.discount} < 1 - then ${log.cost} * ${log.discount} / (1 - ${log.discount}) - else 0 - end - ), - 0 - )`.as("discountSavings"), - }) + const [stats] = await database + .select(getCommonAggregationFields()) .from(log) .where( and( @@ -117,50 +169,21 @@ async function recalculateProjectHourlyStats( ), ); - if (!projectStats || projectStats.requestCount === 0) { + if (!stats || stats.requestCount === 0) { return; } - // Upsert project hourly stats await database .insert(projectHourlyStats) .values({ projectId, hourTimestamp, - requestCount: projectStats.requestCount, - errorCount: projectStats.errorCount, - cacheCount: projectStats.cacheCount, - inputTokens: projectStats.inputTokens, - outputTokens: projectStats.outputTokens, - totalTokens: projectStats.totalTokens, - reasoningTokens: projectStats.reasoningTokens, - cachedTokens: projectStats.cachedTokens, - cost: projectStats.cost, - inputCost: projectStats.inputCost, - outputCost: projectStats.outputCost, - requestCost: projectStats.requestCost, - dataStorageCost: projectStats.dataStorageCost, - serviceFee: projectStats.serviceFee, - discountSavings: projectStats.discountSavings, + ...stats, }) .onConflictDoUpdate({ target: [projectHourlyStats.projectId, projectHourlyStats.hourTimestamp], set: { - requestCount: projectStats.requestCount, - errorCount: projectStats.errorCount, - cacheCount: projectStats.cacheCount, - inputTokens: projectStats.inputTokens, - outputTokens: projectStats.outputTokens, - totalTokens: projectStats.totalTokens, - reasoningTokens: projectStats.reasoningTokens, - cachedTokens: projectStats.cachedTokens, - cost: projectStats.cost, - inputCost: projectStats.inputCost, - outputCost: projectStats.outputCost, - requestCost: projectStats.requestCost, - dataStorageCost: projectStats.dataStorageCost, - serviceFee: projectStats.serviceFee, - discountSavings: projectStats.discountSavings, + ...stats, updatedAt: new Date(), }, }); @@ -176,39 +199,11 @@ async function recalculateProjectHourlyModelStats( const hourEnd = new Date(hourTimestamp.getTime() + 60 * 60 * 1000); const database = db; - // Aggregate logs by model and provider for this project and hour const modelStats = await database .select({ usedModel: log.usedModel, usedProvider: log.usedProvider, - requestCount: sql`count(*)::int`.as("requestCount"), - errorCount: - sql`sum(case when ${log.hasError} = true then 1 else 0 end)::int`.as( - "errorCount", - ), - cacheCount: - sql`sum(case when ${log.cached} = true then 1 else 0 end)::int`.as( - "cacheCount", - ), - inputTokens: - sql`coalesce(sum(cast(${log.promptTokens} as numeric)), 0)`.as( - "inputTokens", - ), - outputTokens: - sql`coalesce(sum(cast(${log.completionTokens} as numeric)), 0)`.as( - "outputTokens", - ), - totalTokens: - sql`coalesce(sum(cast(${log.totalTokens} as numeric)), 0)`.as( - "totalTokens", - ), - cost: sql`coalesce(sum(${log.cost}), 0)`.as("cost"), - inputCost: sql`coalesce(sum(${log.inputCost}), 0)`.as( - "inputCost", - ), - outputCost: sql`coalesce(sum(${log.outputCost}), 0)`.as( - "outputCost", - ), + ...getCommonAggregationFields(), }) .from(log) .where( @@ -220,24 +215,16 @@ async function recalculateProjectHourlyModelStats( ) .groupBy(log.usedModel, log.usedProvider); - // Upsert each model's stats for (const stat of modelStats) { + const { usedModel, usedProvider, ...statsFields } = stat; await database .insert(projectHourlyModelStats) .values({ projectId, hourTimestamp, - usedModel: stat.usedModel, - usedProvider: stat.usedProvider, - requestCount: stat.requestCount, - errorCount: stat.errorCount, - cacheCount: stat.cacheCount, - inputTokens: stat.inputTokens, - outputTokens: stat.outputTokens, - totalTokens: stat.totalTokens, - cost: stat.cost, - inputCost: stat.inputCost, - outputCost: stat.outputCost, + usedModel, + usedProvider, + ...statsFields, }) .onConflictDoUpdate({ target: [ @@ -247,15 +234,52 @@ async function recalculateProjectHourlyModelStats( projectHourlyModelStats.usedProvider, ], set: { - requestCount: stat.requestCount, - errorCount: stat.errorCount, - cacheCount: stat.cacheCount, - inputTokens: stat.inputTokens, - outputTokens: stat.outputTokens, - totalTokens: stat.totalTokens, - cost: stat.cost, - inputCost: stat.inputCost, - outputCost: stat.outputCost, + ...statsFields, + updatedAt: new Date(), + }, + }); + } +} + +/** + * Calculate and store hourly API key statistics for a specific project and hour + */ +async function recalculateApiKeyHourlyStats( + projectId: string, + hourTimestamp: Date, +) { + const hourEnd = new Date(hourTimestamp.getTime() + 60 * 60 * 1000); + const database = db; + + const apiKeyStats = await database + .select({ + apiKeyId: log.apiKeyId, + ...getCommonAggregationFields(), + }) + .from(log) + .where( + and( + sql`${log.projectId} = ${projectId}`, + gte(log.createdAt, hourTimestamp), + lt(log.createdAt, hourEnd), + ), + ) + .groupBy(log.apiKeyId); + + for (const stat of apiKeyStats) { + const { apiKeyId, ...statsFields } = stat; + await database + .insert(apiKeyHourlyStats) + .values({ + apiKeyId, + projectId, + hourTimestamp, + ...statsFields, + }) + .onConflictDoUpdate({ + target: [apiKeyHourlyStats.apiKeyId, apiKeyHourlyStats.hourTimestamp], + set: { + ...statsFields, updatedAt: new Date(), }, }); @@ -264,8 +288,6 @@ async function recalculateProjectHourlyModelStats( /** * Process unprocessed logs and update aggregation tables - * This finds logs where statsAggregatedAt is NULL, determines which hour buckets - * need recalculation, recalculates them, and marks the logs as processed. */ export async function processUnprocessedLogs() { const database = db; @@ -276,7 +298,6 @@ export async function processUnprocessedLogs() { try { // Find distinct project-hour combinations that have unprocessed logs - // Only process hours that are complete (not the current hour) const unprocessedBuckets = await database .select({ projectId: log.projectId, @@ -286,13 +307,10 @@ export async function processUnprocessedLogs() { }) .from(log) .where( - and( - isNull(log.statsAggregatedAt), - lt(log.createdAt, currentHourStart), // Only process completed hours - ), + and(isNull(log.statsAggregatedAt), lt(log.createdAt, currentHourStart)), ) .groupBy(log.projectId, sql`date_trunc('hour', ${log.createdAt})`) - .limit(100); // Process up to 100 buckets per cycle to avoid long-running transactions + .limit(100); if (unprocessedBuckets.length === 0) { logger.debug("No unprocessed logs found for stats aggregation"); @@ -305,16 +323,16 @@ export async function processUnprocessedLogs() { let totalLogsMarked = 0; - // Process each bucket for (const bucket of unprocessedBuckets) { const hourTimestamp = new Date(bucket.hourTimestamp); const hourEnd = new Date(hourTimestamp.getTime() + 60 * 60 * 1000); - // Recalculate aggregations for this project-hour + // Recalculate all aggregation tables await recalculateProjectHourlyStats(bucket.projectId, hourTimestamp); await recalculateProjectHourlyModelStats(bucket.projectId, hourTimestamp); + await recalculateApiKeyHourlyStats(bucket.projectId, hourTimestamp); - // Mark logs in this bucket as processed + // Mark logs as processed const result = await database .update(log) .set({ statsAggregatedAt: now }) @@ -327,12 +345,11 @@ export async function processUnprocessedLogs() { ), ); - // Count affected rows (drizzle returns the updated rows) const affectedRows = Array.isArray(result) ? result.length : 0; totalLogsMarked += affectedRows; logger.debug( - `Processed bucket ${bucket.projectId}/${hourTimestamp.toISOString()}, marked logs as aggregated`, + `Processed bucket ${bucket.projectId}/${hourTimestamp.toISOString()}`, ); } @@ -355,8 +372,6 @@ export async function processUnprocessedLogs() { /** * Refresh the current hour's stats (for real-time dashboard data) - * This is separate from processUnprocessedLogs because the current hour - * is always incomplete and needs continuous updates. */ export async function refreshCurrentHourStats() { const database = db; @@ -367,7 +382,6 @@ export async function refreshCurrentHourStats() { ); try { - // Find all projects that have logs in the current hour const projectsWithCurrentHourLogs = await database .select({ projectId: log.projectId, @@ -379,6 +393,7 @@ export async function refreshCurrentHourStats() { for (const { projectId } of projectsWithCurrentHourLogs) { await recalculateProjectHourlyStats(projectId, currentHourStart); await recalculateProjectHourlyModelStats(projectId, currentHourStart); + await recalculateApiKeyHourlyStats(projectId, currentHourStart); } logger.debug( @@ -395,18 +410,13 @@ export async function refreshCurrentHourStats() { /** * Main refresh function called by the worker interval - * Processes both unprocessed historical logs and refreshes current hour */ export async function refreshProjectHourlyStats() { logger.debug("Starting project hourly stats refresh..."); try { - // Process any unprocessed logs from completed hours await processUnprocessedLogs(); - - // Refresh current hour for real-time data await refreshCurrentHourStats(); - logger.debug("Project hourly stats refresh complete"); } catch (error) { logger.error( diff --git a/packages/db/migrations/1770619420_far_smiling_tiger.sql b/packages/db/migrations/1770619420_far_smiling_tiger.sql deleted file mode 100644 index 14270cad93..0000000000 --- a/packages/db/migrations/1770619420_far_smiling_tiger.sql +++ /dev/null @@ -1,50 +0,0 @@ -CREATE TABLE "project_hourly_model_stats" ( - "id" text PRIMARY KEY, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL, - "project_id" text NOT NULL, - "hour_timestamp" timestamp NOT NULL, - "used_model" text NOT NULL, - "used_provider" text NOT NULL, - "request_count" integer DEFAULT 0 NOT NULL, - "error_count" integer DEFAULT 0 NOT NULL, - "cache_count" integer DEFAULT 0 NOT NULL, - "input_tokens" numeric DEFAULT '0' NOT NULL, - "output_tokens" numeric DEFAULT '0' NOT NULL, - "total_tokens" numeric DEFAULT '0' NOT NULL, - "cost" real DEFAULT 0 NOT NULL, - "input_cost" real DEFAULT 0 NOT NULL, - "output_cost" real DEFAULT 0 NOT NULL, - CONSTRAINT "project_hourly_model_stats_project_id_hour_timestamp_used_model_used_provider_unique" UNIQUE("project_id","hour_timestamp","used_model","used_provider") -); ---> statement-breakpoint -CREATE TABLE "project_hourly_stats" ( - "id" text PRIMARY KEY, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL, - "project_id" text NOT NULL, - "hour_timestamp" timestamp NOT NULL, - "request_count" integer DEFAULT 0 NOT NULL, - "error_count" integer DEFAULT 0 NOT NULL, - "cache_count" integer DEFAULT 0 NOT NULL, - "input_tokens" numeric DEFAULT '0' NOT NULL, - "output_tokens" numeric DEFAULT '0' NOT NULL, - "total_tokens" numeric DEFAULT '0' NOT NULL, - "reasoning_tokens" numeric DEFAULT '0' NOT NULL, - "cached_tokens" numeric DEFAULT '0' NOT NULL, - "cost" real DEFAULT 0 NOT NULL, - "input_cost" real DEFAULT 0 NOT NULL, - "output_cost" real DEFAULT 0 NOT NULL, - "request_cost" real DEFAULT 0 NOT NULL, - "data_storage_cost" real DEFAULT 0 NOT NULL, - "service_fee" real DEFAULT 0 NOT NULL, - "discount_savings" real DEFAULT 0 NOT NULL, - CONSTRAINT "project_hourly_stats_project_id_hour_timestamp_unique" UNIQUE("project_id","hour_timestamp") -); ---> statement-breakpoint -ALTER TABLE "log" ADD COLUMN "stats_aggregated_at" timestamp;--> statement-breakpoint -CREATE INDEX "log_stats_aggregated_at_null_idx" ON "log" ("project_id","created_at") WHERE stats_aggregated_at IS NULL;--> statement-breakpoint -CREATE INDEX "project_hourly_model_stats_project_id_hour_timestamp_idx" ON "project_hourly_model_stats" ("project_id","hour_timestamp");--> statement-breakpoint -CREATE INDEX "project_hourly_model_stats_hour_timestamp_idx" ON "project_hourly_model_stats" ("hour_timestamp");--> statement-breakpoint -CREATE INDEX "project_hourly_stats_project_id_hour_timestamp_idx" ON "project_hourly_stats" ("project_id","hour_timestamp");--> statement-breakpoint -CREATE INDEX "project_hourly_stats_hour_timestamp_idx" ON "project_hourly_stats" ("hour_timestamp"); \ No newline at end of file diff --git a/packages/db/migrations/1770620423_eager_big_bertha.sql b/packages/db/migrations/1770620423_eager_big_bertha.sql new file mode 100644 index 0000000000..ac09f40947 --- /dev/null +++ b/packages/db/migrations/1770620423_eager_big_bertha.sql @@ -0,0 +1,117 @@ +CREATE TABLE "api_key_hourly_stats" ( + "id" text PRIMARY KEY, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + "api_key_id" text NOT NULL, + "project_id" text NOT NULL, + "hour_timestamp" timestamp NOT NULL, + "request_count" integer DEFAULT 0 NOT NULL, + "error_count" integer DEFAULT 0 NOT NULL, + "cache_count" integer DEFAULT 0 NOT NULL, + "streamed_count" integer DEFAULT 0 NOT NULL, + "non_streamed_count" integer DEFAULT 0 NOT NULL, + "completed_count" integer DEFAULT 0 NOT NULL, + "length_limit_count" integer DEFAULT 0 NOT NULL, + "content_filter_count" integer DEFAULT 0 NOT NULL, + "tool_calls_count" integer DEFAULT 0 NOT NULL, + "canceled_count" integer DEFAULT 0 NOT NULL, + "unknown_finish_count" integer DEFAULT 0 NOT NULL, + "client_error_count" integer DEFAULT 0 NOT NULL, + "gateway_error_count" integer DEFAULT 0 NOT NULL, + "upstream_error_count" integer DEFAULT 0 NOT NULL, + "input_tokens" numeric DEFAULT '0' NOT NULL, + "output_tokens" numeric DEFAULT '0' NOT NULL, + "total_tokens" numeric DEFAULT '0' NOT NULL, + "reasoning_tokens" numeric DEFAULT '0' NOT NULL, + "cached_tokens" numeric DEFAULT '0' NOT NULL, + "cost" real DEFAULT 0 NOT NULL, + "input_cost" real DEFAULT 0 NOT NULL, + "output_cost" real DEFAULT 0 NOT NULL, + "request_cost" real DEFAULT 0 NOT NULL, + "data_storage_cost" real DEFAULT 0 NOT NULL, + "service_fee" real DEFAULT 0 NOT NULL, + "discount_savings" real DEFAULT 0 NOT NULL, + CONSTRAINT "api_key_hourly_stats_api_key_id_hour_timestamp_unique" UNIQUE("api_key_id","hour_timestamp") +); +--> statement-breakpoint +CREATE TABLE "project_hourly_model_stats" ( + "id" text PRIMARY KEY, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + "project_id" text NOT NULL, + "hour_timestamp" timestamp NOT NULL, + "used_model" text NOT NULL, + "used_provider" text NOT NULL, + "request_count" integer DEFAULT 0 NOT NULL, + "error_count" integer DEFAULT 0 NOT NULL, + "cache_count" integer DEFAULT 0 NOT NULL, + "streamed_count" integer DEFAULT 0 NOT NULL, + "non_streamed_count" integer DEFAULT 0 NOT NULL, + "completed_count" integer DEFAULT 0 NOT NULL, + "length_limit_count" integer DEFAULT 0 NOT NULL, + "content_filter_count" integer DEFAULT 0 NOT NULL, + "tool_calls_count" integer DEFAULT 0 NOT NULL, + "canceled_count" integer DEFAULT 0 NOT NULL, + "unknown_finish_count" integer DEFAULT 0 NOT NULL, + "client_error_count" integer DEFAULT 0 NOT NULL, + "gateway_error_count" integer DEFAULT 0 NOT NULL, + "upstream_error_count" integer DEFAULT 0 NOT NULL, + "input_tokens" numeric DEFAULT '0' NOT NULL, + "output_tokens" numeric DEFAULT '0' NOT NULL, + "total_tokens" numeric DEFAULT '0' NOT NULL, + "reasoning_tokens" numeric DEFAULT '0' NOT NULL, + "cached_tokens" numeric DEFAULT '0' NOT NULL, + "cost" real DEFAULT 0 NOT NULL, + "input_cost" real DEFAULT 0 NOT NULL, + "output_cost" real DEFAULT 0 NOT NULL, + "request_cost" real DEFAULT 0 NOT NULL, + "data_storage_cost" real DEFAULT 0 NOT NULL, + "service_fee" real DEFAULT 0 NOT NULL, + "discount_savings" real DEFAULT 0 NOT NULL, + CONSTRAINT "project_hourly_model_stats_project_id_hour_timestamp_used_model_used_provider_unique" UNIQUE("project_id","hour_timestamp","used_model","used_provider") +); +--> statement-breakpoint +CREATE TABLE "project_hourly_stats" ( + "id" text PRIMARY KEY, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + "project_id" text NOT NULL, + "hour_timestamp" timestamp NOT NULL, + "request_count" integer DEFAULT 0 NOT NULL, + "error_count" integer DEFAULT 0 NOT NULL, + "cache_count" integer DEFAULT 0 NOT NULL, + "streamed_count" integer DEFAULT 0 NOT NULL, + "non_streamed_count" integer DEFAULT 0 NOT NULL, + "completed_count" integer DEFAULT 0 NOT NULL, + "length_limit_count" integer DEFAULT 0 NOT NULL, + "content_filter_count" integer DEFAULT 0 NOT NULL, + "tool_calls_count" integer DEFAULT 0 NOT NULL, + "canceled_count" integer DEFAULT 0 NOT NULL, + "unknown_finish_count" integer DEFAULT 0 NOT NULL, + "client_error_count" integer DEFAULT 0 NOT NULL, + "gateway_error_count" integer DEFAULT 0 NOT NULL, + "upstream_error_count" integer DEFAULT 0 NOT NULL, + "input_tokens" numeric DEFAULT '0' NOT NULL, + "output_tokens" numeric DEFAULT '0' NOT NULL, + "total_tokens" numeric DEFAULT '0' NOT NULL, + "reasoning_tokens" numeric DEFAULT '0' NOT NULL, + "cached_tokens" numeric DEFAULT '0' NOT NULL, + "cost" real DEFAULT 0 NOT NULL, + "input_cost" real DEFAULT 0 NOT NULL, + "output_cost" real DEFAULT 0 NOT NULL, + "request_cost" real DEFAULT 0 NOT NULL, + "data_storage_cost" real DEFAULT 0 NOT NULL, + "service_fee" real DEFAULT 0 NOT NULL, + "discount_savings" real DEFAULT 0 NOT NULL, + CONSTRAINT "project_hourly_stats_project_id_hour_timestamp_unique" UNIQUE("project_id","hour_timestamp") +); +--> statement-breakpoint +ALTER TABLE "log" ADD COLUMN "stats_aggregated_at" timestamp;--> statement-breakpoint +CREATE INDEX "api_key_hourly_stats_api_key_id_hour_timestamp_idx" ON "api_key_hourly_stats" ("api_key_id","hour_timestamp");--> statement-breakpoint +CREATE INDEX "api_key_hourly_stats_project_id_hour_timestamp_idx" ON "api_key_hourly_stats" ("project_id","hour_timestamp");--> statement-breakpoint +CREATE INDEX "api_key_hourly_stats_hour_timestamp_idx" ON "api_key_hourly_stats" ("hour_timestamp");--> statement-breakpoint +CREATE INDEX "log_stats_aggregated_at_null_idx" ON "log" ("project_id","created_at") WHERE stats_aggregated_at IS NULL;--> statement-breakpoint +CREATE INDEX "project_hourly_model_stats_project_id_hour_timestamp_idx" ON "project_hourly_model_stats" ("project_id","hour_timestamp");--> statement-breakpoint +CREATE INDEX "project_hourly_model_stats_hour_timestamp_idx" ON "project_hourly_model_stats" ("hour_timestamp");--> statement-breakpoint +CREATE INDEX "project_hourly_stats_project_id_hour_timestamp_idx" ON "project_hourly_stats" ("project_id","hour_timestamp");--> statement-breakpoint +CREATE INDEX "project_hourly_stats_hour_timestamp_idx" ON "project_hourly_stats" ("hour_timestamp"); \ No newline at end of file diff --git a/packages/db/migrations/meta/1770619420_snapshot.json b/packages/db/migrations/meta/1770620423_snapshot.json similarity index 88% rename from packages/db/migrations/meta/1770619420_snapshot.json rename to packages/db/migrations/meta/1770620423_snapshot.json index 019ffaad16..5f48466130 100644 --- a/packages/db/migrations/meta/1770619420_snapshot.json +++ b/packages/db/migrations/meta/1770620423_snapshot.json @@ -1,7 +1,7 @@ { "version": "8", "dialect": "postgres", - "id": "83306c1b-2fae-4157-b54d-1d362b7e77ba", + "id": "b164a584-d4d6-4605-a745-ad96d8c22067", "prevId": "afccd9a7-b9e3-405e-ae16-89d16e6b336d", "ddl": [ { @@ -16,6 +16,12 @@ "entityType": "tables", "schema": "public" }, + { + "isRlsEnabled": false, + "name": "api_key_hourly_stats", + "entityType": "tables", + "schema": "public" + }, { "isRlsEnabled": false, "name": "api_key_iam_rule", @@ -518,7 +524,7 @@ "name": "id", "entityType": "columns", "schema": "public", - "table": "api_key_iam_rule" + "table": "api_key_hourly_stats" }, { "type": "timestamp", @@ -534,7 +540,7 @@ "name": "created_at", "entityType": "columns", "schema": "public", - "table": "api_key_iam_rule" + "table": "api_key_hourly_stats" }, { "type": "timestamp", @@ -550,7 +556,7 @@ "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "api_key_iam_rule" + "table": "api_key_hourly_stats" }, { "type": "text", @@ -563,7 +569,7 @@ "name": "api_key_id", "entityType": "columns", "schema": "public", - "table": "api_key_iam_rule" + "table": "api_key_hourly_stats" }, { "type": "text", @@ -573,400 +579,439 @@ "default": null, "generated": null, "identity": null, - "name": "rule_type", + "name": "project_id", "entityType": "columns", "schema": "public", - "table": "api_key_iam_rule" + "table": "api_key_hourly_stats" }, { - "type": "json", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "rule_value", + "name": "hour_timestamp", "entityType": "columns", "schema": "public", - "table": "api_key_iam_rule" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'active'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "status", + "name": "request_count", "entityType": "columns", "schema": "public", - "table": "api_key_iam_rule" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "id", + "name": "error_count", "entityType": "columns", "schema": "public", - "table": "audit_log" + "table": "api_key_hourly_stats" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "created_at", + "name": "cache_count", "entityType": "columns", "schema": "public", - "table": "audit_log" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "organization_id", + "name": "streamed_count", "entityType": "columns", "schema": "public", - "table": "audit_log" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "user_id", + "name": "non_streamed_count", "entityType": "columns", "schema": "public", - "table": "audit_log" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "action", + "name": "completed_count", "entityType": "columns", "schema": "public", - "table": "audit_log" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "resource_type", + "name": "length_limit_count", "entityType": "columns", "schema": "public", - "table": "audit_log" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "resource_id", + "name": "content_filter_count", "entityType": "columns", "schema": "public", - "table": "audit_log" + "table": "api_key_hourly_stats" }, { - "type": "jsonb", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "metadata", + "name": "tool_calls_count", "entityType": "columns", "schema": "public", - "table": "audit_log" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "id", + "name": "canceled_count", "entityType": "columns", "schema": "public", - "table": "chat" + "table": "api_key_hourly_stats" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "created_at", + "name": "unknown_finish_count", "entityType": "columns", "schema": "public", - "table": "chat" + "table": "api_key_hourly_stats" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "updated_at", + "name": "client_error_count", "entityType": "columns", "schema": "public", - "table": "chat" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "title", + "name": "gateway_error_count", "entityType": "columns", "schema": "public", - "table": "chat" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "user_id", + "name": "upstream_error_count", "entityType": "columns", "schema": "public", - "table": "chat" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "numeric", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "'0'", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "model", + "name": "input_tokens", "entityType": "columns", "schema": "public", - "table": "chat" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "numeric", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": { - "value": "'active'", + "value": "'0'", "type": "unknown" }, "generated": null, "identity": null, - "name": "status", + "name": "output_tokens", "entityType": "columns", "schema": "public", - "table": "chat" + "table": "api_key_hourly_stats" }, { - "type": "boolean", + "type": "numeric", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": { - "value": "false", + "value": "'0'", "type": "unknown" }, "generated": null, "identity": null, - "name": "web_search", + "name": "total_tokens", "entityType": "columns", "schema": "public", - "table": "chat" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "numeric", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "'0'", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "id", + "name": "reasoning_tokens", "entityType": "columns", "schema": "public", - "table": "guardrail_config" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "numeric", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "'0'", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "organization_id", + "name": "cached_tokens", "entityType": "columns", "schema": "public", - "table": "guardrail_config" + "table": "api_key_hourly_stats" }, { - "type": "boolean", + "type": "real", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "true", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "enabled", + "name": "cost", "entityType": "columns", "schema": "public", - "table": "guardrail_config" + "table": "api_key_hourly_stats" }, { - "type": "jsonb", + "type": "real", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": { - "type": "unknown", - "value": "'{\"prompt_injection\":{\"enabled\":true,\"action\":\"block\"},\"jailbreak\":{\"enabled\":true,\"action\":\"block\"},\"pii_detection\":{\"enabled\":true,\"action\":\"redact\"},\"secrets\":{\"enabled\":true,\"action\":\"block\"},\"file_types\":{\"enabled\":true,\"action\":\"block\"},\"document_leakage\":{\"enabled\":false,\"action\":\"warn\"}}'" + "value": "0", + "type": "unknown" }, "generated": null, "identity": null, - "name": "system_rules", + "name": "input_cost", "entityType": "columns", "schema": "public", - "table": "guardrail_config" + "table": "api_key_hourly_stats" }, { - "type": "integer", + "type": "real", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "10", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "max_file_size_mb", + "name": "output_cost", "entityType": "columns", "schema": "public", - "table": "guardrail_config" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "real", "typeSchema": null, "notNull": true, - "dimensions": 1, + "dimensions": 0, "default": { - "value": "'{image/jpeg,image/png,image/gif,image/webp}'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "allowed_file_types", + "name": "request_cost", "entityType": "columns", "schema": "public", - "table": "guardrail_config" + "table": "api_key_hourly_stats" }, { - "type": "text", + "type": "real", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": { - "value": "'redact'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "pii_action", + "name": "data_storage_cost", "entityType": "columns", "schema": "public", - "table": "guardrail_config" + "table": "api_key_hourly_stats" }, { - "type": "timestamp", + "type": "real", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "created_at", + "name": "service_fee", "entityType": "columns", "schema": "public", - "table": "guardrail_config" + "table": "api_key_hourly_stats" }, { - "type": "timestamp", + "type": "real", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "updated_at", + "name": "discount_savings", "entityType": "columns", "schema": "public", - "table": "guardrail_config" + "table": "api_key_hourly_stats" }, { "type": "text", @@ -979,33 +1024,39 @@ "name": "id", "entityType": "columns", "schema": "public", - "table": "guardrail_rule" + "table": "api_key_iam_rule" }, { - "type": "text", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "organization_id", + "name": "created_at", "entityType": "columns", "schema": "public", - "table": "guardrail_rule" + "table": "api_key_iam_rule" }, { - "type": "text", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "name", + "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "guardrail_rule" + "table": "api_key_iam_rule" }, { "type": "text", @@ -1015,71 +1066,65 @@ "default": null, "generated": null, "identity": null, - "name": "type", + "name": "api_key_id", "entityType": "columns", "schema": "public", - "table": "guardrail_rule" + "table": "api_key_iam_rule" }, { - "type": "jsonb", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "config", + "name": "rule_type", "entityType": "columns", "schema": "public", - "table": "guardrail_rule" + "table": "api_key_iam_rule" }, { - "type": "integer", + "type": "json", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": { - "value": "100", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "priority", + "name": "rule_value", "entityType": "columns", "schema": "public", - "table": "guardrail_rule" + "table": "api_key_iam_rule" }, { - "type": "boolean", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "true", + "value": "'active'", "type": "unknown" }, "generated": null, "identity": null, - "name": "enabled", + "name": "status", "entityType": "columns", "schema": "public", - "table": "guardrail_rule" + "table": "api_key_iam_rule" }, { "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": { - "value": "'block'", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "action", + "name": "id", "entityType": "columns", "schema": "public", - "table": "guardrail_rule" + "table": "audit_log" }, { "type": "timestamp", @@ -1095,23 +1140,20 @@ "name": "created_at", "entityType": "columns", "schema": "public", - "table": "guardrail_rule" + "table": "audit_log" }, { - "type": "timestamp", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "updated_at", + "name": "organization_id", "entityType": "columns", "schema": "public", - "table": "guardrail_rule" + "table": "audit_log" }, { "type": "text", @@ -1121,10 +1163,10 @@ "default": null, "generated": null, "identity": null, - "name": "id", + "name": "user_id", "entityType": "columns", "schema": "public", - "table": "guardrail_violation" + "table": "audit_log" }, { "type": "text", @@ -1134,49 +1176,49 @@ "default": null, "generated": null, "identity": null, - "name": "organization_id", + "name": "action", "entityType": "columns", "schema": "public", - "table": "guardrail_violation" + "table": "audit_log" }, { "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "log_id", + "name": "resource_type", "entityType": "columns", "schema": "public", - "table": "guardrail_violation" + "table": "audit_log" }, { "type": "text", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "rule_id", + "name": "resource_id", "entityType": "columns", "schema": "public", - "table": "guardrail_violation" + "table": "audit_log" }, { - "type": "text", + "type": "jsonb", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "rule_name", + "name": "metadata", "entityType": "columns", "schema": "public", - "table": "guardrail_violation" + "table": "audit_log" }, { "type": "text", @@ -1186,104 +1228,113 @@ "default": null, "generated": null, "identity": null, - "name": "category", + "name": "id", "entityType": "columns", "schema": "public", - "table": "guardrail_violation" + "table": "chat" }, { - "type": "text", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "action_taken", + "name": "created_at", "entityType": "columns", "schema": "public", - "table": "guardrail_violation" + "table": "chat" }, { - "type": "text", + "type": "timestamp", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "matched_pattern", + "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "guardrail_violation" + "table": "chat" }, { "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "matched_content", + "name": "title", "entityType": "columns", "schema": "public", - "table": "guardrail_violation" + "table": "chat" }, { "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "content_hash", + "name": "user_id", "entityType": "columns", "schema": "public", - "table": "guardrail_violation" + "table": "chat" }, { "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "api_key_id", + "name": "model", "entityType": "columns", "schema": "public", - "table": "guardrail_violation" + "table": "chat" }, { "type": "text", "typeSchema": null, "notNull": false, "dimensions": 0, - "default": null, + "default": { + "value": "'active'", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "model", + "name": "status", "entityType": "columns", "schema": "public", - "table": "guardrail_violation" + "table": "chat" }, { - "type": "timestamp", + "type": "boolean", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": { - "value": "now()", + "value": "false", "type": "unknown" }, "generated": null, "identity": null, - "name": "created_at", + "name": "web_search", "entityType": "columns", "schema": "public", - "table": "guardrail_violation" + "table": "chat" }, { "type": "text", @@ -1296,78 +1347,100 @@ "name": "id", "entityType": "columns", "schema": "public", - "table": "installation" + "table": "guardrail_config" }, { - "type": "timestamp", + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "boolean", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "true", "type": "unknown" }, "generated": null, "identity": null, - "name": "created_at", + "name": "enabled", "entityType": "columns", "schema": "public", - "table": "installation" + "table": "guardrail_config" }, { - "type": "timestamp", + "type": "jsonb", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": { - "value": "now()", - "type": "unknown" + "type": "unknown", + "value": "'{\"prompt_injection\":{\"enabled\":true,\"action\":\"block\"},\"jailbreak\":{\"enabled\":true,\"action\":\"block\"},\"pii_detection\":{\"enabled\":true,\"action\":\"redact\"},\"secrets\":{\"enabled\":true,\"action\":\"block\"},\"file_types\":{\"enabled\":true,\"action\":\"block\"},\"document_leakage\":{\"enabled\":false,\"action\":\"warn\"}}'" }, "generated": null, "identity": null, - "name": "updated_at", + "name": "system_rules", "entityType": "columns", "schema": "public", - "table": "installation" + "table": "guardrail_config" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "10", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "uuid", + "name": "max_file_size_mb", "entityType": "columns", "schema": "public", - "table": "installation" + "table": "guardrail_config" }, { "type": "text", "typeSchema": null, "notNull": true, - "dimensions": 0, - "default": null, + "dimensions": 1, + "default": { + "value": "'{image/jpeg,image/png,image/gif,image/webp}'", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "type", + "name": "allowed_file_types", "entityType": "columns", "schema": "public", - "table": "installation" + "table": "guardrail_config" }, { "type": "text", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": null, + "default": { + "value": "'redact'", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "id", + "name": "pii_action", "entityType": "columns", "schema": "public", - "table": "lock" + "table": "guardrail_config" }, { "type": "timestamp", @@ -1383,7 +1456,7 @@ "name": "created_at", "entityType": "columns", "schema": "public", - "table": "lock" + "table": "guardrail_config" }, { "type": "timestamp", @@ -1399,7 +1472,7 @@ "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "lock" + "table": "guardrail_config" }, { "type": "text", @@ -1409,10 +1482,10 @@ "default": null, "generated": null, "identity": null, - "name": "key", + "name": "id", "entityType": "columns", "schema": "public", - "table": "lock" + "table": "guardrail_rule" }, { "type": "text", @@ -1422,10 +1495,10 @@ "default": null, "generated": null, "identity": null, - "name": "id", + "name": "organization_id", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_rule" }, { "type": "text", @@ -1435,120 +1508,129 @@ "default": null, "generated": null, "identity": null, - "name": "request_id", + "name": "name", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_rule" }, { - "type": "timestamp", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "created_at", + "name": "type", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_rule" }, { - "type": "timestamp", + "type": "jsonb", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "updated_at", + "name": "config", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_rule" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "100", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "organization_id", + "name": "priority", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_rule" }, { - "type": "text", + "type": "boolean", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "true", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "project_id", + "name": "enabled", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_rule" }, { "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "'block'", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "api_key_id", + "name": "action", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_rule" }, { - "type": "integer", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "duration", + "name": "created_at", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_rule" }, { - "type": "integer", + "type": "timestamp", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "time_to_first_token", + "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_rule" }, { - "type": "integer", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "time_to_first_reasoning_token", + "name": "id", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_violation" }, { "type": "text", @@ -1558,10 +1640,10 @@ "default": null, "generated": null, "identity": null, - "name": "requested_model", + "name": "organization_id", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_violation" }, { "type": "text", @@ -1571,10 +1653,10 @@ "default": null, "generated": null, "identity": null, - "name": "requested_provider", + "name": "log_id", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_violation" }, { "type": "text", @@ -1584,23 +1666,23 @@ "default": null, "generated": null, "identity": null, - "name": "used_model", + "name": "rule_id", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_violation" }, { "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "used_model_mapping", + "name": "rule_name", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_violation" }, { "type": "text", @@ -1610,23 +1692,23 @@ "default": null, "generated": null, "identity": null, - "name": "used_provider", + "name": "category", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_violation" }, { - "type": "integer", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "response_size", + "name": "action_taken", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_violation" }, { "type": "text", @@ -1636,10 +1718,10 @@ "default": null, "generated": null, "identity": null, - "name": "content", + "name": "matched_pattern", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_violation" }, { "type": "text", @@ -1649,228 +1731,249 @@ "default": null, "generated": null, "identity": null, - "name": "reasoning_content", + "name": "matched_content", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_violation" }, { - "type": "json", + "type": "text", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "tools", + "name": "content_hash", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_violation" }, { - "type": "json", + "type": "text", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "tool_choice", + "name": "api_key_id", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_violation" }, { - "type": "json", + "type": "text", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "tool_results", + "name": "model", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_violation" }, { - "type": "text", + "type": "timestamp", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "finish_reason", + "name": "created_at", "entityType": "columns", "schema": "public", - "table": "log" + "table": "guardrail_violation" }, { "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "unified_finish_reason", + "name": "id", "entityType": "columns", "schema": "public", - "table": "log" + "table": "installation" }, { - "type": "numeric", + "type": "timestamp", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "prompt_tokens", + "name": "created_at", "entityType": "columns", "schema": "public", - "table": "log" + "table": "installation" }, { - "type": "numeric", + "type": "timestamp", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "completion_tokens", + "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "log" + "table": "installation" }, { - "type": "numeric", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "total_tokens", + "name": "uuid", "entityType": "columns", "schema": "public", - "table": "log" + "table": "installation" }, { - "type": "numeric", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "reasoning_tokens", + "name": "type", "entityType": "columns", "schema": "public", - "table": "log" + "table": "installation" }, { - "type": "numeric", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "cached_tokens", + "name": "id", "entityType": "columns", "schema": "public", - "table": "log" + "table": "lock" }, { - "type": "json", + "type": "timestamp", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "messages", + "name": "created_at", "entityType": "columns", "schema": "public", - "table": "log" + "table": "lock" }, { - "type": "real", + "type": "timestamp", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "temperature", + "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "log" + "table": "lock" }, { - "type": "integer", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "max_tokens", + "name": "key", "entityType": "columns", "schema": "public", - "table": "log" + "table": "lock" }, { - "type": "real", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "top_p", + "name": "id", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "real", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "frequency_penalty", + "name": "request_id", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "real", + "type": "timestamp", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "presence_penalty", + "name": "created_at", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "text", + "type": "timestamp", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reasoning_effort", + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", "entityType": "columns", "schema": "public", "table": "log" @@ -1878,174 +1981,168 @@ { "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "effort", + "name": "organization_id", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "json", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "response_format", + "name": "project_id", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "boolean", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "has_error", + "name": "api_key_id", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "json", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "error_details", + "name": "duration", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "real", + "type": "integer", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "cost", + "name": "time_to_first_token", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "real", + "type": "integer", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "input_cost", + "name": "time_to_first_reasoning_token", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "real", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "output_cost", + "name": "requested_model", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "real", + "type": "text", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "cached_input_cost", + "name": "requested_provider", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "real", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "request_cost", + "name": "used_model", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "real", + "type": "text", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "web_search_cost", + "name": "used_model_mapping", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "boolean", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "estimated_cost", + "name": "used_provider", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "real", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "discount", + "name": "response_size", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "real", + "type": "text", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "service_fee", + "name": "content", "entityType": "columns", "schema": "public", "table": "log" @@ -2058,55 +2155,46 @@ "default": null, "generated": null, "identity": null, - "name": "pricing_tier", + "name": "reasoning_content", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "boolean", + "type": "json", "typeSchema": null, "notNull": false, "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "canceled", + "name": "tools", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "boolean", + "type": "json", "typeSchema": null, "notNull": false, "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "streamed", + "name": "tool_choice", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "boolean", + "type": "json", "typeSchema": null, "notNull": false, "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "cached", + "name": "tool_results", "entityType": "columns", "schema": "public", "table": "log" @@ -2114,12 +2202,12 @@ { "type": "text", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "mode", + "name": "finish_reason", "entityType": "columns", "schema": "public", "table": "log" @@ -2127,213 +2215,210 @@ { "type": "text", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "used_mode", + "name": "unified_finish_reason", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "text", + "type": "numeric", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "source", + "name": "prompt_tokens", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "json", + "type": "numeric", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "custom_headers", + "name": "completion_tokens", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "json", + "type": "numeric", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "routing_metadata", + "name": "total_tokens", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "timestamp", + "type": "numeric", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "processed_at", + "name": "reasoning_tokens", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "timestamp", + "type": "numeric", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "stats_aggregated_at", + "name": "cached_tokens", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "jsonb", + "type": "json", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "raw_request", + "name": "messages", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "jsonb", + "type": "real", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "raw_response", + "name": "temperature", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "jsonb", + "type": "integer", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "upstream_request", + "name": "max_tokens", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "jsonb", + "type": "real", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "upstream_response", + "name": "top_p", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "text", + "type": "real", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "trace_id", + "name": "frequency_penalty", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "boolean", + "type": "real", "typeSchema": null, "notNull": false, "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "data_retention_cleaned_up", + "name": "presence_penalty", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "numeric", + "type": "text", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "data_storage_cost", + "name": "reasoning_effort", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "json", + "type": "text", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "params", + "name": "effort", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "text", + "type": "json", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "user_agent", + "name": "response_format", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "json", + "type": "boolean", "typeSchema": null, "notNull": false, "dimensions": 0, - "default": null, + "default": { + "value": "false", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "plugins", + "name": "has_error", "entityType": "columns", "schema": "public", "table": "log" @@ -2346,332 +2431,1167 @@ "default": null, "generated": null, "identity": null, - "name": "plugin_results", + "name": "error_details", "entityType": "columns", "schema": "public", "table": "log" }, { - "type": "text", + "type": "real", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "id", + "name": "cost", "entityType": "columns", "schema": "public", - "table": "message" + "table": "log" }, { - "type": "timestamp", + "type": "real", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "created_at", + "name": "input_cost", "entityType": "columns", "schema": "public", - "table": "message" + "table": "log" }, { - "type": "timestamp", + "type": "real", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "updated_at", + "name": "output_cost", "entityType": "columns", "schema": "public", - "table": "message" + "table": "log" }, { - "type": "text", + "type": "real", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "chat_id", + "name": "cached_input_cost", "entityType": "columns", "schema": "public", - "table": "message" + "table": "log" }, { - "type": "text", + "type": "real", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "role", + "name": "request_cost", "entityType": "columns", "schema": "public", - "table": "message" + "table": "log" }, { - "type": "text", + "type": "real", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "content", + "name": "web_search_cost", "entityType": "columns", "schema": "public", - "table": "message" + "table": "log" }, { - "type": "text", + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "estimated_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "discount", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "pricing_tier", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "mode", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_mode", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "source", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "custom_headers", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "routing_metadata", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "processed_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_aggregated_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "raw_request", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "raw_response", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "upstream_request", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "upstream_response", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trace_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_retention_cleaned_up", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "params", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_agent", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plugins", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plugin_results", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "chat_id", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "images", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "sequence", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "released_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'(empty)'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'[]'" + }, + "generated": null, + "identity": null, + "name": "aliases", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'(empty)'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "family", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "free", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'[\"text\"]'" + }, + "generated": null, + "identity": null, + "name": "output", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'stable'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "stability", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", "typeSchema": null, "notNull": false, "dimensions": 0, - "default": null, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "images", + "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "message" + "table": "model_history" }, { "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "reasoning", + "name": "model_id", "entityType": "columns", "schema": "public", - "table": "message" + "table": "model_history" }, { - "type": "text", + "type": "timestamp", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "tools", + "name": "minute_timestamp", "entityType": "columns", "schema": "public", - "table": "message" + "table": "model_history" }, { "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "sequence", + "name": "logs_count", "entityType": "columns", "schema": "public", - "table": "message" + "table": "model_history" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "id", + "name": "errors_count", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_history" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "created_at", + "name": "client_errors_count", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_history" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "updated_at", + "name": "gateway_errors_count", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_history" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "released_at", + "name": "upstream_errors_count", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_history" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'(empty)'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "name", + "name": "cached_count", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_history" }, { - "type": "json", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "type": "unknown", - "value": "'[]'" + "value": "0", + "type": "unknown" }, "generated": null, "identity": null, - "name": "aliases", + "name": "total_input_tokens", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_history" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'(empty)'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "description", + "name": "total_output_tokens", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_history" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "family", + "name": "total_tokens", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_history" }, { - "type": "boolean", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "false", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "free", + "name": "total_reasoning_tokens", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_history" }, { - "type": "json", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "type": "unknown", - "value": "'[\"text\"]'" + "value": "0", + "type": "unknown" }, "generated": null, "identity": null, - "name": "output", + "name": "total_cached_tokens", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_history" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'stable'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "stability", + "name": "total_duration", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_history" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'active'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "status", + "name": "total_time_to_first_token", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_history" }, { "type": "integer", @@ -2684,828 +3604,822 @@ }, "generated": null, "identity": null, - "name": "logs_count", + "name": "total_time_to_first_reasoning_token", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_history" }, { - "type": "integer", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "errors_count", + "name": "id", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "now()", "type": "unknown" }, "generated": null, "identity": null, - "name": "client_errors_count", + "name": "created_at", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "now()", "type": "unknown" }, "generated": null, "identity": null, - "name": "gateway_errors_count", + "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "upstream_errors_count", + "name": "model_id", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "cached_count", + "name": "provider_id", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_provider_mapping" }, { - "type": "real", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "avg_time_to_first_token", + "name": "model_name", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_provider_mapping" }, { - "type": "real", + "type": "numeric", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "avg_time_to_first_reasoning_token", + "name": "input_price", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_provider_mapping" }, { - "type": "timestamp", + "type": "numeric", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "stats_updated_at", + "name": "output_price", "entityType": "columns", "schema": "public", - "table": "model" + "table": "model_provider_mapping" }, { - "type": "text", + "type": "numeric", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "id", + "name": "cached_input_price", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "timestamp", + "type": "numeric", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "created_at", + "name": "image_input_price", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "timestamp", + "type": "numeric", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "updated_at", + "name": "request_price", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "text", + "type": "integer", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "model_id", + "name": "context_size", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "minute_timestamp", + "name": "max_output", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "boolean", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "false", "type": "unknown" }, "generated": null, "identity": null, - "name": "logs_count", + "name": "streaming", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "boolean", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "errors_count", + "name": "vision", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "boolean", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "client_errors_count", + "name": "reasoning", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "text", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "gateway_errors_count", + "name": "reasoning_output", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "boolean", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "upstream_errors_count", + "name": "tools", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "boolean", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "false", "type": "unknown" }, "generated": null, "identity": null, - "name": "cached_count", + "name": "json_output", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "boolean", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "false", "type": "unknown" }, "generated": null, "identity": null, - "name": "total_input_tokens", + "name": "json_output_schema", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "boolean", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "false", "type": "unknown" }, "generated": null, "identity": null, - "name": "total_output_tokens", + "name": "web_search", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "numeric", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "total_tokens", + "name": "web_search_price", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "numeric", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "'0'", "type": "unknown" }, "generated": null, "identity": null, - "name": "total_reasoning_tokens", + "name": "discount", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "'stable'", "type": "unknown" }, "generated": null, "identity": null, - "name": "total_cached_tokens", + "name": "stability", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "json", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "total_duration", + "name": "supported_parameters", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "text", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "total_time_to_first_token", + "name": "test", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "integer", + "type": "timestamp", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "total_time_to_first_reasoning_token", + "name": "deprecated_at", "entityType": "columns", "schema": "public", - "table": "model_history" + "table": "model_provider_mapping" }, { - "type": "text", + "type": "timestamp", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "id", + "name": "deactivated_at", "entityType": "columns", "schema": "public", "table": "model_provider_mapping" }, { - "type": "timestamp", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "'active'", "type": "unknown" }, "generated": null, "identity": null, - "name": "created_at", + "name": "status", "entityType": "columns", "schema": "public", "table": "model_provider_mapping" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "updated_at", + "name": "logs_count", "entityType": "columns", "schema": "public", "table": "model_provider_mapping" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "model_id", + "name": "errors_count", "entityType": "columns", "schema": "public", "table": "model_provider_mapping" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "provider_id", + "name": "client_errors_count", "entityType": "columns", "schema": "public", "table": "model_provider_mapping" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "model_name", + "name": "gateway_errors_count", "entityType": "columns", "schema": "public", "table": "model_provider_mapping" }, { - "type": "numeric", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "input_price", + "name": "upstream_errors_count", "entityType": "columns", "schema": "public", "table": "model_provider_mapping" }, { - "type": "numeric", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "output_price", + "name": "cached_count", "entityType": "columns", "schema": "public", "table": "model_provider_mapping" }, { - "type": "numeric", + "type": "real", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "cached_input_price", + "name": "avg_time_to_first_token", "entityType": "columns", "schema": "public", "table": "model_provider_mapping" }, { - "type": "numeric", + "type": "real", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "image_input_price", + "name": "avg_time_to_first_reasoning_token", "entityType": "columns", "schema": "public", "table": "model_provider_mapping" }, { - "type": "numeric", + "type": "timestamp", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "request_price", + "name": "stats_updated_at", "entityType": "columns", "schema": "public", "table": "model_provider_mapping" }, { - "type": "integer", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "context_size", + "name": "id", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "integer", + "type": "timestamp", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "max_output", + "name": "created_at", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "boolean", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "false", + "value": "now()", "type": "unknown" }, "generated": null, "identity": null, - "name": "streaming", + "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "boolean", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "vision", + "name": "model_id", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "boolean", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "reasoning", + "name": "provider_id", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "reasoning_output", + "name": "model_provider_mapping_id", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "boolean", + "type": "timestamp", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "tools", + "name": "minute_timestamp", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "boolean", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "false", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "json_output", + "name": "logs_count", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "boolean", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "false", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "json_output_schema", + "name": "errors_count", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "boolean", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "false", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "web_search", + "name": "client_errors_count", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "numeric", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "web_search_price", + "name": "gateway_errors_count", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "numeric", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'0'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "discount", + "name": "upstream_errors_count", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'stable'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "stability", + "name": "cached_count", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "json", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "supported_parameters", + "name": "total_input_tokens", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "text", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "test", + "name": "total_output_tokens", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "deprecated_at", + "name": "total_tokens", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "deactivated_at", + "name": "total_reasoning_tokens", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'active'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "status", + "name": "total_cached_tokens", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { "type": "integer", @@ -3518,10 +4432,10 @@ }, "generated": null, "identity": null, - "name": "logs_count", + "name": "total_duration", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { "type": "integer", @@ -3534,10 +4448,10 @@ }, "generated": null, "identity": null, - "name": "errors_count", + "name": "total_time_to_first_token", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { "type": "integer", @@ -3550,306 +4464,358 @@ }, "generated": null, "identity": null, - "name": "client_errors_count", + "name": "total_time_to_first_reasoning_token", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "model_provider_mapping_history" }, { - "type": "integer", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "gateway_errors_count", + "name": "id", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "organization" }, { - "type": "integer", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "now()", "type": "unknown" }, "generated": null, "identity": null, - "name": "upstream_errors_count", + "name": "created_at", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "organization" }, { - "type": "integer", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "now()", "type": "unknown" }, "generated": null, "identity": null, - "name": "cached_count", + "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "organization" }, { - "type": "real", + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_email", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "avg_time_to_first_token", + "name": "billing_company", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "organization" }, { - "type": "real", + "type": "text", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "avg_time_to_first_reasoning_token", + "name": "billing_address", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "organization" }, { - "type": "timestamp", + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_tax_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_notes", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "stats_updated_at", + "name": "stripe_customer_id", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping" + "table": "organization" }, { "type": "text", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "id", + "name": "stripe_subscription_id", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "timestamp", + "type": "numeric", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "'0'", "type": "unknown" }, "generated": null, "identity": null, - "name": "created_at", + "name": "credits", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "timestamp", + "type": "boolean", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "false", "type": "unknown" }, "generated": null, "identity": null, - "name": "updated_at", + "name": "auto_top_up_enabled", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "text", + "type": "numeric", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": null, + "default": { + "value": "'10'", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "model_id", + "name": "auto_top_up_threshold", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "text", + "type": "numeric", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": null, + "default": { + "value": "'10'", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "provider_id", + "name": "auto_top_up_amount", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "'free'", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "model_provider_mapping_id", + "name": "plan", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { "type": "timestamp", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "minute_timestamp", + "name": "plan_expires_at", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "integer", + "type": "boolean", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "false", "type": "unknown" }, "generated": null, "identity": null, - "name": "logs_count", + "name": "subscription_cancelled", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "integer", + "type": "timestamp", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "errors_count", + "name": "trial_start_date", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "integer", + "type": "timestamp", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "client_errors_count", + "name": "trial_end_date", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "integer", + "type": "boolean", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "false", "type": "unknown" }, "generated": null, "identity": null, - "name": "gateway_errors_count", + "name": "is_trial_active", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "integer", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "'none'", "type": "unknown" }, "generated": null, "identity": null, - "name": "upstream_errors_count", + "name": "retention_level", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "integer", + "type": "text", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": { - "value": "0", + "value": "'active'", "type": "unknown" }, "generated": null, "identity": null, - "name": "cached_count", + "name": "status", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "integer", + "type": "numeric", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "'0'", "type": "unknown" }, "generated": null, "identity": null, - "name": "total_input_tokens", + "name": "referral_earnings", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { "type": "integer", @@ -3862,132 +4828,126 @@ }, "generated": null, "identity": null, - "name": "total_output_tokens", + "name": "payment_failure_count", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "integer", + "type": "timestamp", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "total_tokens", + "name": "last_payment_failure_at", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "integer", + "type": "boolean", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "false", "type": "unknown" }, "generated": null, "identity": null, - "name": "total_reasoning_tokens", + "name": "is_personal", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "integer", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "'none'", "type": "unknown" }, "generated": null, "identity": null, - "name": "total_cached_tokens", + "name": "dev_plan", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "integer", + "type": "numeric", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "'0'", "type": "unknown" }, "generated": null, "identity": null, - "name": "total_duration", + "name": "dev_plan_credits_used", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "integer", + "type": "numeric", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "0", + "value": "'0'", "type": "unknown" }, "generated": null, "identity": null, - "name": "total_time_to_first_token", + "name": "dev_plan_credits_limit", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { - "type": "integer", + "type": "timestamp", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "total_time_to_first_reasoning_token", + "name": "dev_plan_billing_cycle_start", "entityType": "columns", "schema": "public", - "table": "model_provider_mapping_history" + "table": "organization" }, { "type": "text", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "id", + "name": "dev_plan_stripe_subscription_id", "entityType": "columns", "schema": "public", "table": "organization" }, { - "type": "timestamp", + "type": "boolean", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "false", "type": "unknown" }, "generated": null, "identity": null, - "name": "created_at", + "name": "dev_plan_cancelled", "entityType": "columns", "schema": "public", "table": "organization" @@ -3995,15 +4955,28 @@ { "type": "timestamp", "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_expires_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "false", "type": "unknown" }, "generated": null, "identity": null, - "name": "updated_at", + "name": "dev_plan_allow_all_models", "entityType": "columns", "schema": "public", "table": "organization" @@ -4016,75 +4989,81 @@ "default": null, "generated": null, "identity": null, - "name": "name", + "name": "id", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "organization_action" }, { - "type": "text", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "billing_email", + "name": "created_at", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "organization_action" }, { - "type": "text", + "type": "timestamp", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "now()", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "billing_company", + "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "organization_action" }, { "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "billing_address", + "name": "organization_id", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "organization_action" }, { "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "billing_tax_id", + "name": "type", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "organization_action" }, { - "type": "text", + "type": "numeric", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "billing_notes", + "name": "amount", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "organization_action" }, { "type": "text", @@ -4094,251 +5073,243 @@ "default": null, "generated": null, "identity": null, - "name": "stripe_customer_id", + "name": "description", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "organization_action" }, { "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "stripe_subscription_id", + "name": "id", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "passkey" }, { - "type": "numeric", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'0'", + "value": "now()", "type": "unknown" }, "generated": null, "identity": null, - "name": "credits", + "name": "created_at", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "passkey" }, { - "type": "boolean", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "false", + "value": "now()", "type": "unknown" }, "generated": null, "identity": null, - "name": "auto_top_up_enabled", + "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "passkey" }, { - "type": "numeric", + "type": "text", "typeSchema": null, "notNull": false, "dimensions": 0, - "default": { - "value": "'10'", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "auto_top_up_threshold", + "name": "name", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "passkey" }, { - "type": "numeric", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": { - "value": "'10'", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "auto_top_up_amount", + "name": "public_key", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "passkey" }, { "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": { - "value": "'free'", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "plan", + "name": "user_id", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "passkey" }, { - "type": "timestamp", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "plan_expires_at", + "name": "credential_id", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "passkey" }, { - "type": "boolean", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "subscription_cancelled", + "name": "counter", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "passkey" }, { - "type": "timestamp", + "type": "text", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "trial_start_date", + "name": "device_type", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "passkey" }, { - "type": "timestamp", + "type": "boolean", "typeSchema": null, "notNull": false, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "trial_end_date", + "name": "backed_up", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "passkey" }, { - "type": "boolean", + "type": "text", "typeSchema": null, - "notNull": true, + "notNull": false, "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "is_trial_active", + "name": "transports", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "passkey" }, { "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": { - "value": "'none'", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "retention_level", + "name": "id", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "payment_method" }, { - "type": "text", + "type": "timestamp", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": { - "value": "'active'", + "value": "now()", "type": "unknown" }, "generated": null, "identity": null, - "name": "status", + "name": "created_at", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "payment_method" }, { - "type": "numeric", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'0'", + "value": "now()", "type": "unknown" }, "generated": null, "identity": null, - "name": "referral_earnings", + "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "payment_method" }, { - "type": "integer", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "payment_failure_count", + "name": "stripe_payment_method_id", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "payment_method" }, { - "type": "timestamp", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "last_payment_failure_at", + "name": "organization_id", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "payment_method" }, { "type": "boolean", @@ -4351,84 +5322,81 @@ }, "generated": null, "identity": null, - "name": "is_personal", + "name": "is_default", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "payment_method" }, { "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": { - "value": "'none'", - "type": "unknown" - }, + "default": null, "generated": null, "identity": null, - "name": "dev_plan", + "name": "id", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "project" }, { - "type": "numeric", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'0'", + "value": "now()", "type": "unknown" }, "generated": null, "identity": null, - "name": "dev_plan_credits_used", + "name": "created_at", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "project" }, { - "type": "numeric", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'0'", + "value": "now()", "type": "unknown" }, "generated": null, "identity": null, - "name": "dev_plan_credits_limit", + "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "project" }, { - "type": "timestamp", + "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "dev_plan_billing_cycle_start", + "name": "name", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "project" }, { "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "dev_plan_stripe_subscription_id", + "name": "organization_id", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "project" }, { "type": "boolean", @@ -4441,39 +5409,58 @@ }, "generated": null, "identity": null, - "name": "dev_plan_cancelled", + "name": "caching_enabled", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "project" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "60", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "dev_plan_expires_at", + "name": "cache_duration_seconds", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "project" }, { - "type": "boolean", + "type": "text", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "false", + "value": "'hybrid'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "mode", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", "type": "unknown" }, "generated": null, "identity": null, - "name": "dev_plan_allow_all_models", + "name": "status", "entityType": "columns", "schema": "public", - "table": "organization" + "table": "project" }, { "type": "text", @@ -4486,7 +5473,7 @@ "name": "id", "entityType": "columns", "schema": "public", - "table": "organization_action" + "table": "project_hourly_model_stats" }, { "type": "timestamp", @@ -4502,7 +5489,7 @@ "name": "created_at", "entityType": "columns", "schema": "public", - "table": "organization_action" + "table": "project_hourly_model_stats" }, { "type": "timestamp", @@ -4518,20 +5505,7 @@ "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "organization_action" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "organization_action" + "table": "project_hourly_model_stats" }, { "type": "text", @@ -4541,36 +5515,36 @@ "default": null, "generated": null, "identity": null, - "name": "type", + "name": "project_id", "entityType": "columns", "schema": "public", - "table": "organization_action" + "table": "project_hourly_model_stats" }, { - "type": "numeric", + "type": "timestamp", "typeSchema": null, "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "amount", + "name": "hour_timestamp", "entityType": "columns", "schema": "public", - "table": "organization_action" + "table": "project_hourly_model_stats" }, { "type": "text", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": null, "generated": null, "identity": null, - "name": "description", + "name": "used_model", "entityType": "columns", "schema": "public", - "table": "organization_action" + "table": "project_hourly_model_stats" }, { "type": "text", @@ -4580,381 +5554,426 @@ "default": null, "generated": null, "identity": null, - "name": "id", + "name": "used_provider", "entityType": "columns", "schema": "public", - "table": "passkey" + "table": "project_hourly_model_stats" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "created_at", + "name": "request_count", "entityType": "columns", "schema": "public", - "table": "passkey" + "table": "project_hourly_model_stats" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "updated_at", + "name": "error_count", "entityType": "columns", "schema": "public", - "table": "passkey" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "name", + "name": "cache_count", "entityType": "columns", "schema": "public", - "table": "passkey" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "public_key", + "name": "streamed_count", "entityType": "columns", "schema": "public", - "table": "passkey" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "user_id", + "name": "non_streamed_count", "entityType": "columns", "schema": "public", - "table": "passkey" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "credential_id", + "name": "completed_count", "entityType": "columns", "schema": "public", - "table": "passkey" + "table": "project_hourly_model_stats" }, { "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "counter", + "name": "length_limit_count", "entityType": "columns", "schema": "public", - "table": "passkey" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "device_type", + "name": "content_filter_count", "entityType": "columns", "schema": "public", - "table": "passkey" + "table": "project_hourly_model_stats" }, { - "type": "boolean", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "backed_up", + "name": "tool_calls_count", "entityType": "columns", "schema": "public", - "table": "passkey" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "transports", + "name": "canceled_count", "entityType": "columns", "schema": "public", - "table": "passkey" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "id", + "name": "unknown_finish_count", "entityType": "columns", "schema": "public", - "table": "payment_method" + "table": "project_hourly_model_stats" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "created_at", + "name": "client_error_count", "entityType": "columns", "schema": "public", - "table": "payment_method" + "table": "project_hourly_model_stats" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "updated_at", + "name": "gateway_error_count", "entityType": "columns", "schema": "public", - "table": "payment_method" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "stripe_payment_method_id", + "name": "upstream_error_count", "entityType": "columns", "schema": "public", - "table": "payment_method" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "numeric", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "'0'", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "organization_id", + "name": "input_tokens", "entityType": "columns", "schema": "public", - "table": "payment_method" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "numeric", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "'0'", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "type", + "name": "output_tokens", "entityType": "columns", "schema": "public", - "table": "payment_method" + "table": "project_hourly_model_stats" }, { - "type": "boolean", + "type": "numeric", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "false", + "value": "'0'", "type": "unknown" }, "generated": null, "identity": null, - "name": "is_default", + "name": "total_tokens", "entityType": "columns", "schema": "public", - "table": "payment_method" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "numeric", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "'0'", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "id", + "name": "reasoning_tokens", "entityType": "columns", "schema": "public", - "table": "project" + "table": "project_hourly_model_stats" }, { - "type": "timestamp", + "type": "numeric", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "'0'", "type": "unknown" }, "generated": null, "identity": null, - "name": "created_at", + "name": "cached_tokens", "entityType": "columns", "schema": "public", - "table": "project" + "table": "project_hourly_model_stats" }, { - "type": "timestamp", + "type": "real", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "updated_at", + "name": "cost", "entityType": "columns", "schema": "public", - "table": "project" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "real", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "name", + "name": "input_cost", "entityType": "columns", "schema": "public", - "table": "project" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "real", "typeSchema": null, "notNull": true, "dimensions": 0, - "default": null, + "default": { + "value": "0", + "type": "unknown" + }, "generated": null, "identity": null, - "name": "organization_id", + "name": "output_cost", "entityType": "columns", "schema": "public", - "table": "project" + "table": "project_hourly_model_stats" }, { - "type": "boolean", + "type": "real", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "false", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "caching_enabled", + "name": "request_cost", "entityType": "columns", "schema": "public", - "table": "project" + "table": "project_hourly_model_stats" }, { - "type": "integer", + "type": "real", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "60", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "cache_duration_seconds", + "name": "data_storage_cost", "entityType": "columns", "schema": "public", - "table": "project" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "real", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'hybrid'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "mode", + "name": "service_fee", "entityType": "columns", "schema": "public", - "table": "project" + "table": "project_hourly_model_stats" }, { - "type": "text", + "type": "real", "typeSchema": null, - "notNull": false, + "notNull": true, "dimensions": 0, "default": { - "value": "'active'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "status", + "name": "discount_savings", "entityType": "columns", "schema": "public", - "table": "project" + "table": "project_hourly_model_stats" }, { "type": "text", @@ -4967,7 +5986,7 @@ "name": "id", "entityType": "columns", "schema": "public", - "table": "project_hourly_model_stats" + "table": "project_hourly_stats" }, { "type": "timestamp", @@ -4983,7 +6002,7 @@ "name": "created_at", "entityType": "columns", "schema": "public", - "table": "project_hourly_model_stats" + "table": "project_hourly_stats" }, { "type": "timestamp", @@ -4999,7 +6018,7 @@ "name": "updated_at", "entityType": "columns", "schema": "public", - "table": "project_hourly_model_stats" + "table": "project_hourly_stats" }, { "type": "text", @@ -5012,7 +6031,7 @@ "name": "project_id", "entityType": "columns", "schema": "public", - "table": "project_hourly_model_stats" + "table": "project_hourly_stats" }, { "type": "timestamp", @@ -5025,33 +6044,7 @@ "name": "hour_timestamp", "entityType": "columns", "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_model", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_provider", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" + "table": "project_hourly_stats" }, { "type": "integer", @@ -5067,7 +6060,7 @@ "name": "request_count", "entityType": "columns", "schema": "public", - "table": "project_hourly_model_stats" + "table": "project_hourly_stats" }, { "type": "integer", @@ -5083,7 +6076,7 @@ "name": "error_count", "entityType": "columns", "schema": "public", - "table": "project_hourly_model_stats" + "table": "project_hourly_stats" }, { "type": "integer", @@ -5099,58 +6092,58 @@ "name": "cache_count", "entityType": "columns", "schema": "public", - "table": "project_hourly_model_stats" + "table": "project_hourly_stats" }, { - "type": "numeric", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'0'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "input_tokens", + "name": "streamed_count", "entityType": "columns", "schema": "public", - "table": "project_hourly_model_stats" + "table": "project_hourly_stats" }, { - "type": "numeric", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'0'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "output_tokens", + "name": "non_streamed_count", "entityType": "columns", "schema": "public", - "table": "project_hourly_model_stats" + "table": "project_hourly_stats" }, { - "type": "numeric", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "'0'", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "total_tokens", + "name": "completed_count", "entityType": "columns", "schema": "public", - "table": "project_hourly_model_stats" + "table": "project_hourly_stats" }, { - "type": "real", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, @@ -5160,13 +6153,13 @@ }, "generated": null, "identity": null, - "name": "cost", + "name": "length_limit_count", "entityType": "columns", "schema": "public", - "table": "project_hourly_model_stats" + "table": "project_hourly_stats" }, { - "type": "real", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, @@ -5176,13 +6169,13 @@ }, "generated": null, "identity": null, - "name": "input_cost", + "name": "content_filter_count", "entityType": "columns", "schema": "public", - "table": "project_hourly_model_stats" + "table": "project_hourly_stats" }, { - "type": "real", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, @@ -5192,78 +6185,39 @@ }, "generated": null, "identity": null, - "name": "output_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", + "name": "tool_calls_count", "entityType": "columns", "schema": "public", "table": "project_hourly_stats" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "created_at", + "name": "canceled_count", "entityType": "columns", "schema": "public", "table": "project_hourly_stats" }, { - "type": "timestamp", + "type": "integer", "typeSchema": null, "notNull": true, "dimensions": 0, "default": { - "value": "now()", + "value": "0", "type": "unknown" }, "generated": null, "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "project_id", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "hour_timestamp", + "name": "unknown_finish_count", "entityType": "columns", "schema": "public", "table": "project_hourly_stats" @@ -5279,7 +6233,7 @@ }, "generated": null, "identity": null, - "name": "request_count", + "name": "client_error_count", "entityType": "columns", "schema": "public", "table": "project_hourly_stats" @@ -5295,7 +6249,7 @@ }, "generated": null, "identity": null, - "name": "error_count", + "name": "gateway_error_count", "entityType": "columns", "schema": "public", "table": "project_hourly_stats" @@ -5311,7 +6265,7 @@ }, "generated": null, "identity": null, - "name": "cache_count", + "name": "upstream_error_count", "entityType": "columns", "schema": "public", "table": "project_hourly_stats" @@ -6659,6 +7613,83 @@ "schema": "public", "table": "api_key" }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_api_key_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, { "nameExplicit": true, "columns": [ @@ -8067,6 +9098,16 @@ "table": "api_key", "entityType": "pks" }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_hourly_stats_pkey", + "schema": "public", + "table": "api_key_hourly_stats", + "entityType": "pks" + }, { "columns": [ "id" @@ -8357,6 +9398,18 @@ "table": "verification", "entityType": "pks" }, + { + "nameExplicit": false, + "columns": [ + "api_key_id", + "hour_timestamp" + ], + "nullsNotDistinct": false, + "name": "api_key_hourly_stats_api_key_id_hour_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "api_key_hourly_stats" + }, { "nameExplicit": false, "columns": [ diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index 8e347c762c..f03c56ea11 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -624,6 +624,13 @@ "when": 1770619420657, "tag": "1770619420_far_smiling_tiger", "breakpoints": true + }, + { + "idx": 89, + "version": "8", + "when": 1770620423341, + "tag": "1770620423_eager_big_bertha", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts index 12ec32e004..888043df35 100644 --- a/packages/db/src/schema.ts +++ b/packages/db/src/schema.ts @@ -1151,6 +1151,19 @@ export const projectHourlyStats = pgTable( requestCount: integer().notNull().default(0), errorCount: integer().notNull().default(0), cacheCount: integer().notNull().default(0), + streamedCount: integer().notNull().default(0), + nonStreamedCount: integer().notNull().default(0), + // Unified finish reason counts + completedCount: integer().notNull().default(0), + lengthLimitCount: integer().notNull().default(0), + contentFilterCount: integer().notNull().default(0), + toolCallsCount: integer().notNull().default(0), + canceledCount: integer().notNull().default(0), + unknownFinishCount: integer().notNull().default(0), + // Error type counts (subset of errorCount) + clientErrorCount: integer().notNull().default(0), + gatewayErrorCount: integer().notNull().default(0), + upstreamErrorCount: integer().notNull().default(0), // Token counts inputTokens: decimal().notNull().default("0"), outputTokens: decimal().notNull().default("0"), @@ -1197,14 +1210,33 @@ export const projectHourlyModelStats = pgTable( requestCount: integer().notNull().default(0), errorCount: integer().notNull().default(0), cacheCount: integer().notNull().default(0), + streamedCount: integer().notNull().default(0), + nonStreamedCount: integer().notNull().default(0), + // Unified finish reason counts + completedCount: integer().notNull().default(0), + lengthLimitCount: integer().notNull().default(0), + contentFilterCount: integer().notNull().default(0), + toolCallsCount: integer().notNull().default(0), + canceledCount: integer().notNull().default(0), + unknownFinishCount: integer().notNull().default(0), + // Error type counts (subset of errorCount) + clientErrorCount: integer().notNull().default(0), + gatewayErrorCount: integer().notNull().default(0), + upstreamErrorCount: integer().notNull().default(0), // Token counts inputTokens: decimal().notNull().default("0"), outputTokens: decimal().notNull().default("0"), totalTokens: decimal().notNull().default("0"), + reasoningTokens: decimal().notNull().default("0"), + cachedTokens: decimal().notNull().default("0"), // Costs cost: real().notNull().default(0), inputCost: real().notNull().default(0), outputCost: real().notNull().default(0), + requestCost: real().notNull().default(0), + dataStorageCost: real().notNull().default(0), + serviceFee: real().notNull().default(0), + discountSavings: real().notNull().default(0), }, (table) => [ // Unique constraint for one record per project-hour-model-provider @@ -1225,3 +1257,66 @@ export const projectHourlyModelStats = pgTable( ), ], ); + +// API key hourly statistics aggregation - for per-key breakdown queries +export const apiKeyHourlyStats = pgTable( + "api_key_hourly_stats", + { + id: text().primaryKey().notNull().$defaultFn(shortid), + createdAt: timestamp().notNull().defaultNow(), + updatedAt: timestamp() + .notNull() + .defaultNow() + .$onUpdate(() => new Date()), + apiKeyId: text().notNull(), + projectId: text().notNull(), // Denormalized for efficient queries + hourTimestamp: timestamp().notNull(), // Start of the hour bucket + // Request counts + requestCount: integer().notNull().default(0), + errorCount: integer().notNull().default(0), + cacheCount: integer().notNull().default(0), + streamedCount: integer().notNull().default(0), + nonStreamedCount: integer().notNull().default(0), + // Unified finish reason counts + completedCount: integer().notNull().default(0), + lengthLimitCount: integer().notNull().default(0), + contentFilterCount: integer().notNull().default(0), + toolCallsCount: integer().notNull().default(0), + canceledCount: integer().notNull().default(0), + unknownFinishCount: integer().notNull().default(0), + // Error type counts (subset of errorCount) + clientErrorCount: integer().notNull().default(0), + gatewayErrorCount: integer().notNull().default(0), + upstreamErrorCount: integer().notNull().default(0), + // Token counts + inputTokens: decimal().notNull().default("0"), + outputTokens: decimal().notNull().default("0"), + totalTokens: decimal().notNull().default("0"), + reasoningTokens: decimal().notNull().default("0"), + cachedTokens: decimal().notNull().default("0"), + // Costs + cost: real().notNull().default(0), + inputCost: real().notNull().default(0), + outputCost: real().notNull().default(0), + requestCost: real().notNull().default(0), + dataStorageCost: real().notNull().default(0), + serviceFee: real().notNull().default(0), + discountSavings: real().notNull().default(0), + }, + (table) => [ + // Unique constraint for one record per api-key-hour + unique().on(table.apiKeyId, table.hourTimestamp), + // Index for dashboard queries (api key + time range) + index("api_key_hourly_stats_api_key_id_hour_timestamp_idx").on( + table.apiKeyId, + table.hourTimestamp, + ), + // Index for project-level queries (all keys in a project) + index("api_key_hourly_stats_project_id_hour_timestamp_idx").on( + table.projectId, + table.hourTimestamp, + ), + // Index for worker refresh queries + index("api_key_hourly_stats_hour_timestamp_idx").on(table.hourTimestamp), + ], +); From 13290da89419c1ed49b3e347532220cd69b793ba Mon Sep 17 00:00:00 2001 From: steebchen Date: Mon, 9 Feb 2026 07:26:38 +0000 Subject: [PATCH 04/24] fix(api): update activity tests to use aggregation tables The activity endpoint now reads from aggregation tables instead of raw log table. Updated tests to: - Add aggregateLogsForTesting() helper that mimics worker aggregation - Clean up aggregation tables in deleteAll() - Call aggregateLogsForTesting() after inserting log data in each test Co-Authored-By: Claude Opus 4.5 --- apps/api/src/routes/activity.spec.ts | 31 ++- apps/api/src/testing.ts | 273 ++++++++++++++++++++++++++- 2 files changed, 302 insertions(+), 2 deletions(-) diff --git a/apps/api/src/routes/activity.spec.ts b/apps/api/src/routes/activity.spec.ts index b1a78a1854..ee53ec93fe 100644 --- a/apps/api/src/routes/activity.spec.ts +++ b/apps/api/src/routes/activity.spec.ts @@ -1,7 +1,11 @@ import { afterEach, beforeEach, describe, expect, test } from "vitest"; import { app } from "@/index.js"; -import { createTestUser, deleteAll } from "@/testing.js"; +import { + createTestUser, + deleteAll, + aggregateLogsForTesting, +} from "@/testing.js"; import { db, tables } from "@llmgateway/db"; @@ -173,6 +177,9 @@ describe("activity endpoint", () => { usedMode: "api-keys", }, ]); + + // Aggregate logs into the hourly stats tables for the activity endpoint + await aggregateLogsForTesting(); }); afterEach(async () => { @@ -335,6 +342,8 @@ describe("activity endpoint", () => { }, ]); + await aggregateLogsForTesting(); + const res = await app.request("/activity?days=7", { headers: { Cookie: token, @@ -513,6 +522,8 @@ describe("activity endpoint", () => { }, ]); + await aggregateLogsForTesting(); + const res = await app.request("/activity?days=7", { headers: { Cookie: token, @@ -628,6 +639,8 @@ describe("activity endpoint", () => { }, ]); + await aggregateLogsForTesting(); + const res = await app.request("/activity?days=7", { headers: { Cookie: token, @@ -727,6 +740,8 @@ describe("activity endpoint", () => { }, ]); + await aggregateLogsForTesting(); + const res = await app.request("/activity?days=7", { headers: { Cookie: token, @@ -830,6 +845,8 @@ describe("activity endpoint", () => { }, ]); + await aggregateLogsForTesting(); + const res = await app.request("/activity?days=7", { headers: { Cookie: token, @@ -944,6 +961,8 @@ describe("activity endpoint", () => { }, ]); + await aggregateLogsForTesting(); + const res = await app.request("/activity?days=7", { headers: { Cookie: token, @@ -1037,6 +1056,8 @@ describe("activity endpoint", () => { }, ]); + await aggregateLogsForTesting(); + const res = await app.request("/activity?days=7", { headers: { Cookie: token, @@ -1129,6 +1150,8 @@ describe("activity endpoint", () => { }, ]); + await aggregateLogsForTesting(); + const res = await app.request("/activity?days=7", { headers: { Cookie: token, @@ -1202,6 +1225,8 @@ describe("activity endpoint", () => { }, ]); + await aggregateLogsForTesting(); + const res = await app.request("/activity?days=7", { headers: { Cookie: token, @@ -1275,6 +1300,8 @@ describe("activity endpoint", () => { }, ]); + await aggregateLogsForTesting(); + const res = await app.request("/activity?days=7", { headers: { Cookie: token, @@ -1453,6 +1480,8 @@ describe("activity endpoint", () => { }, ]); + await aggregateLogsForTesting(); + const res = await app.request("/activity?days=7", { headers: { Cookie: token, diff --git a/apps/api/src/testing.ts b/apps/api/src/testing.ts index a7b2080d8a..98a75273f2 100644 --- a/apps/api/src/testing.ts +++ b/apps/api/src/testing.ts @@ -1,4 +1,14 @@ -import { db, tables } from "@llmgateway/db"; +import { + db, + tables, + sql, + gte, + lt, + and, + projectHourlyStats, + projectHourlyModelStats, + apiKeyHourlyStats, +} from "@llmgateway/db"; import { app } from "./index.js"; @@ -16,6 +26,9 @@ export async function deleteAll() { db.delete(tables.log), db.delete(tables.apiKey), db.delete(tables.providerKey), + db.delete(projectHourlyStats), + db.delete(projectHourlyModelStats), + db.delete(apiKeyHourlyStats), ]); await Promise.all([ @@ -32,6 +45,264 @@ export async function deleteAll() { ]); } +/** + * Helper function to round a date to the start of its hour + */ +function roundToHourStart(date: Date): Date { + return new Date( + date.getFullYear(), + date.getMonth(), + date.getDate(), + date.getHours(), + 0, + 0, + 0, + ); +} + +/** + * Common aggregation fields for stats tables + */ +function getCommonAggregationFields() { + return { + requestCount: sql`count(*)::int`.as("requestCount"), + errorCount: + sql`sum(case when ${tables.log.hasError} = true then 1 else 0 end)::int`.as( + "errorCount", + ), + cacheCount: + sql`sum(case when ${tables.log.cached} = true then 1 else 0 end)::int`.as( + "cacheCount", + ), + streamedCount: + sql`sum(case when ${tables.log.streamed} = true then 1 else 0 end)::int`.as( + "streamedCount", + ), + nonStreamedCount: + sql`sum(case when ${tables.log.streamed} = false or ${tables.log.streamed} is null then 1 else 0 end)::int`.as( + "nonStreamedCount", + ), + completedCount: + sql`sum(case when ${tables.log.unifiedFinishReason} = 'completed' then 1 else 0 end)::int`.as( + "completedCount", + ), + lengthLimitCount: + sql`sum(case when ${tables.log.unifiedFinishReason} = 'length_limit' then 1 else 0 end)::int`.as( + "lengthLimitCount", + ), + contentFilterCount: + sql`sum(case when ${tables.log.unifiedFinishReason} = 'content_filter' then 1 else 0 end)::int`.as( + "contentFilterCount", + ), + toolCallsCount: + sql`sum(case when ${tables.log.unifiedFinishReason} = 'tool_calls' then 1 else 0 end)::int`.as( + "toolCallsCount", + ), + canceledCount: + sql`sum(case when ${tables.log.unifiedFinishReason} = 'canceled' then 1 else 0 end)::int`.as( + "canceledCount", + ), + unknownFinishCount: + sql`sum(case when ${tables.log.unifiedFinishReason} = 'unknown' or ${tables.log.unifiedFinishReason} is null then 1 else 0 end)::int`.as( + "unknownFinishCount", + ), + clientErrorCount: + sql`sum(case when ${tables.log.unifiedFinishReason} = 'client_error' then 1 else 0 end)::int`.as( + "clientErrorCount", + ), + gatewayErrorCount: + sql`sum(case when ${tables.log.unifiedFinishReason} = 'gateway_error' then 1 else 0 end)::int`.as( + "gatewayErrorCount", + ), + upstreamErrorCount: + sql`sum(case when ${tables.log.unifiedFinishReason} = 'upstream_error' then 1 else 0 end)::int`.as( + "upstreamErrorCount", + ), + inputTokens: + sql`coalesce(sum(cast(${tables.log.promptTokens} as numeric)), 0)`.as( + "inputTokens", + ), + outputTokens: + sql`coalesce(sum(cast(${tables.log.completionTokens} as numeric)), 0)`.as( + "outputTokens", + ), + totalTokens: + sql`coalesce(sum(cast(${tables.log.totalTokens} as numeric)), 0)`.as( + "totalTokens", + ), + reasoningTokens: + sql`coalesce(sum(cast(${tables.log.reasoningTokens} as numeric)), 0)`.as( + "reasoningTokens", + ), + cachedTokens: + sql`coalesce(sum(cast(${tables.log.cachedTokens} as numeric)), 0)`.as( + "cachedTokens", + ), + cost: sql`coalesce(sum(${tables.log.cost}), 0)`.as("cost"), + inputCost: sql`coalesce(sum(${tables.log.inputCost}), 0)`.as( + "inputCost", + ), + outputCost: sql`coalesce(sum(${tables.log.outputCost}), 0)`.as( + "outputCost", + ), + requestCost: sql`coalesce(sum(${tables.log.requestCost}), 0)`.as( + "requestCost", + ), + dataStorageCost: + sql`coalesce(sum(cast(${tables.log.dataStorageCost} as real)), 0)`.as( + "dataStorageCost", + ), + serviceFee: sql`coalesce(sum(${tables.log.serviceFee}), 0)`.as( + "serviceFee", + ), + discountSavings: sql`coalesce( + sum( + case + when ${tables.log.discount} > 0 and ${tables.log.discount} < 1 + then ${tables.log.cost} * ${tables.log.discount} / (1 - ${tables.log.discount}) + else 0 + end + ), + 0 + )`.as("discountSavings"), + }; +} + +/** + * Aggregates logs into the hourly stats tables for testing purposes. + * This mimics what the worker does in production. + */ +export async function aggregateLogsForTesting() { + // Find all distinct project-hour combinations in the logs + const buckets = await db + .select({ + projectId: tables.log.projectId, + hourTimestamp: sql`date_trunc('hour', ${tables.log.createdAt})`.as( + "hourTimestamp", + ), + }) + .from(tables.log) + .groupBy( + tables.log.projectId, + sql`date_trunc('hour', ${tables.log.createdAt})`, + ); + + for (const bucket of buckets) { + const hourTimestamp = roundToHourStart(new Date(bucket.hourTimestamp)); + const hourEnd = new Date(hourTimestamp.getTime() + 60 * 60 * 1000); + const projectId = bucket.projectId; + + // Aggregate project hourly stats + const [projectStats] = await db + .select(getCommonAggregationFields()) + .from(tables.log) + .where( + and( + sql`${tables.log.projectId} = ${projectId}`, + gte(tables.log.createdAt, hourTimestamp), + lt(tables.log.createdAt, hourEnd), + ), + ); + + if (projectStats && projectStats.requestCount > 0) { + await db + .insert(projectHourlyStats) + .values({ + projectId, + hourTimestamp, + ...projectStats, + }) + .onConflictDoUpdate({ + target: [ + projectHourlyStats.projectId, + projectHourlyStats.hourTimestamp, + ], + set: { + ...projectStats, + updatedAt: new Date(), + }, + }); + } + + // Aggregate project hourly model stats + const modelStats = await db + .select({ + usedModel: tables.log.usedModel, + usedProvider: tables.log.usedProvider, + ...getCommonAggregationFields(), + }) + .from(tables.log) + .where( + and( + sql`${tables.log.projectId} = ${projectId}`, + gte(tables.log.createdAt, hourTimestamp), + lt(tables.log.createdAt, hourEnd), + ), + ) + .groupBy(tables.log.usedModel, tables.log.usedProvider); + + for (const stat of modelStats) { + const { usedModel, usedProvider, ...statsFields } = stat; + await db + .insert(projectHourlyModelStats) + .values({ + projectId, + hourTimestamp, + usedModel, + usedProvider, + ...statsFields, + }) + .onConflictDoUpdate({ + target: [ + projectHourlyModelStats.projectId, + projectHourlyModelStats.hourTimestamp, + projectHourlyModelStats.usedModel, + projectHourlyModelStats.usedProvider, + ], + set: { + ...statsFields, + updatedAt: new Date(), + }, + }); + } + + // Aggregate API key hourly stats + const apiKeyStats = await db + .select({ + apiKeyId: tables.log.apiKeyId, + ...getCommonAggregationFields(), + }) + .from(tables.log) + .where( + and( + sql`${tables.log.projectId} = ${projectId}`, + gte(tables.log.createdAt, hourTimestamp), + lt(tables.log.createdAt, hourEnd), + ), + ) + .groupBy(tables.log.apiKeyId); + + for (const stat of apiKeyStats) { + const { apiKeyId, ...statsFields } = stat; + await db + .insert(apiKeyHourlyStats) + .values({ + apiKeyId, + projectId, + hourTimestamp, + ...statsFields, + }) + .onConflictDoUpdate({ + target: [apiKeyHourlyStats.apiKeyId, apiKeyHourlyStats.hourTimestamp], + set: { + ...statsFields, + updatedAt: new Date(), + }, + }); + } + } +} + export async function createTestUser() { await deleteAll(); From 99d555d7bab39f4b8967e35669d8a63ce118105b Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Mon, 9 Feb 2026 14:28:19 +0700 Subject: [PATCH 05/24] chore: push --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index fa39575d15..d625f2d16a 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "migrate": "pnpm --filter db migrate", "migrations": "pnpm --filter db migrations", "prepare-codex": "mv ~/.nvm ~/.nvm-bak && export PATH=\"${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH\" && . ~/.bashrc && sudo service postgresql start && sudo service redis-server start && sleep 20 && pnpm sync", + "push": "pnpm push-dev && pnpm push-test", "push-dev": "pnpm --filter db push", "push-test": "cross-env-shell \"DATABASE_URL=${DATABASE_URL:-postgres://postgres:pw@localhost:5432/test}\" pnpm --filter db push", "seed": "pnpm --filter db seed", From fe7a33e81335a0aa913c2f07f9b0e639c2f3a2ea Mon Sep 17 00:00:00 2001 From: steebchen Date: Mon, 9 Feb 2026 07:36:08 +0000 Subject: [PATCH 06/24] feat(scripts): add script to generate random test logs Adds a one-off script to bulk insert random logs for testing dashboards and visualizations locally. Features: - Weighted random distribution across 7 popular models - Realistic token counts, costs, and durations - Configurable number of logs and date range - Batched inserts for performance Usage: npx tsx scripts/generate-test-logs.ts [daysBack] Co-Authored-By: Claude Opus 4.5 --- scripts/generate-test-logs.ts | 283 ++++++++++++++++++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 scripts/generate-test-logs.ts diff --git a/scripts/generate-test-logs.ts b/scripts/generate-test-logs.ts new file mode 100644 index 0000000000..defc904a66 --- /dev/null +++ b/scripts/generate-test-logs.ts @@ -0,0 +1,283 @@ +/** + * Script to generate random test logs for local development. + * This helps test dashboards and visualizations with realistic data. + * + * Usage: + * npx tsx scripts/generate-test-logs.ts + * + * Example: + * npx tsx scripts/generate-test-logs.ts 1000 proj_123 key_456 org_789 + * + * Environment: + * DATABASE_URL - PostgreSQL connection string + */ + +import { db, tables, shortid } from "@llmgateway/db"; + +// Model configurations with realistic distributions +const MODELS = [ + { + id: "gpt-4o", + provider: "openai", + weight: 25, + avgInputTokens: 500, + avgOutputTokens: 300, + inputCostPer1k: 0.005, + outputCostPer1k: 0.015, + }, + { + id: "gpt-4o-mini", + provider: "openai", + weight: 30, + avgInputTokens: 400, + avgOutputTokens: 250, + inputCostPer1k: 0.00015, + outputCostPer1k: 0.0006, + }, + { + id: "claude-3-5-sonnet-20241022", + provider: "anthropic", + weight: 20, + avgInputTokens: 600, + avgOutputTokens: 400, + inputCostPer1k: 0.003, + outputCostPer1k: 0.015, + }, + { + id: "claude-3-5-haiku-20241022", + provider: "anthropic", + weight: 10, + avgInputTokens: 350, + avgOutputTokens: 200, + inputCostPer1k: 0.0008, + outputCostPer1k: 0.004, + }, + { + id: "gemini-2.5-pro", + provider: "google-ai-studio", + weight: 8, + avgInputTokens: 550, + avgOutputTokens: 350, + inputCostPer1k: 0.00125, + outputCostPer1k: 0.005, + }, + { + id: "gemini-2.5-flash", + provider: "google-ai-studio", + weight: 5, + avgInputTokens: 300, + avgOutputTokens: 200, + inputCostPer1k: 0.000075, + outputCostPer1k: 0.0003, + }, + { + id: "deepseek-chat", + provider: "deepseek", + weight: 2, + avgInputTokens: 400, + avgOutputTokens: 300, + inputCostPer1k: 0.00014, + outputCostPer1k: 0.00028, + }, +]; + +const FINISH_REASONS = [ + { reason: "completed", weight: 85 }, + { reason: "length_limit", weight: 5 }, + { reason: "tool_calls", weight: 5 }, + { reason: "content_filter", weight: 1 }, + { reason: "canceled", weight: 1 }, + { reason: "upstream_error", weight: 2 }, + { reason: "client_error", weight: 1 }, +]; + +function weightedRandom(items: T[]): T { + const totalWeight = items.reduce((sum, item) => sum + item.weight, 0); + let random = Math.random() * totalWeight; + + for (const item of items) { + random -= item.weight; + if (random <= 0) { + return item; + } + } + + return items[items.length - 1]; +} + +function randomInt(min: number, max: number): number { + return Math.floor(Math.random() * (max - min + 1)) + min; +} + +function randomFloat(min: number, max: number): number { + return Math.random() * (max - min) + min; +} + +function randomDate(daysBack: number): Date { + const now = new Date(); + const msBack = randomInt(0, daysBack * 24 * 60 * 60 * 1000); + return new Date(now.getTime() - msBack); +} + +function generateLog( + projectId: string, + apiKeyId: string, + organizationId: string, + daysBack: number, +) { + const model = weightedRandom(MODELS); + const finishReason = weightedRandom(FINISH_REASONS); + + // Add variance to token counts (50-150% of average) + const inputTokens = Math.round( + model.avgInputTokens * randomFloat(0.5, 1.5), + ); + const outputTokens = Math.round( + model.avgOutputTokens * randomFloat(0.5, 1.5), + ); + const totalTokens = inputTokens + outputTokens; + + // Calculate costs + const inputCost = (inputTokens / 1000) * model.inputCostPer1k; + const outputCost = (outputTokens / 1000) * model.outputCostPer1k; + const cost = inputCost + outputCost; + + // Random duration (100ms - 5000ms, with most being fast) + const duration = Math.round( + Math.pow(randomFloat(10, 70), 2), // Skewed towards faster responses + ); + + // Error states based on finish reason + const hasError = ["upstream_error", "client_error", "gateway_error"].includes( + finishReason.reason, + ); + + // Random flags + const streamed = Math.random() > 0.3; // 70% are streamed + const cached = Math.random() > 0.9; // 10% are cached + + // Time to first token (only for streamed, 50-500ms) + const timeToFirstToken = streamed ? randomInt(50, 500) : null; + + // Generate date within the specified range + const createdAt = randomDate(daysBack); + + const id = shortid(); + + return { + id, + requestId: id, + createdAt, + updatedAt: createdAt, + organizationId, + projectId, + apiKeyId, + duration, + timeToFirstToken, + requestedModel: model.id, + requestedProvider: model.provider, + usedModel: model.id, + usedProvider: model.provider, + responseSize: outputTokens * 4, // Rough estimate + promptTokens: String(inputTokens), + completionTokens: String(outputTokens), + totalTokens: String(totalTokens), + cost, + inputCost, + outputCost, + requestCost: 0, + hasError, + finishReason: finishReason.reason, + unifiedFinishReason: finishReason.reason, + streamed, + cached, + mode: "credits" as const, + usedMode: "credits" as const, + messages: JSON.stringify([ + { role: "user", content: "Test message for visualization" }, + ]), + temperature: randomFloat(0, 1), + maxTokens: randomInt(100, 4000), + }; +} + +async function main() { + const args = process.argv.slice(2); + + if (args.length < 4) { + console.log( + "Usage: npx tsx scripts/generate-test-logs.ts [daysBack]", + ); + console.log("\nExample:"); + console.log( + " npx tsx scripts/generate-test-logs.ts 1000 proj_123 key_456 org_789 30", + ); + console.log("\nArguments:"); + console.log(" count - Number of logs to generate"); + console.log(" projectId - Project ID to associate logs with"); + console.log(" apiKeyId - API Key ID to associate logs with"); + console.log(" organizationId - Organization ID to associate logs with"); + console.log(" daysBack - How many days back to spread logs (default: 30)"); + process.exit(1); + } + + const count = parseInt(args[0], 10); + const projectId = args[1]; + const apiKeyId = args[2]; + const organizationId = args[3]; + const daysBack = parseInt(args[4] || "30", 10); + + if (isNaN(count) || count <= 0) { + console.error("Error: count must be a positive integer"); + process.exit(1); + } + + console.log(`Generating ${count} test logs...`); + console.log(` Project ID: ${projectId}`); + console.log(` API Key ID: ${apiKeyId}`); + console.log(` Organization ID: ${organizationId}`); + console.log(` Days back: ${daysBack}`); + + // Generate logs in batches of 1000 + const batchSize = 1000; + let generated = 0; + + while (generated < count) { + const batchCount = Math.min(batchSize, count - generated); + const logs = Array.from({ length: batchCount }, () => + generateLog(projectId, apiKeyId, organizationId, daysBack), + ); + + await db.insert(tables.log).values(logs); + generated += batchCount; + + const progress = Math.round((generated / count) * 100); + console.log(` Progress: ${generated}/${count} (${progress}%)`); + } + + console.log("\nDone! Generated logs summary:"); + + // Print summary stats + const modelCounts: Record = {}; + const logs = Array.from({ length: Math.min(count, 10000) }, () => + generateLog(projectId, apiKeyId, organizationId, daysBack), + ); + for (const log of logs) { + modelCounts[log.usedModel] = (modelCounts[log.usedModel] || 0) + 1; + } + + console.log("\nModel distribution (sample):"); + for (const [model, modelCount] of Object.entries(modelCounts).sort( + (a, b) => b[1] - a[1], + )) { + const pct = ((modelCount / logs.length) * 100).toFixed(1); + console.log(` ${model}: ${pct}%`); + } + + process.exit(0); +} + +main().catch((err) => { + console.error("Error:", err); + process.exit(1); +}); From be1d436c1b290e3cd065b199f63739144de5b706 Mon Sep 17 00:00:00 2001 From: steebchen Date: Mon, 9 Feb 2026 07:40:14 +0000 Subject: [PATCH 07/24] fix(scripts): use nanoid directly instead of shortid export The shortid function wasn't being resolved correctly from the db package exports. Use nanoid directly with the same alphabet. Co-Authored-By: Claude Opus 4.5 --- scripts/generate-test-logs.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/generate-test-logs.ts b/scripts/generate-test-logs.ts index defc904a66..09fa53a4f8 100644 --- a/scripts/generate-test-logs.ts +++ b/scripts/generate-test-logs.ts @@ -12,7 +12,13 @@ * DATABASE_URL - PostgreSQL connection string */ -import { db, tables, shortid } from "@llmgateway/db"; +import { db, tables } from "@llmgateway/db"; +import { customAlphabet } from "nanoid"; + +const generate = customAlphabet( + "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", +); +const shortid = (size = 20) => generate(size); // Model configurations with realistic distributions const MODELS = [ From b31112abd18c862da6667e22eb892dc07e8e8920 Mon Sep 17 00:00:00 2001 From: steebchen Date: Mon, 9 Feb 2026 07:45:09 +0000 Subject: [PATCH 08/24] fix(scripts): move generate-test-logs to packages/db Move the script to packages/db where it can properly resolve local imports. Add npm script for easy execution. Usage: pnpm --filter @llmgateway/db generate-test-logs 1000 proj key org Co-Authored-By: Claude Opus 4.5 --- packages/db/package.json | 1 + .../db/src/scripts}/generate-test-logs.ts | 47 ++++++------------- 2 files changed, 16 insertions(+), 32 deletions(-) rename {scripts => packages/db/src/scripts}/generate-test-logs.ts (83%) diff --git a/packages/db/package.json b/packages/db/package.json index f883c2255d..135a550684 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -19,6 +19,7 @@ "build": "tsc && resolve-tspaths", "dev": "tsc-watch --onSuccess 'resolve-tspaths'", "format": "eslint --fix . && prettier --write .", + "generate-test-logs": "tsx src/scripts/generate-test-logs.ts", "lint": "eslint . && prettier --check .", "migrate": "pnpm drizzle-kit migrate --config drizzle.config.ts", "migrations": "pnpm drizzle-kit generate --config drizzle.config.ts", diff --git a/scripts/generate-test-logs.ts b/packages/db/src/scripts/generate-test-logs.ts similarity index 83% rename from scripts/generate-test-logs.ts rename to packages/db/src/scripts/generate-test-logs.ts index 09fa53a4f8..7c5a4f4379 100644 --- a/scripts/generate-test-logs.ts +++ b/packages/db/src/scripts/generate-test-logs.ts @@ -1,20 +1,23 @@ +/* eslint-disable no-console */ /** * Script to generate random test logs for local development. * This helps test dashboards and visualizations with realistic data. * * Usage: - * npx tsx scripts/generate-test-logs.ts + * pnpm --filter @llmgateway/db generate-test-logs 1000 proj_123 key_456 org_789 * - * Example: - * npx tsx scripts/generate-test-logs.ts 1000 proj_123 key_456 org_789 + * Or from packages/db: + * pnpm generate-test-logs 1000 proj_123 key_456 org_789 * * Environment: * DATABASE_URL - PostgreSQL connection string */ -import { db, tables } from "@llmgateway/db"; import { customAlphabet } from "nanoid"; +import { db } from "@/db.js"; +import { log } from "@/schema.js"; + const generate = customAlphabet( "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", ); @@ -135,9 +138,7 @@ function generateLog( const finishReason = weightedRandom(FINISH_REASONS); // Add variance to token counts (50-150% of average) - const inputTokens = Math.round( - model.avgInputTokens * randomFloat(0.5, 1.5), - ); + const inputTokens = Math.round(model.avgInputTokens * randomFloat(0.5, 1.5)); const outputTokens = Math.round( model.avgOutputTokens * randomFloat(0.5, 1.5), ); @@ -212,18 +213,18 @@ async function main() { if (args.length < 4) { console.log( - "Usage: npx tsx scripts/generate-test-logs.ts [daysBack]", + "Usage: pnpm generate-test-logs [daysBack]", ); console.log("\nExample:"); - console.log( - " npx tsx scripts/generate-test-logs.ts 1000 proj_123 key_456 org_789 30", - ); + console.log(" pnpm generate-test-logs 1000 proj_123 key_456 org_789 30"); console.log("\nArguments:"); console.log(" count - Number of logs to generate"); console.log(" projectId - Project ID to associate logs with"); console.log(" apiKeyId - API Key ID to associate logs with"); console.log(" organizationId - Organization ID to associate logs with"); - console.log(" daysBack - How many days back to spread logs (default: 30)"); + console.log( + " daysBack - How many days back to spread logs (default: 30)", + ); process.exit(1); } @@ -254,32 +255,14 @@ async function main() { generateLog(projectId, apiKeyId, organizationId, daysBack), ); - await db.insert(tables.log).values(logs); + await db.insert(log).values(logs); generated += batchCount; const progress = Math.round((generated / count) * 100); console.log(` Progress: ${generated}/${count} (${progress}%)`); } - console.log("\nDone! Generated logs summary:"); - - // Print summary stats - const modelCounts: Record = {}; - const logs = Array.from({ length: Math.min(count, 10000) }, () => - generateLog(projectId, apiKeyId, organizationId, daysBack), - ); - for (const log of logs) { - modelCounts[log.usedModel] = (modelCounts[log.usedModel] || 0) + 1; - } - - console.log("\nModel distribution (sample):"); - for (const [model, modelCount] of Object.entries(modelCounts).sort( - (a, b) => b[1] - a[1], - )) { - const pct = ((modelCount / logs.length) * 100).toFixed(1); - console.log(` ${model}: ${pct}%`); - } - + console.log("\nDone!"); process.exit(0); } From 8b8fa93508222e4b6ade65a68e01fd872b707712 Mon Sep 17 00:00:00 2001 From: steebchen Date: Mon, 9 Feb 2026 07:51:14 +0000 Subject: [PATCH 09/24] refactor(scripts): create dedicated scripts package for monorepo utilities Move generate-test-logs to a new @llmgateway/scripts package that can properly resolve workspace dependencies. This allows scripts to import from any package in the monorepo. Usage: pnpm --filter @llmgateway/scripts generate-test-logs 1000 proj key org Co-Authored-By: Claude Opus 4.5 --- packages/db/package.json | 1 - packages/scripts/package.json | 17 +++++++++++++++++ .../src}/generate-test-logs.ts | 17 +++++++---------- packages/scripts/tsconfig.json | 8 ++++++++ pnpm-lock.yaml | 13 +++++++++++++ 5 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 packages/scripts/package.json rename packages/{db/src/scripts => scripts/src}/generate-test-logs.ts (93%) create mode 100644 packages/scripts/tsconfig.json diff --git a/packages/db/package.json b/packages/db/package.json index 135a550684..f883c2255d 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -19,7 +19,6 @@ "build": "tsc && resolve-tspaths", "dev": "tsc-watch --onSuccess 'resolve-tspaths'", "format": "eslint --fix . && prettier --write .", - "generate-test-logs": "tsx src/scripts/generate-test-logs.ts", "lint": "eslint . && prettier --check .", "migrate": "pnpm drizzle-kit migrate --config drizzle.config.ts", "migrations": "pnpm drizzle-kit generate --config drizzle.config.ts", diff --git a/packages/scripts/package.json b/packages/scripts/package.json new file mode 100644 index 0000000000..47aba70e3f --- /dev/null +++ b/packages/scripts/package.json @@ -0,0 +1,17 @@ +{ + "name": "@llmgateway/scripts", + "version": "0.0.0", + "private": true, + "license": "SEE LICENSE IN ../../LICENSE", + "type": "module", + "scripts": { + "generate-test-logs": "tsx src/generate-test-logs.ts" + }, + "dependencies": { + "@llmgateway/db": "workspace:*", + "nanoid": "5.1.5" + }, + "devDependencies": { + "tsx": "4.20.6" + } +} diff --git a/packages/db/src/scripts/generate-test-logs.ts b/packages/scripts/src/generate-test-logs.ts similarity index 93% rename from packages/db/src/scripts/generate-test-logs.ts rename to packages/scripts/src/generate-test-logs.ts index 7c5a4f4379..98a00a2181 100644 --- a/packages/db/src/scripts/generate-test-logs.ts +++ b/packages/scripts/src/generate-test-logs.ts @@ -4,20 +4,15 @@ * This helps test dashboards and visualizations with realistic data. * * Usage: - * pnpm --filter @llmgateway/db generate-test-logs 1000 proj_123 key_456 org_789 - * - * Or from packages/db: - * pnpm generate-test-logs 1000 proj_123 key_456 org_789 + * pnpm --filter @llmgateway/scripts generate-test-logs 1000 proj_123 key_456 org_789 * * Environment: * DATABASE_URL - PostgreSQL connection string */ +import { db, tables } from "@llmgateway/db"; import { customAlphabet } from "nanoid"; -import { db } from "@/db.js"; -import { log } from "@/schema.js"; - const generate = customAlphabet( "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", ); @@ -213,10 +208,12 @@ async function main() { if (args.length < 4) { console.log( - "Usage: pnpm generate-test-logs [daysBack]", + "Usage: pnpm --filter @llmgateway/scripts generate-test-logs [daysBack]", ); console.log("\nExample:"); - console.log(" pnpm generate-test-logs 1000 proj_123 key_456 org_789 30"); + console.log( + " pnpm --filter @llmgateway/scripts generate-test-logs 1000 proj_123 key_456 org_789 30", + ); console.log("\nArguments:"); console.log(" count - Number of logs to generate"); console.log(" projectId - Project ID to associate logs with"); @@ -255,7 +252,7 @@ async function main() { generateLog(projectId, apiKeyId, organizationId, daysBack), ); - await db.insert(log).values(logs); + await db.insert(tables.log).values(logs); generated += batchCount; const progress = Math.round((generated / count) * 100); diff --git a/packages/scripts/tsconfig.json b/packages/scripts/tsconfig.json new file mode 100644 index 0000000000..fb9c402137 --- /dev/null +++ b/packages/scripts/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": "./src" + }, + "include": ["src/**/*"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 52e22c28bc..fc7c6e7668 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1296,6 +1296,19 @@ importers: packages/models: {} + packages/scripts: + dependencies: + '@llmgateway/db': + specifier: workspace:* + version: link:../db + nanoid: + specifier: 5.1.5 + version: 5.1.5 + devDependencies: + tsx: + specifier: 4.20.6 + version: 4.20.6 + packages/shared: dependencies: '@llmgateway/models': From efe3b857a2b2efd0aa86ed3ec165b79553f764a0 Mon Sep 17 00:00:00 2001 From: steebchen Date: Mon, 9 Feb 2026 07:52:28 +0000 Subject: [PATCH 10/24] feat(scripts): add 30% discount for smaller models in test logs Update generate-test-logs to apply discounts to smaller/cheaper models: - gpt-4o-mini: 30% discount - claude-3-5-haiku: 30% discount - gemini-2.5-flash: 30% discount - deepseek-chat: 30% discount The discount field is now included in generated logs, which allows the aggregator to calculate discountSavings correctly. Co-Authored-By: Claude Opus 4.5 --- packages/scripts/src/generate-test-logs.ts | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/packages/scripts/src/generate-test-logs.ts b/packages/scripts/src/generate-test-logs.ts index 98a00a2181..5e0cdf1d99 100644 --- a/packages/scripts/src/generate-test-logs.ts +++ b/packages/scripts/src/generate-test-logs.ts @@ -19,6 +19,7 @@ const generate = customAlphabet( const shortid = (size = 20) => generate(size); // Model configurations with realistic distributions +// discount is applied to smaller/cheaper models (0.3 = 30% discount) const MODELS = [ { id: "gpt-4o", @@ -28,6 +29,7 @@ const MODELS = [ avgOutputTokens: 300, inputCostPer1k: 0.005, outputCostPer1k: 0.015, + discount: 0, // No discount for premium model }, { id: "gpt-4o-mini", @@ -37,6 +39,7 @@ const MODELS = [ avgOutputTokens: 250, inputCostPer1k: 0.00015, outputCostPer1k: 0.0006, + discount: 0.3, // 30% discount for smaller model }, { id: "claude-3-5-sonnet-20241022", @@ -46,6 +49,7 @@ const MODELS = [ avgOutputTokens: 400, inputCostPer1k: 0.003, outputCostPer1k: 0.015, + discount: 0, // No discount for premium model }, { id: "claude-3-5-haiku-20241022", @@ -55,6 +59,7 @@ const MODELS = [ avgOutputTokens: 200, inputCostPer1k: 0.0008, outputCostPer1k: 0.004, + discount: 0.3, // 30% discount for smaller model }, { id: "gemini-2.5-pro", @@ -64,6 +69,7 @@ const MODELS = [ avgOutputTokens: 350, inputCostPer1k: 0.00125, outputCostPer1k: 0.005, + discount: 0, // No discount for premium model }, { id: "gemini-2.5-flash", @@ -73,6 +79,7 @@ const MODELS = [ avgOutputTokens: 200, inputCostPer1k: 0.000075, outputCostPer1k: 0.0003, + discount: 0.3, // 30% discount for smaller model }, { id: "deepseek-chat", @@ -82,6 +89,7 @@ const MODELS = [ avgOutputTokens: 300, inputCostPer1k: 0.00014, outputCostPer1k: 0.00028, + discount: 0.3, // 30% discount for smaller model }, ]; @@ -139,10 +147,17 @@ function generateLog( ); const totalTokens = inputTokens + outputTokens; - // Calculate costs - const inputCost = (inputTokens / 1000) * model.inputCostPer1k; - const outputCost = (outputTokens / 1000) * model.outputCostPer1k; - const cost = inputCost + outputCost; + // Calculate costs (before discount) + const inputCostBeforeDiscount = (inputTokens / 1000) * model.inputCostPer1k; + const outputCostBeforeDiscount = (outputTokens / 1000) * model.outputCostPer1k; + const costBeforeDiscount = inputCostBeforeDiscount + outputCostBeforeDiscount; + + // Apply discount if model has one + const discount = model.discount; + const discountMultiplier = 1 - discount; + const inputCost = inputCostBeforeDiscount * discountMultiplier; + const outputCost = outputCostBeforeDiscount * discountMultiplier; + const cost = costBeforeDiscount * discountMultiplier; // Random duration (100ms - 5000ms, with most being fast) const duration = Math.round( @@ -188,6 +203,7 @@ function generateLog( inputCost, outputCost, requestCost: 0, + discount, hasError, finishReason: finishReason.reason, unifiedFinishReason: finishReason.reason, From de6615308d80f15e811219a077af31e3b1b73467 Mon Sep 17 00:00:00 2001 From: steebchen Date: Mon, 9 Feb 2026 08:53:15 +0000 Subject: [PATCH 11/24] refactor(scripts): move all TS scripts to @llmgateway/scripts package Consolidates all TypeScript utility scripts into the dedicated scripts package for proper workspace dependency resolution: - api-ping: API health monitoring with SQLite persistence - export-models-dev: Export models to models.dev TOML format - generate-test-logs: Generate random test logs for dashboards - model-release-dates: Query model release dates via Perplexity - send: Bulk email sender via Resend - test-gemini-tools-*: Gemini tool calling tests Usage: pnpm --filter @llmgateway/scripts Co-Authored-By: Claude Opus 4.5 --- packages/scripts/package.json | 15 +- {scripts => packages/scripts/src}/api-ping.ts | 1 + .../scripts/src}/export-models-dev.ts | 5 +- .../scripts/src}/model-release-dates.ts | 3 +- {scripts => packages/scripts/src}/send.ts | 1 + .../scripts/src}/test-gemini-tools-complex.ts | 0 .../scripts/src}/test-gemini-tools-simple.ts | 0 pnpm-lock.yaml | 308 +++++++++++++++++- 8 files changed, 323 insertions(+), 10 deletions(-) rename {scripts => packages/scripts/src}/api-ping.ts (98%) rename {scripts => packages/scripts/src}/export-models-dev.ts (98%) rename {scripts => packages/scripts/src}/model-release-dates.ts (98%) rename {scripts => packages/scripts/src}/send.ts (98%) rename {scripts => packages/scripts/src}/test-gemini-tools-complex.ts (100%) rename {scripts => packages/scripts/src}/test-gemini-tools-simple.ts (100%) diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 47aba70e3f..ea1107374a 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -5,11 +5,22 @@ "license": "SEE LICENSE IN ../../LICENSE", "type": "module", "scripts": { - "generate-test-logs": "tsx src/generate-test-logs.ts" + "api-ping": "tsx src/api-ping.ts", + "export-models-dev": "tsx src/export-models-dev.ts", + "generate-test-logs": "tsx src/generate-test-logs.ts", + "model-release-dates": "tsx src/model-release-dates.ts", + "send": "tsx src/send.ts", + "test-gemini-tools-complex": "tsx src/test-gemini-tools-complex.ts", + "test-gemini-tools-simple": "tsx src/test-gemini-tools-simple.ts" }, "dependencies": { "@llmgateway/db": "workspace:*", - "nanoid": "5.1.5" + "@llmgateway/models": "workspace:*", + "nanoid": "5.1.5", + "openai": "4.104.0", + "resend": "4.5.1", + "sql.js": "1.12.0", + "zod": "3.25.75" }, "devDependencies": { "tsx": "4.20.6" diff --git a/scripts/api-ping.ts b/packages/scripts/src/api-ping.ts similarity index 98% rename from scripts/api-ping.ts rename to packages/scripts/src/api-ping.ts index 44114748e6..2576fc132c 100644 --- a/scripts/api-ping.ts +++ b/packages/scripts/src/api-ping.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import initSqlJs, { type Database } from "sql.js"; import { readFileSync, writeFileSync, existsSync } from "fs"; diff --git a/scripts/export-models-dev.ts b/packages/scripts/src/export-models-dev.ts similarity index 98% rename from scripts/export-models-dev.ts rename to packages/scripts/src/export-models-dev.ts index 5a46652068..2c82cd3ca9 100644 --- a/scripts/export-models-dev.ts +++ b/packages/scripts/src/export-models-dev.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ /** * Script to export models to models.dev TOML format * @@ -22,14 +23,14 @@ import { mkdirSync, writeFileSync, existsSync, rmSync, copyFileSync } from "fs"; import { join, dirname } from "path"; import { fileURLToPath } from "url"; -import { models, type ModelDefinition } from "../packages/models/src/models.js"; +import { models, type ModelDefinition } from "@llmgateway/models"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const OUTPUT_DIR = "exports/providers/llmgateway"; const MODELS_DIR = join(OUTPUT_DIR, "models"); -const LOGO_SOURCE = join(__dirname, "../apps/ui/public/brand/logo-black.svg"); +const LOGO_SOURCE = join(__dirname, "../../../apps/ui/public/brand/logo-black.svg"); interface ModelsDevModel { name: string; diff --git a/scripts/model-release-dates.ts b/packages/scripts/src/model-release-dates.ts similarity index 98% rename from scripts/model-release-dates.ts rename to packages/scripts/src/model-release-dates.ts index 47c315714e..be4f46feef 100644 --- a/scripts/model-release-dates.ts +++ b/packages/scripts/src/model-release-dates.ts @@ -1,4 +1,5 @@ -import { models } from "../packages/models/src/models.js"; +/* eslint-disable no-console */ +import { models } from "@llmgateway/models"; import { writeFileSync, appendFileSync, existsSync, unlinkSync } from "fs"; const GATEWAY_URL = "http://localhost:4001/v1/chat/completions"; diff --git a/scripts/send.ts b/packages/scripts/src/send.ts similarity index 98% rename from scripts/send.ts rename to packages/scripts/src/send.ts index 2f182981d3..0b5ce88136 100644 --- a/scripts/send.ts +++ b/packages/scripts/src/send.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ // JSON Schema: // [ // { diff --git a/scripts/test-gemini-tools-complex.ts b/packages/scripts/src/test-gemini-tools-complex.ts similarity index 100% rename from scripts/test-gemini-tools-complex.ts rename to packages/scripts/src/test-gemini-tools-complex.ts diff --git a/scripts/test-gemini-tools-simple.ts b/packages/scripts/src/test-gemini-tools-simple.ts similarity index 100% rename from scripts/test-gemini-tools-simple.ts rename to packages/scripts/src/test-gemini-tools-simple.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fc7c6e7668..69c5644ff1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -296,7 +296,7 @@ importers: version: 0.7.2(hono@4.11.7)(zod@3.25.75) '@kubiks/otel-better-auth': specifier: 2.0.2 - version: 2.0.2(@opentelemetry/api@1.9.0)(better-auth@1.3.30) + version: 2.0.2(@opentelemetry/api@1.9.0)(better-auth@1.3.30(react-dom@19.2.4(react@19.2.4))(react@19.2.4)) '@llmgateway/actions': specifier: workspace:* version: link:../../packages/actions @@ -365,7 +365,7 @@ importers: version: 5.10.4 resend: specifier: 6.8.0 - version: 6.8.0 + version: 6.8.0(@react-email/render@1.0.6(react-dom@19.2.4(react@19.2.4))(react@19.2.4)) stripe: specifier: 18.1.1 version: 18.1.1(@types/node@25.2.0) @@ -1100,7 +1100,7 @@ importers: version: 3.3.0(@types/react@19.2.10)(react-dom@19.2.4(react@19.2.4))(react-is@18.3.1)(react@19.2.4)(redux@5.0.1) resend: specifier: 6.8.0 - version: 6.8.0 + version: 6.8.0(@react-email/render@1.0.6(react-dom@19.2.4(react@19.2.4))(react@19.2.4)) sonner: specifier: ^2.0.7 version: 2.0.7(react-dom@19.2.4(react@19.2.4))(react@19.2.4) @@ -1301,9 +1301,24 @@ importers: '@llmgateway/db': specifier: workspace:* version: link:../db + '@llmgateway/models': + specifier: workspace:* + version: link:../models nanoid: specifier: 5.1.5 version: 5.1.5 + openai: + specifier: 4.104.0 + version: 4.104.0(zod@3.25.75) + resend: + specifier: 4.5.1 + version: 4.5.1(react-dom@19.2.4(react@19.2.4))(react@19.2.4) + sql.js: + specifier: 1.12.0 + version: 1.12.0 + zod: + specifier: 3.25.75 + version: 3.25.75 devDependencies: tsx: specifier: 4.20.6 @@ -3611,6 +3626,13 @@ packages: '@radix-ui/rect@1.1.1': resolution: {integrity: sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw==} + '@react-email/render@1.0.6': + resolution: {integrity: sha512-zNueW5Wn/4jNC1c5LFgXzbUdv5Lhms+FWjOvWAhal7gx5YVf0q6dPJ0dnR70+ifo59gcMLwCZEaTS9EEuUhKvQ==} + engines: {node: '>=18.0.0'} + peerDependencies: + react: ^18.0 || ^19.0 || ^19.0.0-rc + react-dom: ^18.0 || ^19.0 || ^19.0.0-rc + '@redis/bloom@5.9.0': resolution: {integrity: sha512-W9D8yfKTWl4tP8lkC3MRYkMz4OfbuzE/W8iObe0jFgoRmgMfkBV+Vj38gvIqZPImtY0WB34YZkX3amYuQebvRQ==} engines: {node: '>= 18'} @@ -3796,6 +3818,9 @@ packages: '@sec-ant/readable-stream@0.4.1': resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==} + '@selderee/plugin-htmlparser2@0.11.0': + resolution: {integrity: sha512-P33hHGdldxGabLFjPPpaTxVolMrzrcegejx+0GxjrIb9Zv48D8yAIA/QTDR2dFl7Uz7urX8aX6+5bCZslr+gWQ==} + '@semantic-release/commit-analyzer@13.0.1': resolution: {integrity: sha512-wdnBPHKkr9HhNhXOhZD5a2LNl91+hs8CC2vsAVYxtZH3y0dV3wKn+uZSN61rdJQZ8EGxzWB3inWocBHV9+u/CQ==} engines: {node: '>=20.8.1'} @@ -4305,6 +4330,12 @@ packages: '@types/mysql@2.15.27': resolution: {integrity: sha512-YfWiV16IY0OeBfBCk8+hXKmdTKrKlwKN1MNKAPBu5JYxLwBEZl7QzeEpGnlZb3VMGJrrGmB84gXiH+ofs/TezA==} + '@types/node-fetch@2.6.13': + resolution: {integrity: sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw==} + + '@types/node@18.19.130': + resolution: {integrity: sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg==} + '@types/node@20.19.14': resolution: {integrity: sha512-gqiKWld3YIkmtrrg9zDvg9jfksZCcPywXVN7IauUGhilwGV/yOyeUsvpR796m/Jye0zUzMXPKe8Ct1B79A7N5Q==} @@ -4592,6 +4623,10 @@ packages: resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} engines: {node: '>= 14'} + agentkeepalive@4.6.0: + resolution: {integrity: sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==} + engines: {node: '>= 8.0.0'} + aggregate-error@3.1.0: resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==} engines: {node: '>=8'} @@ -4738,6 +4773,9 @@ packages: resolution: {integrity: sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==} engines: {node: '>= 0.4'} + asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + atomic-sleep@1.0.0: resolution: {integrity: sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==} engines: {node: '>=8.0.0'} @@ -5046,6 +5084,10 @@ packages: colorette@2.0.20: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} + combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + comma-separated-tokens@2.0.3: resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==} @@ -5438,6 +5480,10 @@ packages: deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + deepmerge@4.3.1: + resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} + engines: {node: '>=0.10.0'} + default-browser-id@5.0.1: resolution: {integrity: sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==} engines: {node: '>=18'} @@ -5468,6 +5514,10 @@ packages: delaunator@5.0.1: resolution: {integrity: sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==} + delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + denque@2.1.0: resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==} engines: {node: '>=0.10'} @@ -5509,9 +5559,22 @@ packages: resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} engines: {node: '>=0.10.0'} + dom-serializer@2.0.0: + resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==} + + domelementtype@2.3.0: + resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} + + domhandler@5.0.3: + resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==} + engines: {node: '>= 4'} + dompurify@3.3.1: resolution: {integrity: sha512-qkdCKzLNtrgPFP1Vo+98FRzJnBRGe4ffyCea9IwHB1fyxPOeNTHpLKYGd4Uk9xvNoH0ZoOjwZxNptyMwqrId1Q==} + domutils@3.2.2: + resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==} + dot-prop@5.3.0: resolution: {integrity: sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==} engines: {node: '>=8'} @@ -5774,6 +5837,10 @@ packages: resolution: {integrity: sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==} engines: {node: '>=10.13.0'} + entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} + engines: {node: '>=0.12'} + entities@6.0.1: resolution: {integrity: sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==} engines: {node: '>=0.12'} @@ -6157,6 +6224,9 @@ packages: fast-copy@3.0.2: resolution: {integrity: sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ==} + fast-deep-equal@2.0.1: + resolution: {integrity: sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==} + fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} @@ -6288,10 +6358,21 @@ packages: resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==} engines: {node: '>=14'} + form-data-encoder@1.7.2: + resolution: {integrity: sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==} + + form-data@4.0.5: + resolution: {integrity: sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==} + engines: {node: '>= 6'} + format@0.2.2: resolution: {integrity: sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==} engines: {node: '>=0.4.x'} + formdata-node@4.4.1: + resolution: {integrity: sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==} + engines: {node: '>= 12.20'} + forwarded-parse@2.1.2: resolution: {integrity: sha512-alTFZZQDKMporBH77856pXgzhEzaUVmLCDk+egLgIgHst3Tpndzz8MnKe+GzRJRfvVdn69HhpW7cmXzvtLvJAw==} @@ -6736,6 +6817,10 @@ packages: html-to-image@1.11.13: resolution: {integrity: sha512-cuOPoI7WApyhBElTTb9oqsawRvZ0rHhaHwghRLlTuffoD1B2aDemlCruLeZrUIIdvG7gs9xeELEPm6PhuASqrg==} + html-to-text@9.0.5: + resolution: {integrity: sha512-qY60FjREgVZL03vJU6IfMV4GDjGBIoOyvuFdpBDIX9yTlDw0TjxVBQp+P8NvpdIXNJvfWBTNul7fsAQJq2FNpg==} + engines: {node: '>=14'} + html-url-attributes@3.0.1: resolution: {integrity: sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==} @@ -6746,6 +6831,9 @@ packages: resolution: {integrity: sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==} engines: {node: '>=8.0.0'} + htmlparser2@8.0.2: + resolution: {integrity: sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==} + http-errors@2.0.1: resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==} engines: {node: '>= 0.8'} @@ -6770,6 +6858,9 @@ packages: resolution: {integrity: sha512-eKCa6bwnJhvxj14kZk5NCPc6Hb6BdsU9DZcOnmQKSnO1VKrfV0zCvtttPZUsBvjmNDn8rpcJfpwSYnHBjc95MQ==} engines: {node: '>=18.18.0'} + humanize-ms@1.2.1: + resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==} + husky@9.1.7: resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==} engines: {node: '>=18'} @@ -7241,6 +7332,9 @@ packages: layout-base@2.0.1: resolution: {integrity: sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg==} + leac@0.6.0: + resolution: {integrity: sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg==} + leven@4.0.0: resolution: {integrity: sha512-puehA3YKku3osqPlNuzGDUHq8WpwXupUg1V6NXdV38G+gr+gkBwFC8g1b/+YcIvp8gnqVIus+eJCH/eGsRmJNw==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -7729,10 +7823,18 @@ packages: resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} engines: {node: '>=8.6'} + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + mime-db@1.54.0: resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==} engines: {node: '>= 0.6'} + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + mime-types@3.0.2: resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==} engines: {node: '>=18'} @@ -7901,6 +8003,11 @@ packages: node-cleanup@2.1.2: resolution: {integrity: sha512-qN8v/s2PAJwGUtr1/hYTpNKlD6Y9rc4p8KSmJXyGdYGZsDGKXrGThikLFP9OCHFeLeEpQzPwiAtdIvBLqm//Hw==} + node-domexception@1.0.0: + resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} + engines: {node: '>=10.5.0'} + deprecated: Use your platform's native DOMException instead + node-emoji@2.2.0: resolution: {integrity: sha512-Z3lTE9pLaJF47NyMhd4ww1yFTAP8YhYI8SleJiHzM46Fgpm5cnNzSl9XfzFNqbaz+VlJrIj3fXQ4DeN1Rjm6cw==} engines: {node: '>=18'} @@ -8096,6 +8203,18 @@ packages: resolution: {integrity: sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==} engines: {node: '>=18'} + openai@4.104.0: + resolution: {integrity: sha512-p99EFNsA/yX6UhVO93f5kJsDRLAg+CTA2RBqdHK4RtK8u5IJw32Hyb2dTGKbnnFmnuoBv5r7Z2CURI9sGZpSuA==} + hasBin: true + peerDependencies: + ws: ^8.18.0 + zod: ^3.23.8 + peerDependenciesMeta: + ws: + optional: true + zod: + optional: true + openai@5.19.1: resolution: {integrity: sha512-zSqnUF7oR9ksmpusKkpUgkNrj8Sl57U+OyzO8jzc7LUjTMg4DRfR3uCm+EIMA6iw06sRPNp4t7ojp3sCpEUZRQ==} hasBin: true @@ -8267,6 +8386,9 @@ packages: parse5@7.3.0: resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==} + parseley@0.12.1: + resolution: {integrity: sha512-e6qHKe3a9HWr0oMRVDTRhKce+bRO8VGQR3NyVwcjwrbhMmFCX9KszEV35+rn4AdilFAq9VPxP/Fe1wC9Qjd2lw==} + parseurl@1.3.3: resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} engines: {node: '>= 0.8'} @@ -8318,6 +8440,9 @@ packages: pause-stream@0.0.11: resolution: {integrity: sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==} + peberminta@0.9.0: + resolution: {integrity: sha512-XIxfHpEuSJbITd1H3EeQwpcZbTLHc+VVr8ANI9t5sit565tsI4/xK3KWTUFE2e6QiangUkh3B0jihzmGnNrRsQ==} + performance-now@2.1.0: resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} @@ -8483,6 +8608,11 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier@3.5.3: + resolution: {integrity: sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==} + engines: {node: '>=14'} + hasBin: true + prettier@3.6.2: resolution: {integrity: sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==} engines: {node: '>=14'} @@ -8624,6 +8754,9 @@ packages: react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + react-promise-suspense@0.3.4: + resolution: {integrity: sha512-I42jl7L3Ze6kZaq+7zXWSunBa3b1on5yfvUW6Eo/3fFOj6dZ5Bqmcd264nJbTK/gn1HjjILAjSwnZbV4RpSaNQ==} + react-redux@9.2.0: resolution: {integrity: sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==} peerDependencies: @@ -8863,6 +8996,10 @@ packages: reselect@5.1.1: resolution: {integrity: sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==} + resend@4.5.1: + resolution: {integrity: sha512-ryhHpZqCBmuVyzM19IO8Egtc2hkWI4JOL5lf5F3P7Dydu3rFeX6lHNpGqG0tjWoZ63rw0l731JEmuJZBdDm3og==} + engines: {node: '>=18'} + resend@6.8.0: resolution: {integrity: sha512-fDOXGqafQfQXl8nXe93wr93pus8tW7YPpowenE3SmG7dJJf0hH3xUWm3xqacnPvhqjCQTJH9xETg07rmUeSuqQ==} engines: {node: '>=20'} @@ -8995,6 +9132,9 @@ packages: secure-json-parse@4.0.0: resolution: {integrity: sha512-dxtLJO6sc35jWidmLxo7ij+Eg48PM/kleBsxpC8QJE0qJICe+KawkDQmvCMZUr9u7WKVHgMW6vy3fQ7zMiFZMA==} + selderee@0.11.0: + resolution: {integrity: sha512-5TF+l7p4+OsnP8BCCvSyZiSPc4x4//p5uPwK8TCnVPJYRmU2aYKMpOXvw8zM5a5JvuuCGN1jmsMwuU2W02ukfA==} + semantic-release-monorepo@8.0.2: resolution: {integrity: sha512-TQC6KKIA0ATjii1OT0ZmQqcVzBJoaetJaJBC8FmKkg1IbDR4wBsuX6gl6UHDdijRDl8YyXqahj2hkJNyV6m9Jg==} peerDependencies: @@ -9202,6 +9342,9 @@ packages: sprintf-js@1.1.3: resolution: {integrity: sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==} + sql.js@1.12.0: + resolution: {integrity: sha512-Bi+43yMx/tUFZVYD4AUscmdL6NHn3gYQ+CM+YheFWLftOmrEC/Mz6Yh7E96Y2WDHYz3COSqT+LP6Z79zgrwJlA==} + sql.js@1.13.0: resolution: {integrity: sha512-RJbVP1HRDlUUXahJ7VMTcu9Rm1Nzw+EBpoPr94vnbD4LwR715F3CcxE2G2k45PewcaZ57pjetYa+LoSJLAASgA==} @@ -9718,6 +9861,9 @@ packages: undefsafe@2.0.5: resolution: {integrity: sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==} + undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + undici-types@6.21.0: resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} @@ -9980,6 +10126,10 @@ packages: web-namespaces@2.0.1: resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==} + web-streams-polyfill@4.0.0-beta.3: + resolution: {integrity: sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==} + engines: {node: '>= 14'} + web-vitals@4.2.4: resolution: {integrity: sha512-r4DIlprAGwJ7YM11VZp4R884m0Vmgr6EAKe3P+kO0PPj3Unqyvv59rczf6UiGcb9Z8QxZVcqKNwv/g0WNdWwsw==} @@ -11097,7 +11247,7 @@ snapshots: dependencies: jsbi: 4.3.2 - '@kubiks/otel-better-auth@2.0.2(@opentelemetry/api@1.9.0)(better-auth@1.3.30)': + '@kubiks/otel-better-auth@2.0.2(@opentelemetry/api@1.9.0)(better-auth@1.3.30(react-dom@19.2.4(react@19.2.4))(react@19.2.4))': dependencies: '@opentelemetry/api': 1.9.0 better-auth: 1.3.30(next@16.1.5(@opentelemetry/api@1.9.0)(babel-plugin-react-compiler@1.0.0)(react-dom@19.2.4(react@19.2.4))(react@19.2.4))(react-dom@19.2.4(react@19.2.4))(react@19.2.4) @@ -12785,6 +12935,14 @@ snapshots: '@radix-ui/rect@1.1.1': {} + '@react-email/render@1.0.6(react-dom@19.2.4(react@19.2.4))(react@19.2.4)': + dependencies: + html-to-text: 9.0.5 + prettier: 3.5.3 + react: 19.2.4 + react-dom: 19.2.4(react@19.2.4) + react-promise-suspense: 0.3.4 + '@redis/bloom@5.9.0(@redis/client@5.9.0)': dependencies: '@redis/client': 5.9.0 @@ -12937,6 +13095,11 @@ snapshots: '@sec-ant/readable-stream@0.4.1': {} + '@selderee/plugin-htmlparser2@0.11.0': + dependencies: + domhandler: 5.0.3 + selderee: 0.11.0 + '@semantic-release/commit-analyzer@13.0.1(semantic-release@24.2.9(typescript@5.9.2))': dependencies: conventional-changelog-angular: 8.1.0 @@ -13530,6 +13693,15 @@ snapshots: dependencies: '@types/node': 24.10.1 + '@types/node-fetch@2.6.13': + dependencies: + '@types/node': 24.10.1 + form-data: 4.0.5 + + '@types/node@18.19.130': + dependencies: + undici-types: 5.26.5 + '@types/node@20.19.14': dependencies: undici-types: 6.21.0 @@ -13909,6 +14081,10 @@ snapshots: agent-base@7.1.4: {} + agentkeepalive@4.6.0: + dependencies: + humanize-ms: 1.2.1 + aggregate-error@3.1.0: dependencies: clean-stack: 2.2.0 @@ -14075,6 +14251,8 @@ snapshots: async-function@1.0.0: {} + asynckit@0.4.0: {} + atomic-sleep@1.0.0: {} autoprefixer@10.4.21(postcss@8.5.6): @@ -14435,6 +14613,10 @@ snapshots: colorette@2.0.20: {} + combined-stream@1.0.8: + dependencies: + delayed-stream: 1.0.0 + comma-separated-tokens@2.0.3: {} commander@11.1.0: {} @@ -14833,6 +15015,8 @@ snapshots: deep-is@0.1.4: {} + deepmerge@4.3.1: {} + default-browser-id@5.0.1: {} default-browser@5.5.0: @@ -14871,6 +15055,8 @@ snapshots: dependencies: robust-predicates: 3.0.2 + delayed-stream@1.0.0: {} + denque@2.1.0: {} depd@2.0.0: {} @@ -14899,10 +15085,28 @@ snapshots: dependencies: esutils: 2.0.3 + dom-serializer@2.0.0: + dependencies: + domelementtype: 2.3.0 + domhandler: 5.0.3 + entities: 4.5.0 + + domelementtype@2.3.0: {} + + domhandler@5.0.3: + dependencies: + domelementtype: 2.3.0 + dompurify@3.3.1: optionalDependencies: '@types/trusted-types': 2.0.7 + domutils@3.2.2: + dependencies: + dom-serializer: 2.0.0 + domelementtype: 2.3.0 + domhandler: 5.0.3 + dot-prop@5.3.0: dependencies: is-obj: 2.0.0 @@ -15000,6 +15204,8 @@ snapshots: graceful-fs: 4.2.11 tapable: 2.3.0 + entities@4.5.0: {} + entities@6.0.1: {} env-ci@11.2.0: @@ -15685,6 +15891,8 @@ snapshots: fast-copy@3.0.2: {} + fast-deep-equal@2.0.1: {} + fast-deep-equal@3.1.3: {} fast-glob@3.3.1: @@ -15825,8 +16033,23 @@ snapshots: cross-spawn: 7.0.6 signal-exit: 4.1.0 + form-data-encoder@1.7.2: {} + + form-data@4.0.5: + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + es-set-tostringtag: 2.1.0 + hasown: 2.0.2 + mime-types: 2.1.35 + format@0.2.2: {} + formdata-node@4.4.1: + dependencies: + node-domexception: 1.0.0 + web-streams-polyfill: 4.0.0-beta.3 + forwarded-parse@2.1.2: {} forwarded@0.2.0: {} @@ -16437,6 +16660,14 @@ snapshots: html-to-image@1.11.13: {} + html-to-text@9.0.5: + dependencies: + '@selderee/plugin-htmlparser2': 0.11.0 + deepmerge: 4.3.1 + dom-serializer: 2.0.0 + htmlparser2: 8.0.2 + selderee: 0.11.0 + html-url-attributes@3.0.1: {} html-void-elements@3.0.0: {} @@ -16447,6 +16678,13 @@ snapshots: text-segmentation: 1.0.3 optional: true + htmlparser2@8.0.2: + dependencies: + domelementtype: 2.3.0 + domhandler: 5.0.3 + domutils: 3.2.2 + entities: 4.5.0 + http-errors@2.0.1: dependencies: depd: 2.0.0 @@ -16482,6 +16720,10 @@ snapshots: human-signals@8.0.1: {} + humanize-ms@1.2.1: + dependencies: + ms: 2.1.3 + husky@9.1.7: {} iconv-lite@0.6.3: @@ -16924,6 +17166,8 @@ snapshots: layout-base@2.0.1: {} + leac@0.6.0: {} + leven@4.0.0: {} levn@0.4.1: @@ -17676,8 +17920,14 @@ snapshots: braces: 3.0.3 picomatch: 2.3.1 + mime-db@1.52.0: {} + mime-db@1.54.0: {} + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + mime-types@3.0.2: dependencies: mime-db: 1.54.0 @@ -17821,6 +18071,8 @@ snapshots: node-cleanup@2.1.2: {} + node-domexception@1.0.0: {} + node-emoji@2.2.0: dependencies: '@sindresorhus/is': 4.6.0 @@ -17962,6 +18214,20 @@ snapshots: is-inside-container: 1.0.0 wsl-utils: 0.1.0 + openai@4.104.0(zod@3.25.75): + dependencies: + '@types/node': 18.19.130 + '@types/node-fetch': 2.6.13 + abort-controller: 3.0.0 + agentkeepalive: 4.6.0 + form-data-encoder: 1.7.2 + formdata-node: 4.4.1 + node-fetch: 2.7.0 + optionalDependencies: + zod: 3.25.75 + transitivePeerDependencies: + - encoding + openai@5.19.1(zod@3.25.75): optionalDependencies: zod: 3.25.75 @@ -18131,6 +18397,11 @@ snapshots: dependencies: entities: 6.0.1 + parseley@0.12.1: + dependencies: + leac: 0.6.0 + peberminta: 0.9.0 + parseurl@1.3.3: {} path-data-parser@0.1.0: {} @@ -18164,6 +18435,8 @@ snapshots: dependencies: through: 2.3.8 + peberminta@0.9.0: {} + performance-now@2.1.0: optional: true @@ -18349,6 +18622,8 @@ snapshots: prelude-ls@1.2.1: {} + prettier@3.5.3: {} + prettier@3.6.2: {} pretty-bytes@7.1.0: {} @@ -18486,6 +18761,10 @@ snapshots: react: 19.2.4 react-dom: 19.2.4(react@19.2.4) + react-promise-suspense@0.3.4: + dependencies: + fast-deep-equal: 2.0.1 + react-redux@9.2.0(@types/react@19.2.10)(react@19.2.4)(redux@5.0.1): dependencies: '@types/use-sync-external-store': 0.0.6 @@ -18839,9 +19118,18 @@ snapshots: reselect@5.1.1: {} - resend@6.8.0: + resend@4.5.1(react-dom@19.2.4(react@19.2.4))(react@19.2.4): + dependencies: + '@react-email/render': 1.0.6(react-dom@19.2.4(react@19.2.4))(react@19.2.4) + transitivePeerDependencies: + - react + - react-dom + + resend@6.8.0(@react-email/render@1.0.6(react-dom@19.2.4(react@19.2.4))(react@19.2.4)): dependencies: svix: 1.84.1 + optionalDependencies: + '@react-email/render': 1.0.6(react-dom@19.2.4(react@19.2.4))(react@19.2.4) resolve-from@4.0.0: {} @@ -18992,6 +19280,10 @@ snapshots: secure-json-parse@4.0.0: {} + selderee@0.11.0: + dependencies: + parseley: 0.12.1 + semantic-release-monorepo@8.0.2(semantic-release@24.2.9(typescript@5.9.2)): dependencies: debug: 4.4.3(supports-color@5.5.0) @@ -19303,6 +19595,8 @@ snapshots: sprintf-js@1.1.3: {} + sql.js@1.12.0: {} + sql.js@1.13.0: {} stable-hash-x@0.2.0: {} @@ -19858,6 +20152,8 @@ snapshots: undefsafe@2.0.5: {} + undici-types@5.26.5: {} + undici-types@6.21.0: {} undici-types@7.10.0: {} @@ -20150,6 +20446,8 @@ snapshots: web-namespaces@2.0.1: {} + web-streams-polyfill@4.0.0-beta.3: {} + web-vitals@4.2.4: {} web-worker@1.2.0: {} From 80e30bb5bc8e338296796dfd627bb19d571e803c Mon Sep 17 00:00:00 2001 From: steebchen Date: Mon, 9 Feb 2026 10:24:39 +0000 Subject: [PATCH 12/24] feat(stats): add apiKeyHourlyModelStats table for per-key model breakdown - Add apiKeyHourlyModelStats aggregation table with composite key on (apiKeyId, hourTimestamp, usedModel, usedProvider) - Update project-stats-aggregator to populate the new table - Update testing helper to clean up and aggregate to the new table - Address PR feedback: - Remove redundant index from projectHourlyStats (unique constraint already creates implicit B-tree index) - Fix UTC timezone alignment in roundToHourStart to match PostgreSQL's date_trunc behavior Co-Authored-By: Claude Opus 4.5 --- apps/api/src/testing.ts | 69 +- .../src/services/project-stats-aggregator.ts | 76 +- .../migrations/1770628946_spotty_iron_lad.sql | 41 + .../migrations/meta/1770628946_snapshot.json | 10232 ++++++++++++++++ packages/db/migrations/meta/_journal.json | 7 + packages/db/src/schema.ts | 79 +- 6 files changed, 10482 insertions(+), 22 deletions(-) create mode 100644 packages/db/migrations/1770628946_spotty_iron_lad.sql create mode 100644 packages/db/migrations/meta/1770628946_snapshot.json diff --git a/apps/api/src/testing.ts b/apps/api/src/testing.ts index 98a75273f2..6a2140fb8a 100644 --- a/apps/api/src/testing.ts +++ b/apps/api/src/testing.ts @@ -8,6 +8,7 @@ import { projectHourlyStats, projectHourlyModelStats, apiKeyHourlyStats, + apiKeyHourlyModelStats, } from "@llmgateway/db"; import { app } from "./index.js"; @@ -29,6 +30,7 @@ export async function deleteAll() { db.delete(projectHourlyStats), db.delete(projectHourlyModelStats), db.delete(apiKeyHourlyStats), + db.delete(apiKeyHourlyModelStats), ]); await Promise.all([ @@ -46,17 +48,20 @@ export async function deleteAll() { } /** - * Helper function to round a date to the start of its hour + * Helper function to round a date to the start of its hour in UTC + * Uses UTC to match PostgreSQL's date_trunc behavior */ function roundToHourStart(date: Date): Date { return new Date( - date.getFullYear(), - date.getMonth(), - date.getDate(), - date.getHours(), - 0, - 0, - 0, + Date.UTC( + date.getUTCFullYear(), + date.getUTCMonth(), + date.getUTCDate(), + date.getUTCHours(), + 0, + 0, + 0, + ), ); } @@ -300,6 +305,54 @@ export async function aggregateLogsForTesting() { }, }); } + + // Aggregate API key hourly model stats + const apiKeyModelStats = await db + .select({ + apiKeyId: tables.log.apiKeyId, + usedModel: tables.log.usedModel, + usedProvider: tables.log.usedProvider, + ...getCommonAggregationFields(), + }) + .from(tables.log) + .where( + and( + sql`${tables.log.projectId} = ${projectId}`, + gte(tables.log.createdAt, hourTimestamp), + lt(tables.log.createdAt, hourEnd), + ), + ) + .groupBy( + tables.log.apiKeyId, + tables.log.usedModel, + tables.log.usedProvider, + ); + + for (const stat of apiKeyModelStats) { + const { apiKeyId, usedModel, usedProvider, ...statsFields } = stat; + await db + .insert(apiKeyHourlyModelStats) + .values({ + apiKeyId, + projectId, + hourTimestamp, + usedModel, + usedProvider, + ...statsFields, + }) + .onConflictDoUpdate({ + target: [ + apiKeyHourlyModelStats.apiKeyId, + apiKeyHourlyModelStats.hourTimestamp, + apiKeyHourlyModelStats.usedModel, + apiKeyHourlyModelStats.usedProvider, + ], + set: { + ...statsFields, + updatedAt: new Date(), + }, + }); + } } } diff --git a/apps/worker/src/services/project-stats-aggregator.ts b/apps/worker/src/services/project-stats-aggregator.ts index f4a347ecbf..6986561883 100644 --- a/apps/worker/src/services/project-stats-aggregator.ts +++ b/apps/worker/src/services/project-stats-aggregator.ts @@ -4,6 +4,7 @@ import { projectHourlyStats, projectHourlyModelStats, apiKeyHourlyStats, + apiKeyHourlyModelStats, sql, gte, lt, @@ -17,17 +18,20 @@ export const PROJECT_STATS_REFRESH_INTERVAL_SECONDS = Number(process.env.PROJECT_STATS_REFRESH_INTERVAL_SECONDS) || 60; /** - * Helper function to round any date to the start of its hour (00 minutes, 00 seconds, 00 milliseconds) + * Helper function to round any date to the start of its hour in UTC (00 minutes, 00 seconds, 00 milliseconds) + * Uses UTC to match PostgreSQL's date_trunc behavior */ function roundToHourStart(date: Date): Date { return new Date( - date.getFullYear(), - date.getMonth(), - date.getDate(), - date.getHours(), - 0, - 0, - 0, + Date.UTC( + date.getUTCFullYear(), + date.getUTCMonth(), + date.getUTCDate(), + date.getUTCHours(), + 0, + 0, + 0, + ), ); } @@ -286,6 +290,60 @@ async function recalculateApiKeyHourlyStats( } } +/** + * Calculate and store hourly API key model statistics for a specific project and hour + */ +async function recalculateApiKeyHourlyModelStats( + projectId: string, + hourTimestamp: Date, +) { + const hourEnd = new Date(hourTimestamp.getTime() + 60 * 60 * 1000); + const database = db; + + const apiKeyModelStats = await database + .select({ + apiKeyId: log.apiKeyId, + usedModel: log.usedModel, + usedProvider: log.usedProvider, + ...getCommonAggregationFields(), + }) + .from(log) + .where( + and( + sql`${log.projectId} = ${projectId}`, + gte(log.createdAt, hourTimestamp), + lt(log.createdAt, hourEnd), + ), + ) + .groupBy(log.apiKeyId, log.usedModel, log.usedProvider); + + for (const stat of apiKeyModelStats) { + const { apiKeyId, usedModel, usedProvider, ...statsFields } = stat; + await database + .insert(apiKeyHourlyModelStats) + .values({ + apiKeyId, + projectId, + hourTimestamp, + usedModel, + usedProvider, + ...statsFields, + }) + .onConflictDoUpdate({ + target: [ + apiKeyHourlyModelStats.apiKeyId, + apiKeyHourlyModelStats.hourTimestamp, + apiKeyHourlyModelStats.usedModel, + apiKeyHourlyModelStats.usedProvider, + ], + set: { + ...statsFields, + updatedAt: new Date(), + }, + }); + } +} + /** * Process unprocessed logs and update aggregation tables */ @@ -331,6 +389,7 @@ export async function processUnprocessedLogs() { await recalculateProjectHourlyStats(bucket.projectId, hourTimestamp); await recalculateProjectHourlyModelStats(bucket.projectId, hourTimestamp); await recalculateApiKeyHourlyStats(bucket.projectId, hourTimestamp); + await recalculateApiKeyHourlyModelStats(bucket.projectId, hourTimestamp); // Mark logs as processed const result = await database @@ -394,6 +453,7 @@ export async function refreshCurrentHourStats() { await recalculateProjectHourlyStats(projectId, currentHourStart); await recalculateProjectHourlyModelStats(projectId, currentHourStart); await recalculateApiKeyHourlyStats(projectId, currentHourStart); + await recalculateApiKeyHourlyModelStats(projectId, currentHourStart); } logger.debug( diff --git a/packages/db/migrations/1770628946_spotty_iron_lad.sql b/packages/db/migrations/1770628946_spotty_iron_lad.sql new file mode 100644 index 0000000000..2f00f5971c --- /dev/null +++ b/packages/db/migrations/1770628946_spotty_iron_lad.sql @@ -0,0 +1,41 @@ +CREATE TABLE "api_key_hourly_model_stats" ( + "id" text PRIMARY KEY, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + "api_key_id" text NOT NULL, + "project_id" text NOT NULL, + "hour_timestamp" timestamp NOT NULL, + "used_model" text NOT NULL, + "used_provider" text NOT NULL, + "request_count" integer DEFAULT 0 NOT NULL, + "error_count" integer DEFAULT 0 NOT NULL, + "cache_count" integer DEFAULT 0 NOT NULL, + "streamed_count" integer DEFAULT 0 NOT NULL, + "non_streamed_count" integer DEFAULT 0 NOT NULL, + "completed_count" integer DEFAULT 0 NOT NULL, + "length_limit_count" integer DEFAULT 0 NOT NULL, + "content_filter_count" integer DEFAULT 0 NOT NULL, + "tool_calls_count" integer DEFAULT 0 NOT NULL, + "canceled_count" integer DEFAULT 0 NOT NULL, + "unknown_finish_count" integer DEFAULT 0 NOT NULL, + "client_error_count" integer DEFAULT 0 NOT NULL, + "gateway_error_count" integer DEFAULT 0 NOT NULL, + "upstream_error_count" integer DEFAULT 0 NOT NULL, + "input_tokens" numeric DEFAULT '0' NOT NULL, + "output_tokens" numeric DEFAULT '0' NOT NULL, + "total_tokens" numeric DEFAULT '0' NOT NULL, + "reasoning_tokens" numeric DEFAULT '0' NOT NULL, + "cached_tokens" numeric DEFAULT '0' NOT NULL, + "cost" real DEFAULT 0 NOT NULL, + "input_cost" real DEFAULT 0 NOT NULL, + "output_cost" real DEFAULT 0 NOT NULL, + "request_cost" real DEFAULT 0 NOT NULL, + "data_storage_cost" real DEFAULT 0 NOT NULL, + "service_fee" real DEFAULT 0 NOT NULL, + "discount_savings" real DEFAULT 0 NOT NULL, + CONSTRAINT "api_key_hourly_model_stats_api_key_id_hour_timestamp_used_model_used_provider_unique" UNIQUE("api_key_id","hour_timestamp","used_model","used_provider") +); +--> statement-breakpoint +CREATE INDEX "api_key_hourly_model_stats_api_key_id_hour_timestamp_idx" ON "api_key_hourly_model_stats" ("api_key_id","hour_timestamp");--> statement-breakpoint +CREATE INDEX "api_key_hourly_model_stats_project_id_hour_timestamp_idx" ON "api_key_hourly_model_stats" ("project_id","hour_timestamp");--> statement-breakpoint +CREATE INDEX "api_key_hourly_model_stats_hour_timestamp_idx" ON "api_key_hourly_model_stats" ("hour_timestamp"); \ No newline at end of file diff --git a/packages/db/migrations/meta/1770628946_snapshot.json b/packages/db/migrations/meta/1770628946_snapshot.json new file mode 100644 index 0000000000..9eaef75893 --- /dev/null +++ b/packages/db/migrations/meta/1770628946_snapshot.json @@ -0,0 +1,10232 @@ +{ + "version": "8", + "dialect": "postgres", + "id": "0ac2d985-176c-447b-8fbb-0dbec9d81215", + "prevId": "b164a584-d4d6-4605-a745-ad96d8c22067", + "ddl": [ + { + "isRlsEnabled": false, + "name": "account", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key_hourly_model_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key_hourly_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key_iam_rule", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "audit_log", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "chat", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_config", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_rule", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_violation", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "installation", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "lock", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "log", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "message", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_history", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_provider_mapping", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_provider_mapping_history", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "organization", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "organization_action", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "passkey", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "payment_method", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project_hourly_model_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project_hourly_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "provider", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "provider_key", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "referral", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "session", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "transaction", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "user", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "user_organization", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "verification", + "entityType": "tables", + "schema": "public" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "account_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "access_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refresh_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "access_token_expires_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refresh_token_expires_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "scope", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "password", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "usage_limit", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "usage", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_by", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_provider", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_type", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_value", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "action", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_type", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "title", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "web_search", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "true", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "enabled", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'{\"prompt_injection\":{\"enabled\":true,\"action\":\"block\"},\"jailbreak\":{\"enabled\":true,\"action\":\"block\"},\"pii_detection\":{\"enabled\":true,\"action\":\"redact\"},\"secrets\":{\"enabled\":true,\"action\":\"block\"},\"file_types\":{\"enabled\":true,\"action\":\"block\"},\"document_leakage\":{\"enabled\":false,\"action\":\"warn\"}}'" + }, + "generated": null, + "identity": null, + "name": "system_rules", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "10", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "max_file_size_mb", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 1, + "default": { + "value": "'{image/jpeg,image/png,image/gif,image/webp}'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "allowed_file_types", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'redact'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "pii_action", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "config", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "100", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "priority", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "true", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "enabled", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'block'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "action", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "log_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_name", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "category", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "action_taken", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "matched_pattern", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "matched_content", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content_hash", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "uuid", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "key", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "duration", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "requested_model", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "requested_provider", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model_mapping", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_provider", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "response_size", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_content", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tool_choice", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tool_results", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "finish_reason", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "unified_finish_reason", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "prompt_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "completion_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "messages", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "temperature", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "max_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "top_p", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "frequency_penalty", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "presence_penalty", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_effort", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "effort", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "response_format", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "has_error", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "error_details", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_input_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "web_search_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "estimated_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "discount", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "pricing_tier", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "mode", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_mode", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "source", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "custom_headers", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "routing_metadata", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "processed_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_aggregated_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "raw_request", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "raw_response", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "upstream_request", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "upstream_response", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trace_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_retention_cleaned_up", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "params", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_agent", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plugins", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plugin_results", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "chat_id", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "images", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "sequence", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "released_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'(empty)'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'[]'" + }, + "generated": null, + "identity": null, + "name": "aliases", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'(empty)'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "family", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "free", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'[\"text\"]'" + }, + "generated": null, + "identity": null, + "name": "output", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'stable'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "stability", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "minute_timestamp", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_input_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_output_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_duration", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_name", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "output_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "context_size", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "max_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streaming", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "vision", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "json_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "json_output_schema", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "web_search", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "web_search_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'stable'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "stability", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "supported_parameters", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "test", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deprecated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deactivated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_provider_mapping_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "minute_timestamp", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_input_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_output_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_duration", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_email", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_company", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_address", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_tax_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_notes", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_customer_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_subscription_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_enabled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'10'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_threshold", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'10'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_amount", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'free'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "plan", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plan_expires_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "subscription_cancelled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trial_start_date", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trial_end_date", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_trial_active", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'none'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "retention_level", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "referral_earnings", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "payment_failure_count", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_payment_failure_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_personal", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'none'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_credits_used", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_credits_limit", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_billing_cycle_start", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_stripe_subscription_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_cancelled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_expires_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_allow_all_models", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "amount", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "public_key", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "credential_id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "counter", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "device_type", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "backed_up", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "transports", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_payment_method_id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_default", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "caching_enabled", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "60", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_duration_seconds", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'hybrid'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "mode", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_provider", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "streaming", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cancellation", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "color", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "website", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "announcement", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "base_url", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "options", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "referrer_organization_id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "referred_organization_id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ip_address", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_agent", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "amount", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "credit_amount", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'USD'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "currency", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'completed'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_payment_intent_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_invoice_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "related_transaction_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refund_reason", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "email", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "email_verified", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "onboarding_completed", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'owner'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "identifier", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "value", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "account_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_project_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_by", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_created_by_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_model_stats_api_key_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_model_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_model_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_api_key_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_api_key_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "rule_type", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_rule_type_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_api_key_id_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_organization_id_created_at_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "action", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_action_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "resource_type", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_resource_type_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "chat_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "chat" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_config_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_config" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_rule_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "priority", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_rule_priority_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_violation_org_created_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "rule_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_violation_rule_created_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_project_id_created_at_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_model", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_provider", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_created_at_used_model_used_provider_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "data_retention_cleaned_up = false", + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_data_retention_pending_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_model", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_project_id_used_model_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "processed_at IS NULL", + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_processed_at_null_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "stats_aggregated_at IS NULL", + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_stats_aggregated_at_null_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "chat_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "message_chat_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "message" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "model" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_history_minute_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "provider_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_provider_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "model_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_model_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "organization_action_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "organization_action" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "passkey_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "passkey" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "payment_method_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "payment_method" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "project" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_model_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_model_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "provider_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "provider" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "provider_key_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "referrer_organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "referral_referrer_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "referred_organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "referral_referred_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "session_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "session" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "transaction_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "transaction" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "user_organization_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "user_organization_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "account_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": false, + "columns": [ + "project_id" + ], + "schemaTo": "public", + "tableTo": "project", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_project_id_project_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": false, + "columns": [ + "created_by" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_created_by_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": false, + "columns": [ + "api_key_id" + ], + "schemaTo": "public", + "tableTo": "api_key", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_iam_rule_api_key_id_api_key_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "audit_log_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "audit_log_user_id_user_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "chat_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "chat" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_config_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_config" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_rule_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_violation_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": false, + "columns": [ + "chat_id" + ], + "schemaTo": "public", + "tableTo": "chat", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "message_chat_id_chat_id_fk", + "entityType": "fks", + "schema": "public", + "table": "message" + }, + { + "nameExplicit": false, + "columns": [ + "model_id" + ], + "schemaTo": "public", + "tableTo": "model", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "model_provider_mapping_model_id_model_id_fk", + "entityType": "fks", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "provider_id" + ], + "schemaTo": "public", + "tableTo": "provider", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "model_provider_mapping_provider_id_provider_id_fk", + "entityType": "fks", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "organization_action_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "organization_action" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "passkey_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "passkey" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "payment_method_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "payment_method" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "project_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "project" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "provider_key_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": false, + "columns": [ + "referrer_organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "referral_referrer_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": false, + "columns": [ + "referred_organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "referral_referred_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "session_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "session" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "transaction_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "transaction" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "user_organization_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "user_organization_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "user_organization" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "account_pkey", + "schema": "public", + "table": "account", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_pkey", + "schema": "public", + "table": "api_key", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_hourly_model_stats_pkey", + "schema": "public", + "table": "api_key_hourly_model_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_hourly_stats_pkey", + "schema": "public", + "table": "api_key_hourly_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_iam_rule_pkey", + "schema": "public", + "table": "api_key_iam_rule", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "audit_log_pkey", + "schema": "public", + "table": "audit_log", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "chat_pkey", + "schema": "public", + "table": "chat", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_config_pkey", + "schema": "public", + "table": "guardrail_config", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_rule_pkey", + "schema": "public", + "table": "guardrail_rule", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_violation_pkey", + "schema": "public", + "table": "guardrail_violation", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "installation_pkey", + "schema": "public", + "table": "installation", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "lock_pkey", + "schema": "public", + "table": "lock", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "log_pkey", + "schema": "public", + "table": "log", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "message_pkey", + "schema": "public", + "table": "message", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_pkey", + "schema": "public", + "table": "model", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_history_pkey", + "schema": "public", + "table": "model_history", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_provider_mapping_pkey", + "schema": "public", + "table": "model_provider_mapping", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_provider_mapping_history_pkey", + "schema": "public", + "table": "model_provider_mapping_history", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "organization_pkey", + "schema": "public", + "table": "organization", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "organization_action_pkey", + "schema": "public", + "table": "organization_action", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "passkey_pkey", + "schema": "public", + "table": "passkey", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "payment_method_pkey", + "schema": "public", + "table": "payment_method", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_pkey", + "schema": "public", + "table": "project", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_hourly_model_stats_pkey", + "schema": "public", + "table": "project_hourly_model_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_hourly_stats_pkey", + "schema": "public", + "table": "project_hourly_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "provider_pkey", + "schema": "public", + "table": "provider", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "provider_key_pkey", + "schema": "public", + "table": "provider_key", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "referral_pkey", + "schema": "public", + "table": "referral", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "session_pkey", + "schema": "public", + "table": "session", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "transaction_pkey", + "schema": "public", + "table": "transaction", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "user_pkey", + "schema": "public", + "table": "user", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "user_organization_pkey", + "schema": "public", + "table": "user_organization", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "verification_pkey", + "schema": "public", + "table": "verification", + "entityType": "pks" + }, + { + "nameExplicit": false, + "columns": [ + "api_key_id", + "hour_timestamp", + "used_model", + "used_provider" + ], + "nullsNotDistinct": false, + "name": "api_key_hourly_model_stats_api_key_id_hour_timestamp_used_model_used_provider_unique", + "entityType": "uniques", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": false, + "columns": [ + "api_key_id", + "hour_timestamp" + ], + "nullsNotDistinct": false, + "name": "api_key_hourly_stats_api_key_id_hour_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": false, + "columns": [ + "model_id", + "minute_timestamp" + ], + "nullsNotDistinct": false, + "name": "model_history_model_id_minute_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_history" + }, + { + "nameExplicit": false, + "columns": [ + "model_id", + "provider_id" + ], + "nullsNotDistinct": false, + "name": "model_provider_mapping_model_id_provider_id_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "model_provider_mapping_id", + "minute_timestamp" + ], + "nullsNotDistinct": false, + "name": "model_provider_mapping_history_model_provider_mapping_id_minute_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": false, + "columns": [ + "project_id", + "hour_timestamp", + "used_model", + "used_provider" + ], + "nullsNotDistinct": false, + "name": "project_hourly_model_stats_project_id_hour_timestamp_used_model_used_provider_unique", + "entityType": "uniques", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": false, + "columns": [ + "project_id", + "hour_timestamp" + ], + "nullsNotDistinct": false, + "name": "project_hourly_stats_project_id_hour_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id", + "name" + ], + "nullsNotDistinct": false, + "name": "provider_key_organization_id_name_unique", + "entityType": "uniques", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": false, + "columns": [ + "token" + ], + "nullsNotDistinct": false, + "name": "api_key_token_unique", + "schema": "public", + "table": "api_key", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "nullsNotDistinct": false, + "name": "guardrail_config_organization_id_key", + "schema": "public", + "table": "guardrail_config", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "uuid" + ], + "nullsNotDistinct": false, + "name": "installation_uuid_unique", + "schema": "public", + "table": "installation", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "key" + ], + "nullsNotDistinct": false, + "name": "lock_key_unique", + "schema": "public", + "table": "lock", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "stripe_customer_id" + ], + "nullsNotDistinct": false, + "name": "organization_stripe_customer_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "stripe_subscription_id" + ], + "nullsNotDistinct": false, + "name": "organization_stripe_subscription_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "dev_plan_stripe_subscription_id" + ], + "nullsNotDistinct": false, + "name": "organization_dev_plan_stripe_subscription_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "referred_organization_id" + ], + "nullsNotDistinct": false, + "name": "referral_referred_organization_id_key", + "schema": "public", + "table": "referral", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "token" + ], + "nullsNotDistinct": false, + "name": "session_token_unique", + "schema": "public", + "table": "session", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "email" + ], + "nullsNotDistinct": false, + "name": "user_email_unique", + "schema": "public", + "table": "user", + "entityType": "uniques" + } + ], + "renames": [] +} \ No newline at end of file diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index f03c56ea11..c00afca241 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -631,6 +631,13 @@ "when": 1770620423341, "tag": "1770620423_eager_big_bertha", "breakpoints": true + }, + { + "idx": 90, + "version": "8", + "when": 1770628946192, + "tag": "1770628946_spotty_iron_lad", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts index 888043df35..826773c935 100644 --- a/packages/db/src/schema.ts +++ b/packages/db/src/schema.ts @@ -1180,13 +1180,8 @@ export const projectHourlyStats = pgTable( discountSavings: real().notNull().default(0), }, (table) => [ - // Unique constraint for one record per project-hour + // Unique constraint for one record per project-hour (also creates implicit index) unique().on(table.projectId, table.hourTimestamp), - // Index for dashboard queries (project + time range) - index("project_hourly_stats_project_id_hour_timestamp_idx").on( - table.projectId, - table.hourTimestamp, - ), // Index for worker refresh queries (find hours to update) index("project_hourly_stats_hour_timestamp_idx").on(table.hourTimestamp), ], @@ -1320,3 +1315,75 @@ export const apiKeyHourlyStats = pgTable( index("api_key_hourly_stats_hour_timestamp_idx").on(table.hourTimestamp), ], ); + +// API key hourly model statistics aggregation - model breakdown per API key per hour +export const apiKeyHourlyModelStats = pgTable( + "api_key_hourly_model_stats", + { + id: text().primaryKey().notNull().$defaultFn(shortid), + createdAt: timestamp().notNull().defaultNow(), + updatedAt: timestamp() + .notNull() + .defaultNow() + .$onUpdate(() => new Date()), + apiKeyId: text().notNull(), + projectId: text().notNull(), // Denormalized for efficient queries + hourTimestamp: timestamp().notNull(), // Start of the hour bucket + usedModel: text().notNull(), + usedProvider: text().notNull(), + // Request counts + requestCount: integer().notNull().default(0), + errorCount: integer().notNull().default(0), + cacheCount: integer().notNull().default(0), + streamedCount: integer().notNull().default(0), + nonStreamedCount: integer().notNull().default(0), + // Unified finish reason counts + completedCount: integer().notNull().default(0), + lengthLimitCount: integer().notNull().default(0), + contentFilterCount: integer().notNull().default(0), + toolCallsCount: integer().notNull().default(0), + canceledCount: integer().notNull().default(0), + unknownFinishCount: integer().notNull().default(0), + // Error type counts (subset of errorCount) + clientErrorCount: integer().notNull().default(0), + gatewayErrorCount: integer().notNull().default(0), + upstreamErrorCount: integer().notNull().default(0), + // Token counts + inputTokens: decimal().notNull().default("0"), + outputTokens: decimal().notNull().default("0"), + totalTokens: decimal().notNull().default("0"), + reasoningTokens: decimal().notNull().default("0"), + cachedTokens: decimal().notNull().default("0"), + // Costs + cost: real().notNull().default(0), + inputCost: real().notNull().default(0), + outputCost: real().notNull().default(0), + requestCost: real().notNull().default(0), + dataStorageCost: real().notNull().default(0), + serviceFee: real().notNull().default(0), + discountSavings: real().notNull().default(0), + }, + (table) => [ + // Unique constraint for one record per api-key-hour-model-provider + unique().on( + table.apiKeyId, + table.hourTimestamp, + table.usedModel, + table.usedProvider, + ), + // Index for dashboard queries (api key + time range) + index("api_key_hourly_model_stats_api_key_id_hour_timestamp_idx").on( + table.apiKeyId, + table.hourTimestamp, + ), + // Index for project-level queries (all keys in a project) + index("api_key_hourly_model_stats_project_id_hour_timestamp_idx").on( + table.projectId, + table.hourTimestamp, + ), + // Index for worker refresh queries + index("api_key_hourly_model_stats_hour_timestamp_idx").on( + table.hourTimestamp, + ), + ], +); From 28eaa809a752400d057b4171542c21eab4e3af9d Mon Sep 17 00:00:00 2001 From: steebchen Date: Mon, 9 Feb 2026 10:45:40 +0000 Subject: [PATCH 13/24] refactor(admin): use aggregation tables for org metrics, remove lazy loading - Refactor admin API /organizations/{orgId} endpoint to query from projectHourlyStats and projectHourlyModelStats instead of scanning the log table directly - Remove "Load Usage Data" button and lazy-loading logic since queries are now fast due to pre-aggregated data - Auto-load metrics on component mount Co-Authored-By: Claude Opus 4.5 --- .../app/organizations/[orgId]/org-metrics.tsx | 48 ++++------ apps/api/src/routes/admin.ts | 93 ++++++++++++------- 2 files changed, 77 insertions(+), 64 deletions(-) diff --git a/apps/admin/src/app/organizations/[orgId]/org-metrics.tsx b/apps/admin/src/app/organizations/[orgId]/org-metrics.tsx index dc070c94ef..46044d9633 100644 --- a/apps/admin/src/app/organizations/[orgId]/org-metrics.tsx +++ b/apps/admin/src/app/organizations/[orgId]/org-metrics.tsx @@ -7,7 +7,7 @@ import { Loader2, Server, } from "lucide-react"; -import { useCallback, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import { Button } from "@/components/ui/button"; import { @@ -90,7 +90,7 @@ function MetricCard({ export function OrgMetricsSection({ orgId }: { orgId: string }) { const [metrics, setMetrics] = useState(null); - const [loading, setLoading] = useState(false); + const [loading, setLoading] = useState(true); const [window, setWindow] = useState("1d"); const loadMetrics = useCallback( @@ -103,35 +103,14 @@ export function OrgMetricsSection({ orgId }: { orgId: string }) { [orgId], ); - const handleWindowChange = useCallback( - (w: TokenWindow) => { - setWindow(w); - loadMetrics(w); - }, - [loadMetrics], - ); + // Load metrics automatically on mount + useEffect(() => { + loadMetrics(window); + }, [loadMetrics, window]); - if (!metrics && !loading) { - return ( -
-
-

Usage Metrics

- -
-
- Click "Load Usage Data" to fetch usage metrics. This queries - the logs table which may be slow for orgs with lots of data. -
-
- ); - } + const handleWindowChange = useCallback((w: TokenWindow) => { + setWindow(w); + }, []); if (loading) { return ( @@ -146,7 +125,14 @@ export function OrgMetricsSection({ orgId }: { orgId: string }) { } if (!metrics) { - return null; + return ( +
+

Usage Metrics

+
+ No usage data available. +
+
+ ); } const windowLabel = window === "7d" ? "Last 7 days" : "Last 24 hours"; diff --git a/apps/api/src/routes/admin.ts b/apps/api/src/routes/admin.ts index e091072e64..c279b367c3 100644 --- a/apps/api/src/routes/admin.ts +++ b/apps/api/src/routes/admin.ts @@ -16,6 +16,8 @@ import { or, sql, tables, + projectHourlyStats, + projectHourlyModelStats, } from "@llmgateway/db"; import type { ServerTypes } from "@/vars.js"; @@ -467,62 +469,87 @@ admin.openapi(getOrganizationMetrics, async (c) => { let mostUsedModelCost = 0; if (projectIds.length > 0) { - const rows = await db + // Query aggregated project stats for totals + const [totals] = await db .select({ - usedModel: tables.log.usedModel, - usedProvider: tables.log.usedProvider, - requestsCount: sql`COUNT(*)`.as("requestsCount"), + totalRequests: + sql`COALESCE(SUM(${projectHourlyStats.requestCount}), 0)`.as( + "totalRequests", + ), inputTokens: - sql`COALESCE(SUM(CAST(${tables.log.promptTokens} AS INTEGER)), 0)`.as( + sql`COALESCE(SUM(CAST(${projectHourlyStats.inputTokens} AS INTEGER)), 0)`.as( "inputTokens", ), outputTokens: - sql`COALESCE(SUM(CAST(${tables.log.completionTokens} AS INTEGER)), 0)`.as( + sql`COALESCE(SUM(CAST(${projectHourlyStats.outputTokens} AS INTEGER)), 0)`.as( "outputTokens", ), cachedTokens: - sql`COALESCE(SUM(CAST(${tables.log.cachedTokens} AS INTEGER)), 0)`.as( + sql`COALESCE(SUM(CAST(${projectHourlyStats.cachedTokens} AS INTEGER)), 0)`.as( "cachedTokens", ), totalTokens: - sql`COALESCE(SUM(CAST(${tables.log.totalTokens} AS INTEGER)), 0)`.as( + sql`COALESCE(SUM(CAST(${projectHourlyStats.totalTokens} AS INTEGER)), 0)`.as( "totalTokens", ), - totalCost: sql`COALESCE(SUM(${tables.log.cost}), 0)`.as( + totalCost: sql`COALESCE(SUM(${projectHourlyStats.cost}), 0)`.as( "totalCost", ), - inputCost: sql`COALESCE(SUM(${tables.log.inputCost}), 0)`.as( - "inputCost", - ), - outputCost: sql`COALESCE(SUM(${tables.log.outputCost}), 0)`.as( - "outputCost", + inputCost: + sql`COALESCE(SUM(${projectHourlyStats.inputCost}), 0)`.as( + "inputCost", + ), + outputCost: + sql`COALESCE(SUM(${projectHourlyStats.outputCost}), 0)`.as( + "outputCost", + ), + }) + .from(projectHourlyStats) + .where( + and( + inArray(projectHourlyStats.projectId, projectIds), + gte(projectHourlyStats.hourTimestamp, startDate), + lt(projectHourlyStats.hourTimestamp, now), ), - cachedCost: - sql`COALESCE(SUM(${tables.log.cachedInputCost}), 0)`.as( - "cachedCost", + ); + + if (totals) { + totalRequests = Number(totals.totalRequests) || 0; + totalTokens = Number(totals.totalTokens) || 0; + totalCost = Number(totals.totalCost) || 0; + inputTokens = Number(totals.inputTokens) || 0; + inputCost = Number(totals.inputCost) || 0; + outputTokens = Number(totals.outputTokens) || 0; + outputCost = Number(totals.outputCost) || 0; + cachedTokens = Number(totals.cachedTokens) || 0; + // cachedCost is not stored in aggregation tables, estimate from cachedTokens + cachedCost = 0; + } + + // Query model stats for most used model (by cost) + const modelRows = await db + .select({ + usedModel: projectHourlyModelStats.usedModel, + usedProvider: projectHourlyModelStats.usedProvider, + totalCost: + sql`COALESCE(SUM(${projectHourlyModelStats.cost}), 0)`.as( + "totalCost", ), }) - .from(tables.log) + .from(projectHourlyModelStats) .where( and( - inArray(tables.log.projectId, projectIds), - gte(tables.log.createdAt, startDate), - lt(tables.log.createdAt, now), + inArray(projectHourlyModelStats.projectId, projectIds), + gte(projectHourlyModelStats.hourTimestamp, startDate), + lt(projectHourlyModelStats.hourTimestamp, now), ), ) - .groupBy(tables.log.usedModel, tables.log.usedProvider); - - for (const row of rows) { - totalRequests += Number(row.requestsCount) || 0; - totalTokens += Number(row.totalTokens) || 0; - totalCost += Number(row.totalCost) || 0; - inputTokens += Number(row.inputTokens) || 0; - inputCost += Number(row.inputCost) || 0; - outputTokens += Number(row.outputTokens) || 0; - outputCost += Number(row.outputCost) || 0; - cachedTokens += Number(row.cachedTokens) || 0; - cachedCost += Number(row.cachedCost) || 0; + .groupBy( + projectHourlyModelStats.usedModel, + projectHourlyModelStats.usedProvider, + ); + for (const row of modelRows) { const rowCost = Number(row.totalCost) || 0; if (rowCost > mostUsedModelCost) { mostUsedModelCost = rowCost; From 47765e7b65327e23294b408933c946a10e61101e Mon Sep 17 00:00:00 2001 From: steebchen Date: Mon, 9 Feb 2026 11:48:58 +0000 Subject: [PATCH 14/24] feat(stats): sync with main, add image cost fields to aggregation tables - Add imageInputCost and imageOutputCost to all 4 aggregation tables (projectHourlyStats, projectHourlyModelStats, apiKeyHourlyStats, apiKeyHourlyModelStats) to match new fields in log table from main - Update aggregator to use time-based lookback (processRecentLogs) instead of statsAggregatedAt field which was removed from main - Add image cost fields to activity.ts for both apiKeyId and project paths - Add image cost fields to testing.ts helper - Regenerate migrations after syncing with origin/main Co-Authored-By: Claude Opus 4.5 --- apps/api/src/routes/activity.ts | 16 +- apps/api/src/testing.ts | 8 + .../src/services/project-stats-aggregator.ts | 68 +- .../1770637415_dear_speed_demon.sql | 8 + .../migrations/meta/1770637154_snapshot.json | 10447 +++++++++++++++ .../migrations/meta/1770637415_snapshot.json | 10575 ++++++++++++++++ packages/db/migrations/meta/_journal.json | 14 + packages/db/src/schema.ts | 8 + 8 files changed, 21104 insertions(+), 40 deletions(-) create mode 100644 packages/db/migrations/1770637415_dear_speed_demon.sql create mode 100644 packages/db/migrations/meta/1770637154_snapshot.json create mode 100644 packages/db/migrations/meta/1770637415_snapshot.json diff --git a/apps/api/src/routes/activity.ts b/apps/api/src/routes/activity.ts index c357ba2e06..b87015fe92 100644 --- a/apps/api/src/routes/activity.ts +++ b/apps/api/src/routes/activity.ts @@ -188,6 +188,14 @@ activity.openapi(getActivity, async (c) => { sql`COALESCE(SUM(${apiKeyHourlyStats.discountSavings}), 0)`.as( "discountSavings", ), + imageInputCost: + sql`COALESCE(SUM(${apiKeyHourlyStats.imageInputCost}), 0)`.as( + "imageInputCost", + ), + imageOutputCost: + sql`COALESCE(SUM(${apiKeyHourlyStats.imageOutputCost}), 0)`.as( + "imageOutputCost", + ), }) .from(apiKeyHourlyStats) .where( @@ -218,6 +226,8 @@ activity.openapi(getActivity, async (c) => { const errorCount = Number(day.errorCount); const cacheCount = Number(day.cacheCount); const discountSavings = Number(day.discountSavings); + const imageInputCost = Number(day.imageInputCost); + const imageOutputCost = Number(day.imageOutputCost); const errorRate = requestCount > 0 ? (errorCount / requestCount) * 100 : 0; @@ -235,6 +245,8 @@ activity.openapi(getActivity, async (c) => { outputCost, requestCost, dataStorageCost, + imageInputCost, + imageOutputCost, errorCount, errorRate, cacheCount, @@ -290,11 +302,11 @@ activity.openapi(getActivity, async (c) => { "dataStorageCost", ), imageInputCost: - sql`COALESCE(SUM(${tables.log.imageInputCost}), 0)`.as( + sql`COALESCE(SUM(${projectHourlyStats.imageInputCost}), 0)`.as( "imageInputCost", ), imageOutputCost: - sql`COALESCE(SUM(${tables.log.imageOutputCost}), 0)`.as( + sql`COALESCE(SUM(${projectHourlyStats.imageOutputCost}), 0)`.as( "imageOutputCost", ), errorCount: diff --git a/apps/api/src/testing.ts b/apps/api/src/testing.ts index 6a2140fb8a..e6b4517e48 100644 --- a/apps/api/src/testing.ts +++ b/apps/api/src/testing.ts @@ -170,6 +170,14 @@ function getCommonAggregationFields() { ), 0 )`.as("discountSavings"), + imageInputCost: + sql`coalesce(sum(${tables.log.imageInputCost}), 0)`.as( + "imageInputCost", + ), + imageOutputCost: + sql`coalesce(sum(${tables.log.imageOutputCost}), 0)`.as( + "imageOutputCost", + ), }; } diff --git a/apps/worker/src/services/project-stats-aggregator.ts b/apps/worker/src/services/project-stats-aggregator.ts index 6986561883..922c2058c5 100644 --- a/apps/worker/src/services/project-stats-aggregator.ts +++ b/apps/worker/src/services/project-stats-aggregator.ts @@ -9,7 +9,6 @@ import { gte, lt, and, - isNull, } from "@llmgateway/db"; import { logger } from "@llmgateway/logger"; @@ -149,6 +148,12 @@ function getCommonAggregationFields() { ), 0 )`.as("discountSavings"), + imageInputCost: sql`coalesce(sum(${log.imageInputCost}), 0)`.as( + "imageInputCost", + ), + imageOutputCost: sql`coalesce(sum(${log.imageOutputCost}), 0)`.as( + "imageOutputCost", + ), }; } @@ -345,18 +350,22 @@ async function recalculateApiKeyHourlyModelStats( } /** - * Process unprocessed logs and update aggregation tables + * Process logs from recent hours that may not have aggregation data yet. + * Scans the last 24 hours and creates/updates aggregation rows as needed. */ -export async function processUnprocessedLogs() { +export async function processRecentLogs() { const database = db; - const now = new Date(); const currentHourStart = getCurrentHourStart(); + // Look back 24 hours for any project-hour buckets that need processing + const lookbackStart = new Date( + currentHourStart.getTime() - 24 * 60 * 60 * 1000, + ); - logger.debug("Processing unprocessed logs for stats aggregation..."); + logger.debug("Processing recent logs for stats aggregation..."); try { - // Find distinct project-hour combinations that have unprocessed logs - const unprocessedBuckets = await database + // Find distinct project-hour combinations from recent logs (excluding current hour) + const recentBuckets = await database .select({ projectId: log.projectId, hourTimestamp: sql`date_trunc('hour', ${log.createdAt})`.as( @@ -365,64 +374,47 @@ export async function processUnprocessedLogs() { }) .from(log) .where( - and(isNull(log.statsAggregatedAt), lt(log.createdAt, currentHourStart)), + and( + gte(log.createdAt, lookbackStart), + lt(log.createdAt, currentHourStart), + ), ) .groupBy(log.projectId, sql`date_trunc('hour', ${log.createdAt})`) .limit(100); - if (unprocessedBuckets.length === 0) { - logger.debug("No unprocessed logs found for stats aggregation"); - return { bucketsProcessed: 0, logsMarked: 0 }; + if (recentBuckets.length === 0) { + logger.debug("No recent logs found for stats aggregation"); + return { bucketsProcessed: 0 }; } logger.info( - `Found ${unprocessedBuckets.length} project-hour buckets with unprocessed logs`, + `Found ${recentBuckets.length} project-hour buckets to process`, ); - let totalLogsMarked = 0; - - for (const bucket of unprocessedBuckets) { + for (const bucket of recentBuckets) { const hourTimestamp = new Date(bucket.hourTimestamp); - const hourEnd = new Date(hourTimestamp.getTime() + 60 * 60 * 1000); - // Recalculate all aggregation tables + // Recalculate all aggregation tables for this bucket await recalculateProjectHourlyStats(bucket.projectId, hourTimestamp); await recalculateProjectHourlyModelStats(bucket.projectId, hourTimestamp); await recalculateApiKeyHourlyStats(bucket.projectId, hourTimestamp); await recalculateApiKeyHourlyModelStats(bucket.projectId, hourTimestamp); - // Mark logs as processed - const result = await database - .update(log) - .set({ statsAggregatedAt: now }) - .where( - and( - sql`${log.projectId} = ${bucket.projectId}`, - gte(log.createdAt, hourTimestamp), - lt(log.createdAt, hourEnd), - isNull(log.statsAggregatedAt), - ), - ); - - const affectedRows = Array.isArray(result) ? result.length : 0; - totalLogsMarked += affectedRows; - logger.debug( `Processed bucket ${bucket.projectId}/${hourTimestamp.toISOString()}`, ); } logger.info( - `Stats aggregation complete: ${unprocessedBuckets.length} buckets processed`, + `Stats aggregation complete: ${recentBuckets.length} buckets processed`, ); return { - bucketsProcessed: unprocessedBuckets.length, - logsMarked: totalLogsMarked, + bucketsProcessed: recentBuckets.length, }; } catch (error) { logger.error( - "Error processing unprocessed logs for stats aggregation", + "Error processing recent logs for stats aggregation", error instanceof Error ? error : new Error(String(error)), ); throw error; @@ -475,7 +467,7 @@ export async function refreshProjectHourlyStats() { logger.debug("Starting project hourly stats refresh..."); try { - await processUnprocessedLogs(); + await processRecentLogs(); await refreshCurrentHourStats(); logger.debug("Project hourly stats refresh complete"); } catch (error) { diff --git a/packages/db/migrations/1770637415_dear_speed_demon.sql b/packages/db/migrations/1770637415_dear_speed_demon.sql new file mode 100644 index 0000000000..ba1c2d6840 --- /dev/null +++ b/packages/db/migrations/1770637415_dear_speed_demon.sql @@ -0,0 +1,8 @@ +ALTER TABLE "api_key_hourly_model_stats" ADD COLUMN "image_input_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "api_key_hourly_model_stats" ADD COLUMN "image_output_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "api_key_hourly_stats" ADD COLUMN "image_input_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "api_key_hourly_stats" ADD COLUMN "image_output_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "project_hourly_model_stats" ADD COLUMN "image_input_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "project_hourly_model_stats" ADD COLUMN "image_output_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "project_hourly_stats" ADD COLUMN "image_input_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "project_hourly_stats" ADD COLUMN "image_output_cost" real DEFAULT 0 NOT NULL; \ No newline at end of file diff --git a/packages/db/migrations/meta/1770637154_snapshot.json b/packages/db/migrations/meta/1770637154_snapshot.json new file mode 100644 index 0000000000..be2abe33d4 --- /dev/null +++ b/packages/db/migrations/meta/1770637154_snapshot.json @@ -0,0 +1,10447 @@ +{ + "version": "8", + "dialect": "postgres", + "id": "742ab22b-3f9b-4cad-935e-83c05956fed5", + "prevId": "e5fcbbc1-a429-4cb2-9b9d-329dc6387ffc", + "ddl": [ + { + "isRlsEnabled": false, + "name": "account", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key_hourly_model_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key_hourly_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key_iam_rule", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "audit_log", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "chat", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "discount", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_config", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_rule", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_violation", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "installation", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "lock", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "log", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "message", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_history", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_provider_mapping", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_provider_mapping_history", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "organization", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "organization_action", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "passkey", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "payment_method", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project_hourly_model_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project_hourly_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "provider", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "provider_key", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "referral", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "session", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "transaction", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "user", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "user_organization", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "verification", + "entityType": "tables", + "schema": "public" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "account_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "access_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refresh_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "access_token_expires_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refresh_token_expires_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "scope", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "password", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "usage_limit", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "usage", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_by", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_provider", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_type", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_value", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "action", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_type", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "title", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "web_search", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "discount_percent", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reason", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "true", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "enabled", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'{\"prompt_injection\":{\"enabled\":true,\"action\":\"block\"},\"jailbreak\":{\"enabled\":true,\"action\":\"block\"},\"pii_detection\":{\"enabled\":true,\"action\":\"redact\"},\"secrets\":{\"enabled\":true,\"action\":\"block\"},\"file_types\":{\"enabled\":true,\"action\":\"block\"},\"document_leakage\":{\"enabled\":false,\"action\":\"warn\"}}'" + }, + "generated": null, + "identity": null, + "name": "system_rules", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "10", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "max_file_size_mb", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 1, + "default": { + "value": "'{image/jpeg,image/png,image/gif,image/webp}'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "allowed_file_types", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'redact'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "pii_action", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "config", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "100", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "priority", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "true", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "enabled", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'block'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "action", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "log_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_name", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "category", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "action_taken", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "matched_pattern", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "matched_content", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content_hash", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "uuid", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "key", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "duration", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "requested_model", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "requested_provider", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model_mapping", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_provider", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "response_size", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_content", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tool_choice", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tool_results", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "finish_reason", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "unified_finish_reason", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "prompt_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "completion_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "messages", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "temperature", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "max_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "top_p", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "frequency_penalty", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "presence_penalty", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_effort", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "effort", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "response_format", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "has_error", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "error_details", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_input_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "web_search_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_input_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_output_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_input_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_output_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "estimated_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "discount", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "pricing_tier", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "mode", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_mode", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "source", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "custom_headers", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "routing_metadata", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "processed_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "raw_request", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "raw_response", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "upstream_request", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "upstream_response", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trace_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_retention_cleaned_up", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "params", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_agent", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plugins", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plugin_results", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "chat_id", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "images", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "sequence", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "released_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'(empty)'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'[]'" + }, + "generated": null, + "identity": null, + "name": "aliases", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'(empty)'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "family", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "free", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'[\"text\"]'" + }, + "generated": null, + "identity": null, + "name": "output", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'stable'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "stability", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "minute_timestamp", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_input_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_output_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_duration", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_name", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "output_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "context_size", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "max_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streaming", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "vision", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "json_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "json_output_schema", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "web_search", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "web_search_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'stable'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "stability", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "supported_parameters", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "test", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deprecated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deactivated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_provider_mapping_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "minute_timestamp", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_input_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_output_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_duration", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_email", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_company", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_address", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_tax_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_notes", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_customer_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_subscription_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_enabled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'10'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_threshold", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'10'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_amount", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'free'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "plan", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plan_expires_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "subscription_cancelled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trial_start_date", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trial_end_date", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_trial_active", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'none'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "retention_level", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "referral_earnings", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "payment_failure_count", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_payment_failure_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_personal", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'none'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_credits_used", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_credits_limit", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_billing_cycle_start", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_stripe_subscription_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_cancelled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_expires_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_allow_all_models", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "amount", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "public_key", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "credential_id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "counter", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "device_type", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "backed_up", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "transports", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_payment_method_id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_default", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "caching_enabled", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "60", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_duration_seconds", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'hybrid'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "mode", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_provider", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "streaming", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cancellation", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "color", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "website", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "announcement", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "base_url", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "options", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "referrer_organization_id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "referred_organization_id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ip_address", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_agent", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "amount", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "credit_amount", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'USD'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "currency", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'completed'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_payment_intent_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_invoice_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "related_transaction_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refund_reason", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "email", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "email_verified", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "onboarding_completed", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'owner'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "identifier", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "value", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "account_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_project_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_by", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_created_by_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_model_stats_api_key_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_model_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_model_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_api_key_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_api_key_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "rule_type", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_rule_type_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_api_key_id_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_organization_id_created_at_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "action", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_action_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "resource_type", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_resource_type_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "chat_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "chat" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "discount_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "provider", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "discount_provider_idx", + "entityType": "indexes", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "model", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "discount_model_idx", + "entityType": "indexes", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_config_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_config" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_rule_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "priority", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_rule_priority_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_violation_org_created_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "rule_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_violation_rule_created_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_project_id_created_at_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_model", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_provider", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_created_at_used_model_used_provider_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "data_retention_cleaned_up = false", + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_data_retention_pending_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_model", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_project_id_used_model_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "processed_at IS NULL", + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_processed_at_null_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "chat_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "message_chat_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "message" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "model" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_history_minute_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "provider_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_provider_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "model_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_model_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "organization_action_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "organization_action" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "passkey_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "passkey" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "payment_method_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "payment_method" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "project" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_model_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_model_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "provider_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "provider" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "provider_key_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "referrer_organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "referral_referrer_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "referred_organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "referral_referred_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "session_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "session" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "transaction_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "transaction" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "user_organization_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "user_organization_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "account_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": false, + "columns": [ + "project_id" + ], + "schemaTo": "public", + "tableTo": "project", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_project_id_project_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": false, + "columns": [ + "created_by" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_created_by_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": false, + "columns": [ + "api_key_id" + ], + "schemaTo": "public", + "tableTo": "api_key", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_iam_rule_api_key_id_api_key_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "audit_log_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "audit_log_user_id_user_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "chat_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "chat" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "discount_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_config_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_config" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_rule_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_violation_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": false, + "columns": [ + "chat_id" + ], + "schemaTo": "public", + "tableTo": "chat", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "message_chat_id_chat_id_fk", + "entityType": "fks", + "schema": "public", + "table": "message" + }, + { + "nameExplicit": false, + "columns": [ + "model_id" + ], + "schemaTo": "public", + "tableTo": "model", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "model_provider_mapping_model_id_model_id_fk", + "entityType": "fks", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "provider_id" + ], + "schemaTo": "public", + "tableTo": "provider", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "model_provider_mapping_provider_id_provider_id_fk", + "entityType": "fks", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "organization_action_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "organization_action" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "passkey_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "passkey" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "payment_method_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "payment_method" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "project_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "project" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "provider_key_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": false, + "columns": [ + "referrer_organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "referral_referrer_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": false, + "columns": [ + "referred_organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "referral_referred_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "session_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "session" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "transaction_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "transaction" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "user_organization_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "user_organization_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "user_organization" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "account_pkey", + "schema": "public", + "table": "account", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_pkey", + "schema": "public", + "table": "api_key", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_hourly_model_stats_pkey", + "schema": "public", + "table": "api_key_hourly_model_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_hourly_stats_pkey", + "schema": "public", + "table": "api_key_hourly_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_iam_rule_pkey", + "schema": "public", + "table": "api_key_iam_rule", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "audit_log_pkey", + "schema": "public", + "table": "audit_log", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "chat_pkey", + "schema": "public", + "table": "chat", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "discount_pkey", + "schema": "public", + "table": "discount", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_config_pkey", + "schema": "public", + "table": "guardrail_config", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_rule_pkey", + "schema": "public", + "table": "guardrail_rule", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_violation_pkey", + "schema": "public", + "table": "guardrail_violation", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "installation_pkey", + "schema": "public", + "table": "installation", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "lock_pkey", + "schema": "public", + "table": "lock", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "log_pkey", + "schema": "public", + "table": "log", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "message_pkey", + "schema": "public", + "table": "message", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_pkey", + "schema": "public", + "table": "model", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_history_pkey", + "schema": "public", + "table": "model_history", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_provider_mapping_pkey", + "schema": "public", + "table": "model_provider_mapping", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_provider_mapping_history_pkey", + "schema": "public", + "table": "model_provider_mapping_history", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "organization_pkey", + "schema": "public", + "table": "organization", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "organization_action_pkey", + "schema": "public", + "table": "organization_action", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "passkey_pkey", + "schema": "public", + "table": "passkey", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "payment_method_pkey", + "schema": "public", + "table": "payment_method", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_pkey", + "schema": "public", + "table": "project", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_hourly_model_stats_pkey", + "schema": "public", + "table": "project_hourly_model_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_hourly_stats_pkey", + "schema": "public", + "table": "project_hourly_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "provider_pkey", + "schema": "public", + "table": "provider", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "provider_key_pkey", + "schema": "public", + "table": "provider_key", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "referral_pkey", + "schema": "public", + "table": "referral", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "session_pkey", + "schema": "public", + "table": "session", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "transaction_pkey", + "schema": "public", + "table": "transaction", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "user_pkey", + "schema": "public", + "table": "user", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "user_organization_pkey", + "schema": "public", + "table": "user_organization", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "verification_pkey", + "schema": "public", + "table": "verification", + "entityType": "pks" + }, + { + "nameExplicit": false, + "columns": [ + "api_key_id", + "hour_timestamp", + "used_model", + "used_provider" + ], + "nullsNotDistinct": false, + "name": "api_key_hourly_model_stats_api_key_id_hour_timestamp_used_model_used_provider_unique", + "entityType": "uniques", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": false, + "columns": [ + "api_key_id", + "hour_timestamp" + ], + "nullsNotDistinct": false, + "name": "api_key_hourly_stats_api_key_id_hour_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + "organization_id", + "provider", + "model" + ], + "nullsNotDistinct": false, + "name": "discount_org_provider_model_unique", + "entityType": "uniques", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": false, + "columns": [ + "model_id", + "minute_timestamp" + ], + "nullsNotDistinct": false, + "name": "model_history_model_id_minute_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_history" + }, + { + "nameExplicit": false, + "columns": [ + "model_id", + "provider_id" + ], + "nullsNotDistinct": false, + "name": "model_provider_mapping_model_id_provider_id_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "model_provider_mapping_id", + "minute_timestamp" + ], + "nullsNotDistinct": false, + "name": "model_provider_mapping_history_model_provider_mapping_id_minute_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": false, + "columns": [ + "project_id", + "hour_timestamp", + "used_model", + "used_provider" + ], + "nullsNotDistinct": false, + "name": "project_hourly_model_stats_project_id_hour_timestamp_used_model_used_provider_unique", + "entityType": "uniques", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": false, + "columns": [ + "project_id", + "hour_timestamp" + ], + "nullsNotDistinct": false, + "name": "project_hourly_stats_project_id_hour_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id", + "name" + ], + "nullsNotDistinct": false, + "name": "provider_key_organization_id_name_unique", + "entityType": "uniques", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": false, + "columns": [ + "token" + ], + "nullsNotDistinct": false, + "name": "api_key_token_unique", + "schema": "public", + "table": "api_key", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "nullsNotDistinct": false, + "name": "guardrail_config_organization_id_key", + "schema": "public", + "table": "guardrail_config", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "uuid" + ], + "nullsNotDistinct": false, + "name": "installation_uuid_unique", + "schema": "public", + "table": "installation", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "key" + ], + "nullsNotDistinct": false, + "name": "lock_key_unique", + "schema": "public", + "table": "lock", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "stripe_customer_id" + ], + "nullsNotDistinct": false, + "name": "organization_stripe_customer_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "stripe_subscription_id" + ], + "nullsNotDistinct": false, + "name": "organization_stripe_subscription_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "dev_plan_stripe_subscription_id" + ], + "nullsNotDistinct": false, + "name": "organization_dev_plan_stripe_subscription_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "referred_organization_id" + ], + "nullsNotDistinct": false, + "name": "referral_referred_organization_id_key", + "schema": "public", + "table": "referral", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "token" + ], + "nullsNotDistinct": false, + "name": "session_token_unique", + "schema": "public", + "table": "session", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "email" + ], + "nullsNotDistinct": false, + "name": "user_email_unique", + "schema": "public", + "table": "user", + "entityType": "uniques" + } + ], + "renames": [] +} \ No newline at end of file diff --git a/packages/db/migrations/meta/1770637415_snapshot.json b/packages/db/migrations/meta/1770637415_snapshot.json new file mode 100644 index 0000000000..a1aa768e44 --- /dev/null +++ b/packages/db/migrations/meta/1770637415_snapshot.json @@ -0,0 +1,10575 @@ +{ + "version": "8", + "dialect": "postgres", + "id": "3817fdb8-3ade-4054-a8b8-43a4189256be", + "prevId": "742ab22b-3f9b-4cad-935e-83c05956fed5", + "ddl": [ + { + "isRlsEnabled": false, + "name": "account", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key_hourly_model_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key_hourly_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key_iam_rule", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "audit_log", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "chat", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "discount", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_config", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_rule", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_violation", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "installation", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "lock", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "log", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "message", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_history", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_provider_mapping", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_provider_mapping_history", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "organization", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "organization_action", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "passkey", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "payment_method", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project_hourly_model_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project_hourly_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "provider", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "provider_key", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "referral", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "session", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "transaction", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "user", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "user_organization", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "verification", + "entityType": "tables", + "schema": "public" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "account_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "access_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refresh_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "access_token_expires_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refresh_token_expires_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "scope", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "password", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "usage_limit", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "usage", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_by", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_provider", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_output_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_output_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_type", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_value", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "action", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_type", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "title", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "web_search", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "discount_percent", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reason", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "true", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "enabled", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'{\"prompt_injection\":{\"enabled\":true,\"action\":\"block\"},\"jailbreak\":{\"enabled\":true,\"action\":\"block\"},\"pii_detection\":{\"enabled\":true,\"action\":\"redact\"},\"secrets\":{\"enabled\":true,\"action\":\"block\"},\"file_types\":{\"enabled\":true,\"action\":\"block\"},\"document_leakage\":{\"enabled\":false,\"action\":\"warn\"}}'" + }, + "generated": null, + "identity": null, + "name": "system_rules", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "10", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "max_file_size_mb", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 1, + "default": { + "value": "'{image/jpeg,image/png,image/gif,image/webp}'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "allowed_file_types", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'redact'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "pii_action", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "config", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "100", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "priority", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "true", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "enabled", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'block'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "action", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "log_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_name", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "category", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "action_taken", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "matched_pattern", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "matched_content", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content_hash", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "uuid", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "key", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "duration", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "requested_model", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "requested_provider", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model_mapping", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_provider", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "response_size", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_content", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tool_choice", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tool_results", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "finish_reason", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "unified_finish_reason", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "prompt_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "completion_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "messages", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "temperature", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "max_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "top_p", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "frequency_penalty", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "presence_penalty", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_effort", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "effort", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "response_format", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "has_error", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "error_details", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_input_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "web_search_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_input_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_output_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_input_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_output_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "estimated_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "discount", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "pricing_tier", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "mode", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_mode", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "source", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "custom_headers", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "routing_metadata", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "processed_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "raw_request", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "raw_response", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "upstream_request", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "upstream_response", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trace_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_retention_cleaned_up", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "params", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_agent", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plugins", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plugin_results", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "chat_id", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "images", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "sequence", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "released_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'(empty)'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'[]'" + }, + "generated": null, + "identity": null, + "name": "aliases", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'(empty)'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "family", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "free", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'[\"text\"]'" + }, + "generated": null, + "identity": null, + "name": "output", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'stable'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "stability", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "minute_timestamp", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_input_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_output_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_duration", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_name", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "output_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "context_size", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "max_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streaming", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "vision", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "json_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "json_output_schema", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "web_search", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "web_search_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'stable'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "stability", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "supported_parameters", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "test", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deprecated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deactivated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_provider_mapping_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "minute_timestamp", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_input_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_output_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_duration", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_email", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_company", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_address", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_tax_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_notes", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_customer_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_subscription_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_enabled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'10'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_threshold", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'10'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_amount", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'free'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "plan", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plan_expires_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "subscription_cancelled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trial_start_date", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trial_end_date", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_trial_active", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'none'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "retention_level", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "referral_earnings", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "payment_failure_count", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_payment_failure_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_personal", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'none'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_credits_used", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_credits_limit", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_billing_cycle_start", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_stripe_subscription_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_cancelled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_expires_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_allow_all_models", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "amount", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "public_key", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "credential_id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "counter", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "device_type", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "backed_up", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "transports", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_payment_method_id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_default", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "caching_enabled", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "60", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_duration_seconds", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'hybrid'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "mode", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_provider", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_output_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_output_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "streaming", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cancellation", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "color", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "website", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "announcement", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "base_url", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "options", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "referrer_organization_id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "referred_organization_id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ip_address", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_agent", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "amount", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "credit_amount", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'USD'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "currency", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'completed'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_payment_intent_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_invoice_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "related_transaction_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refund_reason", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "email", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "email_verified", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "onboarding_completed", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'owner'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "identifier", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "value", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "account_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_project_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_by", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_created_by_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_model_stats_api_key_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_model_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_model_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_api_key_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_api_key_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "rule_type", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_rule_type_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_api_key_id_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_organization_id_created_at_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "action", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_action_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "resource_type", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_resource_type_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "chat_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "chat" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "discount_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "provider", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "discount_provider_idx", + "entityType": "indexes", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "model", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "discount_model_idx", + "entityType": "indexes", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_config_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_config" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_rule_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "priority", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_rule_priority_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_violation_org_created_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "rule_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_violation_rule_created_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_project_id_created_at_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_model", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_provider", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_created_at_used_model_used_provider_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "data_retention_cleaned_up = false", + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_data_retention_pending_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_model", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_project_id_used_model_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "processed_at IS NULL", + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_processed_at_null_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "chat_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "message_chat_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "message" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "model" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_history_minute_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "provider_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_provider_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "model_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_model_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "organization_action_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "organization_action" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "passkey_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "passkey" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "payment_method_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "payment_method" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "project" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_model_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_model_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "provider_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "provider" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "provider_key_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "referrer_organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "referral_referrer_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "referred_organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "referral_referred_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "session_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "session" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "transaction_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "transaction" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "user_organization_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "user_organization_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "account_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": false, + "columns": [ + "project_id" + ], + "schemaTo": "public", + "tableTo": "project", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_project_id_project_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": false, + "columns": [ + "created_by" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_created_by_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": false, + "columns": [ + "api_key_id" + ], + "schemaTo": "public", + "tableTo": "api_key", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_iam_rule_api_key_id_api_key_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "audit_log_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "audit_log_user_id_user_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "chat_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "chat" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "discount_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_config_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_config" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_rule_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_violation_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": false, + "columns": [ + "chat_id" + ], + "schemaTo": "public", + "tableTo": "chat", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "message_chat_id_chat_id_fk", + "entityType": "fks", + "schema": "public", + "table": "message" + }, + { + "nameExplicit": false, + "columns": [ + "model_id" + ], + "schemaTo": "public", + "tableTo": "model", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "model_provider_mapping_model_id_model_id_fk", + "entityType": "fks", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "provider_id" + ], + "schemaTo": "public", + "tableTo": "provider", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "model_provider_mapping_provider_id_provider_id_fk", + "entityType": "fks", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "organization_action_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "organization_action" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "passkey_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "passkey" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "payment_method_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "payment_method" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "project_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "project" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "provider_key_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": false, + "columns": [ + "referrer_organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "referral_referrer_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": false, + "columns": [ + "referred_organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "referral_referred_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "session_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "session" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "transaction_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "transaction" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "user_organization_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "user_organization_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "user_organization" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "account_pkey", + "schema": "public", + "table": "account", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_pkey", + "schema": "public", + "table": "api_key", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_hourly_model_stats_pkey", + "schema": "public", + "table": "api_key_hourly_model_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_hourly_stats_pkey", + "schema": "public", + "table": "api_key_hourly_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_iam_rule_pkey", + "schema": "public", + "table": "api_key_iam_rule", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "audit_log_pkey", + "schema": "public", + "table": "audit_log", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "chat_pkey", + "schema": "public", + "table": "chat", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "discount_pkey", + "schema": "public", + "table": "discount", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_config_pkey", + "schema": "public", + "table": "guardrail_config", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_rule_pkey", + "schema": "public", + "table": "guardrail_rule", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_violation_pkey", + "schema": "public", + "table": "guardrail_violation", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "installation_pkey", + "schema": "public", + "table": "installation", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "lock_pkey", + "schema": "public", + "table": "lock", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "log_pkey", + "schema": "public", + "table": "log", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "message_pkey", + "schema": "public", + "table": "message", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_pkey", + "schema": "public", + "table": "model", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_history_pkey", + "schema": "public", + "table": "model_history", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_provider_mapping_pkey", + "schema": "public", + "table": "model_provider_mapping", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_provider_mapping_history_pkey", + "schema": "public", + "table": "model_provider_mapping_history", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "organization_pkey", + "schema": "public", + "table": "organization", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "organization_action_pkey", + "schema": "public", + "table": "organization_action", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "passkey_pkey", + "schema": "public", + "table": "passkey", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "payment_method_pkey", + "schema": "public", + "table": "payment_method", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_pkey", + "schema": "public", + "table": "project", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_hourly_model_stats_pkey", + "schema": "public", + "table": "project_hourly_model_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_hourly_stats_pkey", + "schema": "public", + "table": "project_hourly_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "provider_pkey", + "schema": "public", + "table": "provider", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "provider_key_pkey", + "schema": "public", + "table": "provider_key", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "referral_pkey", + "schema": "public", + "table": "referral", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "session_pkey", + "schema": "public", + "table": "session", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "transaction_pkey", + "schema": "public", + "table": "transaction", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "user_pkey", + "schema": "public", + "table": "user", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "user_organization_pkey", + "schema": "public", + "table": "user_organization", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "verification_pkey", + "schema": "public", + "table": "verification", + "entityType": "pks" + }, + { + "nameExplicit": false, + "columns": [ + "api_key_id", + "hour_timestamp", + "used_model", + "used_provider" + ], + "nullsNotDistinct": false, + "name": "api_key_hourly_model_stats_api_key_id_hour_timestamp_used_model_used_provider_unique", + "entityType": "uniques", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": false, + "columns": [ + "api_key_id", + "hour_timestamp" + ], + "nullsNotDistinct": false, + "name": "api_key_hourly_stats_api_key_id_hour_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + "organization_id", + "provider", + "model" + ], + "nullsNotDistinct": false, + "name": "discount_org_provider_model_unique", + "entityType": "uniques", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": false, + "columns": [ + "model_id", + "minute_timestamp" + ], + "nullsNotDistinct": false, + "name": "model_history_model_id_minute_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_history" + }, + { + "nameExplicit": false, + "columns": [ + "model_id", + "provider_id" + ], + "nullsNotDistinct": false, + "name": "model_provider_mapping_model_id_provider_id_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "model_provider_mapping_id", + "minute_timestamp" + ], + "nullsNotDistinct": false, + "name": "model_provider_mapping_history_model_provider_mapping_id_minute_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": false, + "columns": [ + "project_id", + "hour_timestamp", + "used_model", + "used_provider" + ], + "nullsNotDistinct": false, + "name": "project_hourly_model_stats_project_id_hour_timestamp_used_model_used_provider_unique", + "entityType": "uniques", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": false, + "columns": [ + "project_id", + "hour_timestamp" + ], + "nullsNotDistinct": false, + "name": "project_hourly_stats_project_id_hour_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id", + "name" + ], + "nullsNotDistinct": false, + "name": "provider_key_organization_id_name_unique", + "entityType": "uniques", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": false, + "columns": [ + "token" + ], + "nullsNotDistinct": false, + "name": "api_key_token_unique", + "schema": "public", + "table": "api_key", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "nullsNotDistinct": false, + "name": "guardrail_config_organization_id_key", + "schema": "public", + "table": "guardrail_config", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "uuid" + ], + "nullsNotDistinct": false, + "name": "installation_uuid_unique", + "schema": "public", + "table": "installation", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "key" + ], + "nullsNotDistinct": false, + "name": "lock_key_unique", + "schema": "public", + "table": "lock", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "stripe_customer_id" + ], + "nullsNotDistinct": false, + "name": "organization_stripe_customer_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "stripe_subscription_id" + ], + "nullsNotDistinct": false, + "name": "organization_stripe_subscription_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "dev_plan_stripe_subscription_id" + ], + "nullsNotDistinct": false, + "name": "organization_dev_plan_stripe_subscription_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "referred_organization_id" + ], + "nullsNotDistinct": false, + "name": "referral_referred_organization_id_key", + "schema": "public", + "table": "referral", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "token" + ], + "nullsNotDistinct": false, + "name": "session_token_unique", + "schema": "public", + "table": "session", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "email" + ], + "nullsNotDistinct": false, + "name": "user_email_unique", + "schema": "public", + "table": "user", + "entityType": "uniques" + } + ], + "renames": [] +} \ No newline at end of file diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index 8403aa194e..48bf86691a 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -624,6 +624,20 @@ "when": 1770632238756, "tag": "1770632238_lean_sharon_carter", "breakpoints": true + }, + { + "idx": 89, + "version": "8", + "when": 1770637154916, + "tag": "1770637154_nervous_guardsmen", + "breakpoints": true + }, + { + "idx": 90, + "version": "8", + "when": 1770637415423, + "tag": "1770637415_dear_speed_demon", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts index 84fcfe4601..dc65f23d20 100644 --- a/packages/db/src/schema.ts +++ b/packages/db/src/schema.ts @@ -1217,6 +1217,8 @@ export const projectHourlyStats = pgTable( dataStorageCost: real().notNull().default(0), serviceFee: real().notNull().default(0), discountSavings: real().notNull().default(0), + imageInputCost: real().notNull().default(0), + imageOutputCost: real().notNull().default(0), }, (table) => [ // Unique constraint for one record per project-hour (also creates implicit index) @@ -1271,6 +1273,8 @@ export const projectHourlyModelStats = pgTable( dataStorageCost: real().notNull().default(0), serviceFee: real().notNull().default(0), discountSavings: real().notNull().default(0), + imageInputCost: real().notNull().default(0), + imageOutputCost: real().notNull().default(0), }, (table) => [ // Unique constraint for one record per project-hour-model-provider @@ -1336,6 +1340,8 @@ export const apiKeyHourlyStats = pgTable( dataStorageCost: real().notNull().default(0), serviceFee: real().notNull().default(0), discountSavings: real().notNull().default(0), + imageInputCost: real().notNull().default(0), + imageOutputCost: real().notNull().default(0), }, (table) => [ // Unique constraint for one record per api-key-hour @@ -1401,6 +1407,8 @@ export const apiKeyHourlyModelStats = pgTable( dataStorageCost: real().notNull().default(0), serviceFee: real().notNull().default(0), discountSavings: real().notNull().default(0), + imageInputCost: real().notNull().default(0), + imageOutputCost: real().notNull().default(0), }, (table) => [ // Unique constraint for one record per api-key-hour-model-provider From 5e2e63e19fcc820ec6b7f0edb581e52971783b3f Mon Sep 17 00:00:00 2001 From: "Luca Steeb (bot)" Date: Tue, 10 Feb 2026 09:49:16 +0000 Subject: [PATCH 15/24] chore(autofix): apply diff --- .../1770716656_solid_franklin_storm.sql | 4 + .../migrations/meta/1770716656_snapshot.json | 10639 ++++++++++++++++ packages/db/migrations/meta/_journal.json | 7 + 3 files changed, 10650 insertions(+) create mode 100644 packages/db/migrations/1770716656_solid_franklin_storm.sql create mode 100644 packages/db/migrations/meta/1770716656_snapshot.json diff --git a/packages/db/migrations/1770716656_solid_franklin_storm.sql b/packages/db/migrations/1770716656_solid_franklin_storm.sql new file mode 100644 index 0000000000..fe4192587d --- /dev/null +++ b/packages/db/migrations/1770716656_solid_franklin_storm.sql @@ -0,0 +1,4 @@ +ALTER TABLE "api_key_hourly_model_stats" ADD COLUMN "cached_input_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "api_key_hourly_stats" ADD COLUMN "cached_input_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "project_hourly_model_stats" ADD COLUMN "cached_input_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "project_hourly_stats" ADD COLUMN "cached_input_cost" real DEFAULT 0 NOT NULL; \ No newline at end of file diff --git a/packages/db/migrations/meta/1770716656_snapshot.json b/packages/db/migrations/meta/1770716656_snapshot.json new file mode 100644 index 0000000000..e32c878433 --- /dev/null +++ b/packages/db/migrations/meta/1770716656_snapshot.json @@ -0,0 +1,10639 @@ +{ + "version": "8", + "dialect": "postgres", + "id": "85c1de3a-1895-4119-a6f5-bc1bacfb29ea", + "prevId": "3817fdb8-3ade-4054-a8b8-43a4189256be", + "ddl": [ + { + "isRlsEnabled": false, + "name": "account", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key_hourly_model_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key_hourly_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "api_key_iam_rule", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "audit_log", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "chat", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "discount", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_config", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_rule", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "guardrail_violation", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "installation", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "lock", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "log", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "message", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_history", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_provider_mapping", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "model_provider_mapping_history", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "organization", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "organization_action", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "passkey", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "payment_method", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project_hourly_model_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project_hourly_stats", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "provider", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "provider_key", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "referral", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "session", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "transaction", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "user", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "user_organization", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "verification", + "entityType": "tables", + "schema": "public" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "account_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "access_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refresh_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "access_token_expires_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refresh_token_expires_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "scope", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "password", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "usage_limit", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "usage", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_by", + "entityType": "columns", + "schema": "public", + "table": "api_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_provider", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_output_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_output_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_type", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_value", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "action", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_type", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "audit_log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "title", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "web_search", + "entityType": "columns", + "schema": "public", + "table": "chat" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "discount_percent", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reason", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "discount" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "true", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "enabled", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'{\"prompt_injection\":{\"enabled\":true,\"action\":\"block\"},\"jailbreak\":{\"enabled\":true,\"action\":\"block\"},\"pii_detection\":{\"enabled\":true,\"action\":\"redact\"},\"secrets\":{\"enabled\":true,\"action\":\"block\"},\"file_types\":{\"enabled\":true,\"action\":\"block\"},\"document_leakage\":{\"enabled\":false,\"action\":\"warn\"}}'" + }, + "generated": null, + "identity": null, + "name": "system_rules", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "10", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "max_file_size_mb", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 1, + "default": { + "value": "'{image/jpeg,image/png,image/gif,image/webp}'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "allowed_file_types", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'redact'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "pii_action", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_config" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "config", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "100", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "priority", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "true", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "enabled", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'block'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "action", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_rule" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "log_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rule_name", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "category", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "action_taken", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "matched_pattern", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "matched_content", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content_hash", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "guardrail_violation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "uuid", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "installation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "key", + "entityType": "columns", + "schema": "public", + "table": "lock" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "api_key_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "duration", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "requested_model", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "requested_provider", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model_mapping", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_provider", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "response_size", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_content", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tool_choice", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tool_results", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "finish_reason", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "unified_finish_reason", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "prompt_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "completion_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "messages", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "temperature", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "max_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "top_p", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "frequency_penalty", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "presence_penalty", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_effort", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "effort", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "response_format", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "has_error", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "error_details", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_input_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "web_search_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_input_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_output_tokens", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_input_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_output_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "estimated_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "discount", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "pricing_tier", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "mode", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_mode", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "source", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "custom_headers", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "routing_metadata", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "processed_at", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "raw_request", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "raw_response", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "upstream_request", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "upstream_response", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trace_id", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_retention_cleaned_up", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "params", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_agent", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plugins", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plugin_results", + "entityType": "columns", + "schema": "public", + "table": "log" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "chat_id", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "images", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "sequence", + "entityType": "columns", + "schema": "public", + "table": "message" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "released_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'(empty)'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'[]'" + }, + "generated": null, + "identity": null, + "name": "aliases", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'(empty)'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "family", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "free", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "json", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "type": "unknown", + "value": "'[\"text\"]'" + }, + "generated": null, + "identity": null, + "name": "output", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'stable'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "stability", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "model" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "minute_timestamp", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_input_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_output_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_duration", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_name", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "output_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cached_input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image_input_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "context_size", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "max_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streaming", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "vision", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reasoning_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tools", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "json_output", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "json_output_schema", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "web_search", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "web_search_price", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'stable'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "stability", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "supported_parameters", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "test", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deprecated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deactivated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "model_provider_mapping_id", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "minute_timestamp", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_input_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_output_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_duration", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_email", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_company", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_address", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_tax_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "billing_notes", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_customer_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_subscription_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_enabled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'10'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_threshold", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'10'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "auto_top_up_amount", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'free'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "plan", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "plan_expires_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "subscription_cancelled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trial_start_date", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trial_end_date", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_trial_active", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'none'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "retention_level", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "referral_earnings", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "payment_failure_count", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_payment_failure_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_personal", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'none'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_credits_used", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_credits_limit", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_billing_cycle_start", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_stripe_subscription_id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_cancelled", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dev_plan_expires_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "dev_plan_allow_all_models", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "amount", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "organization_action" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "public_key", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "credential_id", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "counter", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "device_type", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "backed_up", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "transports", + "entityType": "columns", + "schema": "public", + "table": "passkey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_payment_method_id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "is_default", + "entityType": "columns", + "schema": "public", + "table": "payment_method" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "caching_enabled", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "60", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_duration_seconds", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'hybrid'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "mode", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "project" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_model", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "used_provider", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_output_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "hour_timestamp", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cache_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "non_streamed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "completed_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "length_limit_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "content_filter_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "tool_calls_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "canceled_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "unknown_finish_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_error_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "total_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "reasoning_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'0'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_tokens", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "output_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "request_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "service_fee", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "discount_savings", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "image_output_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "streaming", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cancellation", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "color", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "website", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "announcement", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "logs_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "client_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "gateway_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "upstream_errors_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_count", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_token", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "real", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avg_time_to_first_reasoning_token", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stats_updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "base_url", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "options", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": { + "value": "'active'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "provider_key" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "referrer_organization_id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "referred_organization_id", + "entityType": "columns", + "schema": "public", + "table": "referral" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ip_address", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_agent", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "amount", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "numeric", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "credit_amount", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'USD'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "currency", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'completed'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_payment_intent_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "stripe_invoice_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "related_transaction_id", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refund_reason", + "entityType": "columns", + "schema": "public", + "table": "transaction" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "email", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "email_verified", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "false", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "onboarding_completed", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "'owner'", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "user_organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "identifier", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "value", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "now()", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "account_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_project_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_by", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_created_by_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_model_stats_api_key_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_model_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_model_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_api_key_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_hourly_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_api_key_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "rule_type", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_rule_type_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "api_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "api_key_iam_rule_api_key_id_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_organization_id_created_at_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "action", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_action_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "resource_type", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "audit_log_resource_type_idx", + "entityType": "indexes", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "chat_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "chat" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "discount_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "provider", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "discount_provider_idx", + "entityType": "indexes", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "model", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "discount_model_idx", + "entityType": "indexes", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_config_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_config" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_rule_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "priority", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_rule_priority_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_violation_org_created_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "rule_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "guardrail_violation_rule_created_idx", + "entityType": "indexes", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_project_id_created_at_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_model", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_provider", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_created_at_used_model_used_provider_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "data_retention_cleaned_up = false", + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_data_retention_pending_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "used_model", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_project_id_used_model_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "created_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "processed_at IS NULL", + "with": "", + "method": "btree", + "concurrently": false, + "name": "log_processed_at_null_idx", + "entityType": "indexes", + "schema": "public", + "table": "log" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "chat_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "message_chat_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "message" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "model" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_history_minute_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "provider_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_provider_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "minute_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "model_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "model_provider_mapping_history_minute_timestamp_model_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "organization_action_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "organization_action" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "passkey_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "passkey" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "payment_method_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "payment_method" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "project" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_model_stats_project_id_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_model_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "hour_timestamp", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_hourly_stats_hour_timestamp_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "status", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "provider_status_idx", + "entityType": "indexes", + "schema": "public", + "table": "provider" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "provider_key_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "referrer_organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "referral_referrer_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "referred_organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "referral_referred_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "session_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "session" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "transaction_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "transaction" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "user_organization_user_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "user_organization_organization_id_idx", + "entityType": "indexes", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "account_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": false, + "columns": [ + "project_id" + ], + "schemaTo": "public", + "tableTo": "project", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_project_id_project_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": false, + "columns": [ + "created_by" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_created_by_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key" + }, + { + "nameExplicit": false, + "columns": [ + "api_key_id" + ], + "schemaTo": "public", + "tableTo": "api_key", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "api_key_iam_rule_api_key_id_api_key_id_fk", + "entityType": "fks", + "schema": "public", + "table": "api_key_iam_rule" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "audit_log_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "audit_log_user_id_user_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "audit_log" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "chat_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "chat" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "discount_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_config_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_config" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_rule_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_rule" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "guardrail_violation_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "guardrail_violation" + }, + { + "nameExplicit": false, + "columns": [ + "chat_id" + ], + "schemaTo": "public", + "tableTo": "chat", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "message_chat_id_chat_id_fk", + "entityType": "fks", + "schema": "public", + "table": "message" + }, + { + "nameExplicit": false, + "columns": [ + "model_id" + ], + "schemaTo": "public", + "tableTo": "model", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "model_provider_mapping_model_id_model_id_fk", + "entityType": "fks", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "provider_id" + ], + "schemaTo": "public", + "tableTo": "provider", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "model_provider_mapping_provider_id_provider_id_fk", + "entityType": "fks", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "organization_action_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "organization_action" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "passkey_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "passkey" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "payment_method_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "payment_method" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "project_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "project" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "provider_key_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": false, + "columns": [ + "referrer_organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "referral_referrer_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": false, + "columns": [ + "referred_organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "referral_referred_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "referral" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "session_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "session" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "transaction_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "transaction" + }, + { + "nameExplicit": false, + "columns": [ + "user_id" + ], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "user_organization_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "user_organization" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "user_organization_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "user_organization" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "account_pkey", + "schema": "public", + "table": "account", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_pkey", + "schema": "public", + "table": "api_key", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_hourly_model_stats_pkey", + "schema": "public", + "table": "api_key_hourly_model_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_hourly_stats_pkey", + "schema": "public", + "table": "api_key_hourly_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "api_key_iam_rule_pkey", + "schema": "public", + "table": "api_key_iam_rule", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "audit_log_pkey", + "schema": "public", + "table": "audit_log", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "chat_pkey", + "schema": "public", + "table": "chat", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "discount_pkey", + "schema": "public", + "table": "discount", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_config_pkey", + "schema": "public", + "table": "guardrail_config", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_rule_pkey", + "schema": "public", + "table": "guardrail_rule", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guardrail_violation_pkey", + "schema": "public", + "table": "guardrail_violation", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "installation_pkey", + "schema": "public", + "table": "installation", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "lock_pkey", + "schema": "public", + "table": "lock", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "log_pkey", + "schema": "public", + "table": "log", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "message_pkey", + "schema": "public", + "table": "message", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_pkey", + "schema": "public", + "table": "model", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_history_pkey", + "schema": "public", + "table": "model_history", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_provider_mapping_pkey", + "schema": "public", + "table": "model_provider_mapping", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "model_provider_mapping_history_pkey", + "schema": "public", + "table": "model_provider_mapping_history", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "organization_pkey", + "schema": "public", + "table": "organization", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "organization_action_pkey", + "schema": "public", + "table": "organization_action", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "passkey_pkey", + "schema": "public", + "table": "passkey", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "payment_method_pkey", + "schema": "public", + "table": "payment_method", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_pkey", + "schema": "public", + "table": "project", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_hourly_model_stats_pkey", + "schema": "public", + "table": "project_hourly_model_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "project_hourly_stats_pkey", + "schema": "public", + "table": "project_hourly_stats", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "provider_pkey", + "schema": "public", + "table": "provider", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "provider_key_pkey", + "schema": "public", + "table": "provider_key", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "referral_pkey", + "schema": "public", + "table": "referral", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "session_pkey", + "schema": "public", + "table": "session", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "transaction_pkey", + "schema": "public", + "table": "transaction", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "user_pkey", + "schema": "public", + "table": "user", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "user_organization_pkey", + "schema": "public", + "table": "user_organization", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "verification_pkey", + "schema": "public", + "table": "verification", + "entityType": "pks" + }, + { + "nameExplicit": false, + "columns": [ + "api_key_id", + "hour_timestamp", + "used_model", + "used_provider" + ], + "nullsNotDistinct": false, + "name": "api_key_hourly_model_stats_api_key_id_hour_timestamp_used_model_used_provider_unique", + "entityType": "uniques", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "nameExplicit": false, + "columns": [ + "api_key_id", + "hour_timestamp" + ], + "nullsNotDistinct": false, + "name": "api_key_hourly_stats_api_key_id_hour_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "nameExplicit": true, + "columns": [ + "organization_id", + "provider", + "model" + ], + "nullsNotDistinct": false, + "name": "discount_org_provider_model_unique", + "entityType": "uniques", + "schema": "public", + "table": "discount" + }, + { + "nameExplicit": false, + "columns": [ + "model_id", + "minute_timestamp" + ], + "nullsNotDistinct": false, + "name": "model_history_model_id_minute_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_history" + }, + { + "nameExplicit": false, + "columns": [ + "model_id", + "provider_id" + ], + "nullsNotDistinct": false, + "name": "model_provider_mapping_model_id_provider_id_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_provider_mapping" + }, + { + "nameExplicit": false, + "columns": [ + "model_provider_mapping_id", + "minute_timestamp" + ], + "nullsNotDistinct": false, + "name": "model_provider_mapping_history_model_provider_mapping_id_minute_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "model_provider_mapping_history" + }, + { + "nameExplicit": false, + "columns": [ + "project_id", + "hour_timestamp", + "used_model", + "used_provider" + ], + "nullsNotDistinct": false, + "name": "project_hourly_model_stats_project_id_hour_timestamp_used_model_used_provider_unique", + "entityType": "uniques", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "nameExplicit": false, + "columns": [ + "project_id", + "hour_timestamp" + ], + "nullsNotDistinct": false, + "name": "project_hourly_stats_project_id_hour_timestamp_unique", + "entityType": "uniques", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id", + "name" + ], + "nullsNotDistinct": false, + "name": "provider_key_organization_id_name_unique", + "entityType": "uniques", + "schema": "public", + "table": "provider_key" + }, + { + "nameExplicit": false, + "columns": [ + "token" + ], + "nullsNotDistinct": false, + "name": "api_key_token_unique", + "schema": "public", + "table": "api_key", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "organization_id" + ], + "nullsNotDistinct": false, + "name": "guardrail_config_organization_id_key", + "schema": "public", + "table": "guardrail_config", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "uuid" + ], + "nullsNotDistinct": false, + "name": "installation_uuid_unique", + "schema": "public", + "table": "installation", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "key" + ], + "nullsNotDistinct": false, + "name": "lock_key_unique", + "schema": "public", + "table": "lock", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "stripe_customer_id" + ], + "nullsNotDistinct": false, + "name": "organization_stripe_customer_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "stripe_subscription_id" + ], + "nullsNotDistinct": false, + "name": "organization_stripe_subscription_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "dev_plan_stripe_subscription_id" + ], + "nullsNotDistinct": false, + "name": "organization_dev_plan_stripe_subscription_id_key", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "referred_organization_id" + ], + "nullsNotDistinct": false, + "name": "referral_referred_organization_id_key", + "schema": "public", + "table": "referral", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "token" + ], + "nullsNotDistinct": false, + "name": "session_token_unique", + "schema": "public", + "table": "session", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": [ + "email" + ], + "nullsNotDistinct": false, + "name": "user_email_unique", + "schema": "public", + "table": "user", + "entityType": "uniques" + } + ], + "renames": [] +} \ No newline at end of file diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index 48bf86691a..9cd1ef5014 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -638,6 +638,13 @@ "when": 1770637415423, "tag": "1770637415_dear_speed_demon", "breakpoints": true + }, + { + "idx": 91, + "version": "8", + "when": 1770716656316, + "tag": "1770716656_solid_franklin_storm", + "breakpoints": true } ] } \ No newline at end of file From 92214be041c1484990b55098ef89e07c41cf8fb1 Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Tue, 10 Feb 2026 17:49:55 +0700 Subject: [PATCH 16/24] feat(db): regenerate migrations for stats tables Co-Authored-By: Claude Opus 4.6 --- .../1770637415_dear_speed_demon.sql | 8 - .../1770720582_groovy_black_panther.sql | 167 + .../migrations/meta/1770637154_snapshot.json | 10447 ---------------- ...snapshot.json => 1770720582_snapshot.json} | 68 +- packages/db/migrations/meta/_journal.json | 11 +- 5 files changed, 235 insertions(+), 10466 deletions(-) delete mode 100644 packages/db/migrations/1770637415_dear_speed_demon.sql create mode 100644 packages/db/migrations/1770720582_groovy_black_panther.sql delete mode 100644 packages/db/migrations/meta/1770637154_snapshot.json rename packages/db/migrations/meta/{1770637415_snapshot.json => 1770720582_snapshot.json} (99%) diff --git a/packages/db/migrations/1770637415_dear_speed_demon.sql b/packages/db/migrations/1770637415_dear_speed_demon.sql deleted file mode 100644 index ba1c2d6840..0000000000 --- a/packages/db/migrations/1770637415_dear_speed_demon.sql +++ /dev/null @@ -1,8 +0,0 @@ -ALTER TABLE "api_key_hourly_model_stats" ADD COLUMN "image_input_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE "api_key_hourly_model_stats" ADD COLUMN "image_output_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE "api_key_hourly_stats" ADD COLUMN "image_input_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE "api_key_hourly_stats" ADD COLUMN "image_output_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE "project_hourly_model_stats" ADD COLUMN "image_input_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE "project_hourly_model_stats" ADD COLUMN "image_output_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE "project_hourly_stats" ADD COLUMN "image_input_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE "project_hourly_stats" ADD COLUMN "image_output_cost" real DEFAULT 0 NOT NULL; \ No newline at end of file diff --git a/packages/db/migrations/1770720582_groovy_black_panther.sql b/packages/db/migrations/1770720582_groovy_black_panther.sql new file mode 100644 index 0000000000..34848a7cdb --- /dev/null +++ b/packages/db/migrations/1770720582_groovy_black_panther.sql @@ -0,0 +1,167 @@ +CREATE TABLE "api_key_hourly_model_stats" ( + "id" text PRIMARY KEY, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + "api_key_id" text NOT NULL, + "project_id" text NOT NULL, + "hour_timestamp" timestamp NOT NULL, + "used_model" text NOT NULL, + "used_provider" text NOT NULL, + "request_count" integer DEFAULT 0 NOT NULL, + "error_count" integer DEFAULT 0 NOT NULL, + "cache_count" integer DEFAULT 0 NOT NULL, + "streamed_count" integer DEFAULT 0 NOT NULL, + "non_streamed_count" integer DEFAULT 0 NOT NULL, + "completed_count" integer DEFAULT 0 NOT NULL, + "length_limit_count" integer DEFAULT 0 NOT NULL, + "content_filter_count" integer DEFAULT 0 NOT NULL, + "tool_calls_count" integer DEFAULT 0 NOT NULL, + "canceled_count" integer DEFAULT 0 NOT NULL, + "unknown_finish_count" integer DEFAULT 0 NOT NULL, + "client_error_count" integer DEFAULT 0 NOT NULL, + "gateway_error_count" integer DEFAULT 0 NOT NULL, + "upstream_error_count" integer DEFAULT 0 NOT NULL, + "input_tokens" numeric DEFAULT '0' NOT NULL, + "output_tokens" numeric DEFAULT '0' NOT NULL, + "total_tokens" numeric DEFAULT '0' NOT NULL, + "reasoning_tokens" numeric DEFAULT '0' NOT NULL, + "cached_tokens" numeric DEFAULT '0' NOT NULL, + "cost" real DEFAULT 0 NOT NULL, + "input_cost" real DEFAULT 0 NOT NULL, + "output_cost" real DEFAULT 0 NOT NULL, + "request_cost" real DEFAULT 0 NOT NULL, + "data_storage_cost" real DEFAULT 0 NOT NULL, + "service_fee" real DEFAULT 0 NOT NULL, + "discount_savings" real DEFAULT 0 NOT NULL, + "image_input_cost" real DEFAULT 0 NOT NULL, + "image_output_cost" real DEFAULT 0 NOT NULL, + "cached_input_cost" real DEFAULT 0 NOT NULL, + CONSTRAINT "api_key_hourly_model_stats_api_key_id_hour_timestamp_used_model_used_provider_unique" UNIQUE("api_key_id","hour_timestamp","used_model","used_provider") +); +--> statement-breakpoint +CREATE TABLE "api_key_hourly_stats" ( + "id" text PRIMARY KEY, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + "api_key_id" text NOT NULL, + "project_id" text NOT NULL, + "hour_timestamp" timestamp NOT NULL, + "request_count" integer DEFAULT 0 NOT NULL, + "error_count" integer DEFAULT 0 NOT NULL, + "cache_count" integer DEFAULT 0 NOT NULL, + "streamed_count" integer DEFAULT 0 NOT NULL, + "non_streamed_count" integer DEFAULT 0 NOT NULL, + "completed_count" integer DEFAULT 0 NOT NULL, + "length_limit_count" integer DEFAULT 0 NOT NULL, + "content_filter_count" integer DEFAULT 0 NOT NULL, + "tool_calls_count" integer DEFAULT 0 NOT NULL, + "canceled_count" integer DEFAULT 0 NOT NULL, + "unknown_finish_count" integer DEFAULT 0 NOT NULL, + "client_error_count" integer DEFAULT 0 NOT NULL, + "gateway_error_count" integer DEFAULT 0 NOT NULL, + "upstream_error_count" integer DEFAULT 0 NOT NULL, + "input_tokens" numeric DEFAULT '0' NOT NULL, + "output_tokens" numeric DEFAULT '0' NOT NULL, + "total_tokens" numeric DEFAULT '0' NOT NULL, + "reasoning_tokens" numeric DEFAULT '0' NOT NULL, + "cached_tokens" numeric DEFAULT '0' NOT NULL, + "cost" real DEFAULT 0 NOT NULL, + "input_cost" real DEFAULT 0 NOT NULL, + "output_cost" real DEFAULT 0 NOT NULL, + "request_cost" real DEFAULT 0 NOT NULL, + "data_storage_cost" real DEFAULT 0 NOT NULL, + "service_fee" real DEFAULT 0 NOT NULL, + "discount_savings" real DEFAULT 0 NOT NULL, + "image_input_cost" real DEFAULT 0 NOT NULL, + "image_output_cost" real DEFAULT 0 NOT NULL, + "cached_input_cost" real DEFAULT 0 NOT NULL, + CONSTRAINT "api_key_hourly_stats_api_key_id_hour_timestamp_unique" UNIQUE("api_key_id","hour_timestamp") +); +--> statement-breakpoint +CREATE TABLE "project_hourly_model_stats" ( + "id" text PRIMARY KEY, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + "project_id" text NOT NULL, + "hour_timestamp" timestamp NOT NULL, + "used_model" text NOT NULL, + "used_provider" text NOT NULL, + "request_count" integer DEFAULT 0 NOT NULL, + "error_count" integer DEFAULT 0 NOT NULL, + "cache_count" integer DEFAULT 0 NOT NULL, + "streamed_count" integer DEFAULT 0 NOT NULL, + "non_streamed_count" integer DEFAULT 0 NOT NULL, + "completed_count" integer DEFAULT 0 NOT NULL, + "length_limit_count" integer DEFAULT 0 NOT NULL, + "content_filter_count" integer DEFAULT 0 NOT NULL, + "tool_calls_count" integer DEFAULT 0 NOT NULL, + "canceled_count" integer DEFAULT 0 NOT NULL, + "unknown_finish_count" integer DEFAULT 0 NOT NULL, + "client_error_count" integer DEFAULT 0 NOT NULL, + "gateway_error_count" integer DEFAULT 0 NOT NULL, + "upstream_error_count" integer DEFAULT 0 NOT NULL, + "input_tokens" numeric DEFAULT '0' NOT NULL, + "output_tokens" numeric DEFAULT '0' NOT NULL, + "total_tokens" numeric DEFAULT '0' NOT NULL, + "reasoning_tokens" numeric DEFAULT '0' NOT NULL, + "cached_tokens" numeric DEFAULT '0' NOT NULL, + "cost" real DEFAULT 0 NOT NULL, + "input_cost" real DEFAULT 0 NOT NULL, + "output_cost" real DEFAULT 0 NOT NULL, + "request_cost" real DEFAULT 0 NOT NULL, + "data_storage_cost" real DEFAULT 0 NOT NULL, + "service_fee" real DEFAULT 0 NOT NULL, + "discount_savings" real DEFAULT 0 NOT NULL, + "image_input_cost" real DEFAULT 0 NOT NULL, + "image_output_cost" real DEFAULT 0 NOT NULL, + "cached_input_cost" real DEFAULT 0 NOT NULL, + CONSTRAINT "project_hourly_model_stats_project_id_hour_timestamp_used_model_used_provider_unique" UNIQUE("project_id","hour_timestamp","used_model","used_provider") +); +--> statement-breakpoint +CREATE TABLE "project_hourly_stats" ( + "id" text PRIMARY KEY, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + "project_id" text NOT NULL, + "hour_timestamp" timestamp NOT NULL, + "request_count" integer DEFAULT 0 NOT NULL, + "error_count" integer DEFAULT 0 NOT NULL, + "cache_count" integer DEFAULT 0 NOT NULL, + "streamed_count" integer DEFAULT 0 NOT NULL, + "non_streamed_count" integer DEFAULT 0 NOT NULL, + "completed_count" integer DEFAULT 0 NOT NULL, + "length_limit_count" integer DEFAULT 0 NOT NULL, + "content_filter_count" integer DEFAULT 0 NOT NULL, + "tool_calls_count" integer DEFAULT 0 NOT NULL, + "canceled_count" integer DEFAULT 0 NOT NULL, + "unknown_finish_count" integer DEFAULT 0 NOT NULL, + "client_error_count" integer DEFAULT 0 NOT NULL, + "gateway_error_count" integer DEFAULT 0 NOT NULL, + "upstream_error_count" integer DEFAULT 0 NOT NULL, + "input_tokens" numeric DEFAULT '0' NOT NULL, + "output_tokens" numeric DEFAULT '0' NOT NULL, + "total_tokens" numeric DEFAULT '0' NOT NULL, + "reasoning_tokens" numeric DEFAULT '0' NOT NULL, + "cached_tokens" numeric DEFAULT '0' NOT NULL, + "cost" real DEFAULT 0 NOT NULL, + "input_cost" real DEFAULT 0 NOT NULL, + "output_cost" real DEFAULT 0 NOT NULL, + "request_cost" real DEFAULT 0 NOT NULL, + "data_storage_cost" real DEFAULT 0 NOT NULL, + "service_fee" real DEFAULT 0 NOT NULL, + "discount_savings" real DEFAULT 0 NOT NULL, + "image_input_cost" real DEFAULT 0 NOT NULL, + "image_output_cost" real DEFAULT 0 NOT NULL, + "cached_input_cost" real DEFAULT 0 NOT NULL, + CONSTRAINT "project_hourly_stats_project_id_hour_timestamp_unique" UNIQUE("project_id","hour_timestamp") +); +--> statement-breakpoint +CREATE INDEX "api_key_hourly_model_stats_api_key_id_hour_timestamp_idx" ON "api_key_hourly_model_stats" ("api_key_id","hour_timestamp");--> statement-breakpoint +CREATE INDEX "api_key_hourly_model_stats_project_id_hour_timestamp_idx" ON "api_key_hourly_model_stats" ("project_id","hour_timestamp");--> statement-breakpoint +CREATE INDEX "api_key_hourly_model_stats_hour_timestamp_idx" ON "api_key_hourly_model_stats" ("hour_timestamp");--> statement-breakpoint +CREATE INDEX "api_key_hourly_stats_api_key_id_hour_timestamp_idx" ON "api_key_hourly_stats" ("api_key_id","hour_timestamp");--> statement-breakpoint +CREATE INDEX "api_key_hourly_stats_project_id_hour_timestamp_idx" ON "api_key_hourly_stats" ("project_id","hour_timestamp");--> statement-breakpoint +CREATE INDEX "api_key_hourly_stats_hour_timestamp_idx" ON "api_key_hourly_stats" ("hour_timestamp");--> statement-breakpoint +CREATE INDEX "project_hourly_model_stats_project_id_hour_timestamp_idx" ON "project_hourly_model_stats" ("project_id","hour_timestamp");--> statement-breakpoint +CREATE INDEX "project_hourly_model_stats_hour_timestamp_idx" ON "project_hourly_model_stats" ("hour_timestamp");--> statement-breakpoint +CREATE INDEX "project_hourly_stats_hour_timestamp_idx" ON "project_hourly_stats" ("hour_timestamp"); \ No newline at end of file diff --git a/packages/db/migrations/meta/1770637154_snapshot.json b/packages/db/migrations/meta/1770637154_snapshot.json deleted file mode 100644 index be2abe33d4..0000000000 --- a/packages/db/migrations/meta/1770637154_snapshot.json +++ /dev/null @@ -1,10447 +0,0 @@ -{ - "version": "8", - "dialect": "postgres", - "id": "742ab22b-3f9b-4cad-935e-83c05956fed5", - "prevId": "e5fcbbc1-a429-4cb2-9b9d-329dc6387ffc", - "ddl": [ - { - "isRlsEnabled": false, - "name": "account", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "api_key", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "api_key_hourly_model_stats", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "api_key_hourly_stats", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "api_key_iam_rule", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "audit_log", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "chat", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "discount", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "guardrail_config", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "guardrail_rule", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "guardrail_violation", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "installation", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "lock", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "log", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "message", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "model", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "model_history", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "model_provider_mapping", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "model_provider_mapping_history", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "organization", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "organization_action", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "passkey", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "payment_method", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "project", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "project_hourly_model_stats", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "project_hourly_stats", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "provider", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "provider_key", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "referral", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "session", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "transaction", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "user", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "user_organization", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "verification", - "entityType": "tables", - "schema": "public" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "account_id", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "provider_id", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_id", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "access_token", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "refresh_token", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id_token", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "access_token_expires_at", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "refresh_token_expires_at", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "scope", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "password", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "token", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "description", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "usage_limit", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "usage", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "project_id", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "created_by", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "api_key_id", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "project_id", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "hour_timestamp", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_model", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_provider", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cache_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "streamed_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "non_streamed_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "completed_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "length_limit_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "content_filter_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "tool_calls_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "canceled_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "unknown_finish_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "reasoning_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "data_storage_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "service_fee", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "discount_savings", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "api_key_id", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "project_id", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "hour_timestamp", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cache_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "streamed_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "non_streamed_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "completed_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "length_limit_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "content_filter_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "tool_calls_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "canceled_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "unknown_finish_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "reasoning_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "data_storage_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "service_fee", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "discount_savings", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "api_key_id", - "entityType": "columns", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "rule_type", - "entityType": "columns", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "type": "json", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "rule_value", - "entityType": "columns", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_id", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "action", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "resource_type", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "resource_id", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "metadata", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "title", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_id", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "web_search", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "provider", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "discount_percent", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reason", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "expires_at", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "true", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "enabled", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "type": "unknown", - "value": "'{\"prompt_injection\":{\"enabled\":true,\"action\":\"block\"},\"jailbreak\":{\"enabled\":true,\"action\":\"block\"},\"pii_detection\":{\"enabled\":true,\"action\":\"redact\"},\"secrets\":{\"enabled\":true,\"action\":\"block\"},\"file_types\":{\"enabled\":true,\"action\":\"block\"},\"document_leakage\":{\"enabled\":false,\"action\":\"warn\"}}'" - }, - "generated": null, - "identity": null, - "name": "system_rules", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "10", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "max_file_size_mb", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 1, - "default": { - "value": "'{image/jpeg,image/png,image/gif,image/webp}'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "allowed_file_types", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'redact'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "pii_action", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "type", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "config", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "100", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "priority", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "true", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "enabled", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'block'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "action", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "log_id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "rule_id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "rule_name", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "category", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "action_taken", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "matched_pattern", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "matched_content", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "content_hash", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "api_key_id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "installation" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "installation" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "installation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "uuid", - "entityType": "columns", - "schema": "public", - "table": "installation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "type", - "entityType": "columns", - "schema": "public", - "table": "installation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "lock" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "lock" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "lock" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "key", - "entityType": "columns", - "schema": "public", - "table": "lock" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "request_id", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "project_id", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "api_key_id", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "duration", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "time_to_first_token", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "time_to_first_reasoning_token", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "requested_model", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "requested_provider", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_model", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_model_mapping", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_provider", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "response_size", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "content", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reasoning_content", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "tools", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "tool_choice", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "tool_results", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "finish_reason", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "unified_finish_reason", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "prompt_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "completion_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "total_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reasoning_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "cached_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "messages", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "temperature", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "max_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "top_p", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "frequency_penalty", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "presence_penalty", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reasoning_effort", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "effort", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "response_format", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "has_error", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "error_details", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "input_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "output_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "cached_input_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "request_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "web_search_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "image_input_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "image_output_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "image_input_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "image_output_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "estimated_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "discount", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "service_fee", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "pricing_tier", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "canceled", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "streamed", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "mode", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_mode", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "source", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "custom_headers", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "routing_metadata", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "processed_at", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "raw_request", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "raw_response", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "upstream_request", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "upstream_response", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "trace_id", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "data_retention_cleaned_up", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "data_storage_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "params", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_agent", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "plugins", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "plugin_results", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "chat_id", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "role", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "content", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "images", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reasoning", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "tools", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "sequence", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "released_at", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'(empty)'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "json", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "type": "unknown", - "value": "'[]'" - }, - "generated": null, - "identity": null, - "name": "aliases", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'(empty)'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "description", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "family", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "free", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "json", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "type": "unknown", - "value": "'[\"text\"]'" - }, - "generated": null, - "identity": null, - "name": "output", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'stable'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "stability", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "logs_count", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "errors_count", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_count", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "avg_time_to_first_token", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "avg_time_to_first_reasoning_token", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stats_updated_at", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model_id", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "minute_timestamp", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "logs_count", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_count", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_input_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_output_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_reasoning_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_cached_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_duration", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_time_to_first_token", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_time_to_first_reasoning_token", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model_id", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "provider_id", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model_name", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "input_price", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "output_price", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "cached_input_price", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "image_input_price", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "request_price", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "context_size", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "max_output", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "streaming", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "vision", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reasoning", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reasoning_output", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "tools", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "json_output", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "json_output_schema", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "web_search", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "web_search_price", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "discount", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'stable'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "stability", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "supported_parameters", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "test", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "deprecated_at", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "deactivated_at", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "logs_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "avg_time_to_first_token", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "avg_time_to_first_reasoning_token", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stats_updated_at", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model_id", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "provider_id", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model_provider_mapping_id", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "minute_timestamp", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "logs_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_input_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_output_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_reasoning_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_cached_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_duration", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_time_to_first_token", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_time_to_first_reasoning_token", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "billing_email", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "billing_company", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "billing_address", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "billing_tax_id", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "billing_notes", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stripe_customer_id", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stripe_subscription_id", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "credits", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "auto_top_up_enabled", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'10'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "auto_top_up_threshold", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'10'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "auto_top_up_amount", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'free'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "plan", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "plan_expires_at", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "subscription_cancelled", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "trial_start_date", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "trial_end_date", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "is_trial_active", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'none'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "retention_level", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "referral_earnings", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "payment_failure_count", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "last_payment_failure_at", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "is_personal", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'none'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "dev_plan", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "dev_plan_credits_used", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "dev_plan_credits_limit", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "dev_plan_billing_cycle_start", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "dev_plan_stripe_subscription_id", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "dev_plan_cancelled", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "dev_plan_expires_at", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "dev_plan_allow_all_models", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "organization_action" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "organization_action" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "organization_action" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "organization_action" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "type", - "entityType": "columns", - "schema": "public", - "table": "organization_action" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "amount", - "entityType": "columns", - "schema": "public", - "table": "organization_action" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "description", - "entityType": "columns", - "schema": "public", - "table": "organization_action" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "public_key", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_id", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "credential_id", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "counter", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "device_type", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "backed_up", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "transports", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "payment_method" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "payment_method" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "payment_method" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stripe_payment_method_id", - "entityType": "columns", - "schema": "public", - "table": "payment_method" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "payment_method" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "type", - "entityType": "columns", - "schema": "public", - "table": "payment_method" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "is_default", - "entityType": "columns", - "schema": "public", - "table": "payment_method" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "caching_enabled", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "60", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cache_duration_seconds", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'hybrid'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "mode", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "project_id", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "hour_timestamp", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_model", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_provider", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cache_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "streamed_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "non_streamed_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "completed_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "length_limit_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "content_filter_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "tool_calls_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "canceled_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "unknown_finish_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "reasoning_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "data_storage_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "service_fee", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "discount_savings", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "project_id", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "hour_timestamp", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cache_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "streamed_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "non_streamed_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "completed_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "length_limit_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "content_filter_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "tool_calls_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "canceled_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "unknown_finish_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "reasoning_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "data_storage_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "service_fee", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "discount_savings", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "description", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "streaming", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "cancellation", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "color", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "website", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "announcement", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "logs_count", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "errors_count", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_errors_count", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_errors_count", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_errors_count", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_count", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "avg_time_to_first_token", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "avg_time_to_first_reasoning_token", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stats_updated_at", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "token", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "provider", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "base_url", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "options", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "referral" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "referral" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "referral" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "referrer_organization_id", - "entityType": "columns", - "schema": "public", - "table": "referral" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "referred_organization_id", - "entityType": "columns", - "schema": "public", - "table": "referral" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "expires_at", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "token", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "ip_address", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_agent", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_id", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "type", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "amount", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "credit_amount", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'USD'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "currency", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'completed'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stripe_payment_intent_id", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stripe_invoice_id", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "description", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "related_transaction_id", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "refund_reason", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "email", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "email_verified", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "image", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "onboarding_completed", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "user_organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "user_organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "user_organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_id", - "entityType": "columns", - "schema": "public", - "table": "user_organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "user_organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'owner'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "role", - "entityType": "columns", - "schema": "public", - "table": "user_organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "verification" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "identifier", - "entityType": "columns", - "schema": "public", - "table": "verification" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "value", - "entityType": "columns", - "schema": "public", - "table": "verification" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "expires_at", - "entityType": "columns", - "schema": "public", - "table": "verification" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "verification" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "verification" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "user_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "account_user_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "account" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "project_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_project_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "created_by", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_created_by_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "api_key_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_hourly_model_stats_api_key_id_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "project_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_hourly_model_stats_project_id_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_hourly_model_stats_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "api_key_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_hourly_stats_api_key_id_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "project_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_hourly_stats_project_id_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_hourly_stats_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "api_key_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_iam_rule_api_key_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "rule_type", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_iam_rule_rule_type_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "api_key_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "status", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_iam_rule_api_key_id_status_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "created_at", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "audit_log_organization_id_created_at_idx", - "entityType": "indexes", - "schema": "public", - "table": "audit_log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "user_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "audit_log_user_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "audit_log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "action", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "audit_log_action_idx", - "entityType": "indexes", - "schema": "public", - "table": "audit_log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "resource_type", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "audit_log_resource_type_idx", - "entityType": "indexes", - "schema": "public", - "table": "audit_log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "user_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "chat_user_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "chat" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "discount_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "discount" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "provider", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "discount_provider_idx", - "entityType": "indexes", - "schema": "public", - "table": "discount" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "model", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "discount_model_idx", - "entityType": "indexes", - "schema": "public", - "table": "discount" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "guardrail_config_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "guardrail_config" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "guardrail_rule_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "guardrail_rule" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "priority", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "guardrail_rule_priority_idx", - "entityType": "indexes", - "schema": "public", - "table": "guardrail_rule" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "created_at", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "guardrail_violation_org_created_idx", - "entityType": "indexes", - "schema": "public", - "table": "guardrail_violation" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "rule_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "created_at", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "guardrail_violation_rule_created_idx", - "entityType": "indexes", - "schema": "public", - "table": "guardrail_violation" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "project_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "created_at", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "log_project_id_created_at_idx", - "entityType": "indexes", - "schema": "public", - "table": "log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "created_at", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "used_model", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "used_provider", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "log_created_at_used_model_used_provider_idx", - "entityType": "indexes", - "schema": "public", - "table": "log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "project_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "created_at", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": "data_retention_cleaned_up = false", - "with": "", - "method": "btree", - "concurrently": false, - "name": "log_data_retention_pending_idx", - "entityType": "indexes", - "schema": "public", - "table": "log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "project_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "used_model", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "log_project_id_used_model_idx", - "entityType": "indexes", - "schema": "public", - "table": "log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "created_at", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": "processed_at IS NULL", - "with": "", - "method": "btree", - "concurrently": false, - "name": "log_processed_at_null_idx", - "entityType": "indexes", - "schema": "public", - "table": "log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "chat_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "message_chat_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "message" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "status", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "model_status_idx", - "entityType": "indexes", - "schema": "public", - "table": "model" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "minute_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "model_history_minute_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "model_history" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "status", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "model_provider_mapping_status_idx", - "entityType": "indexes", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "minute_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "model_provider_mapping_history_minute_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "minute_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "provider_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "model_provider_mapping_history_minute_timestamp_provider_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "minute_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "model_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "model_provider_mapping_history_minute_timestamp_model_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "organization_action_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "organization_action" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "user_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "passkey_user_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "passkey" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "payment_method_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "payment_method" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "project_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "project" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "project_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "project_hourly_model_stats_project_id_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "project_hourly_model_stats_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "project_hourly_stats_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "status", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "provider_status_idx", - "entityType": "indexes", - "schema": "public", - "table": "provider" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "provider_key_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "provider_key" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "referrer_organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "referral_referrer_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "referral" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "referred_organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "referral_referred_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "referral" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "user_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "session_user_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "session" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "transaction_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "transaction" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "user_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "user_organization_user_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "user_organization" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "user_organization_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "user_organization" - }, - { - "nameExplicit": false, - "columns": [ - "user_id" - ], - "schemaTo": "public", - "tableTo": "user", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "account_user_id_user_id_fk", - "entityType": "fks", - "schema": "public", - "table": "account" - }, - { - "nameExplicit": false, - "columns": [ - "project_id" - ], - "schemaTo": "public", - "tableTo": "project", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "api_key_project_id_project_id_fk", - "entityType": "fks", - "schema": "public", - "table": "api_key" - }, - { - "nameExplicit": false, - "columns": [ - "created_by" - ], - "schemaTo": "public", - "tableTo": "user", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "api_key_created_by_user_id_fk", - "entityType": "fks", - "schema": "public", - "table": "api_key" - }, - { - "nameExplicit": false, - "columns": [ - "api_key_id" - ], - "schemaTo": "public", - "tableTo": "api_key", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "api_key_iam_rule_api_key_id_api_key_id_fk", - "entityType": "fks", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "audit_log_organization_id_organization_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "audit_log" - }, - { - "nameExplicit": false, - "columns": [ - "user_id" - ], - "schemaTo": "public", - "tableTo": "user", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "audit_log_user_id_user_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "audit_log" - }, - { - "nameExplicit": false, - "columns": [ - "user_id" - ], - "schemaTo": "public", - "tableTo": "user", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "chat_user_id_user_id_fk", - "entityType": "fks", - "schema": "public", - "table": "chat" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "discount_organization_id_organization_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "discount" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "guardrail_config_organization_id_organization_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "guardrail_config" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "guardrail_rule_organization_id_organization_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "guardrail_rule" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "guardrail_violation_organization_id_organization_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "guardrail_violation" - }, - { - "nameExplicit": false, - "columns": [ - "chat_id" - ], - "schemaTo": "public", - "tableTo": "chat", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "message_chat_id_chat_id_fk", - "entityType": "fks", - "schema": "public", - "table": "message" - }, - { - "nameExplicit": false, - "columns": [ - "model_id" - ], - "schemaTo": "public", - "tableTo": "model", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "model_provider_mapping_model_id_model_id_fk", - "entityType": "fks", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "nameExplicit": false, - "columns": [ - "provider_id" - ], - "schemaTo": "public", - "tableTo": "provider", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "model_provider_mapping_provider_id_provider_id_fk", - "entityType": "fks", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "organization_action_organization_id_organization_id_fk", - "entityType": "fks", - "schema": "public", - "table": "organization_action" - }, - { - "nameExplicit": false, - "columns": [ - "user_id" - ], - "schemaTo": "public", - "tableTo": "user", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "passkey_user_id_user_id_fk", - "entityType": "fks", - "schema": "public", - "table": "passkey" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "payment_method_organization_id_organization_id_fk", - "entityType": "fks", - "schema": "public", - "table": "payment_method" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "project_organization_id_organization_id_fk", - "entityType": "fks", - "schema": "public", - "table": "project" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "provider_key_organization_id_organization_id_fk", - "entityType": "fks", - "schema": "public", - "table": "provider_key" - }, - { - "nameExplicit": false, - "columns": [ - "referrer_organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "referral_referrer_organization_id_organization_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "referral" - }, - { - "nameExplicit": false, - "columns": [ - "referred_organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "referral_referred_organization_id_organization_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "referral" - }, - { - "nameExplicit": false, - "columns": [ - "user_id" - ], - "schemaTo": "public", - "tableTo": "user", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "session_user_id_user_id_fk", - "entityType": "fks", - "schema": "public", - "table": "session" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "transaction_organization_id_organization_id_fk", - "entityType": "fks", - "schema": "public", - "table": "transaction" - }, - { - "nameExplicit": false, - "columns": [ - "user_id" - ], - "schemaTo": "public", - "tableTo": "user", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "user_organization_user_id_user_id_fk", - "entityType": "fks", - "schema": "public", - "table": "user_organization" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "user_organization_organization_id_organization_id_fk", - "entityType": "fks", - "schema": "public", - "table": "user_organization" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "account_pkey", - "schema": "public", - "table": "account", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "api_key_pkey", - "schema": "public", - "table": "api_key", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "api_key_hourly_model_stats_pkey", - "schema": "public", - "table": "api_key_hourly_model_stats", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "api_key_hourly_stats_pkey", - "schema": "public", - "table": "api_key_hourly_stats", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "api_key_iam_rule_pkey", - "schema": "public", - "table": "api_key_iam_rule", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "audit_log_pkey", - "schema": "public", - "table": "audit_log", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "chat_pkey", - "schema": "public", - "table": "chat", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "discount_pkey", - "schema": "public", - "table": "discount", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "guardrail_config_pkey", - "schema": "public", - "table": "guardrail_config", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "guardrail_rule_pkey", - "schema": "public", - "table": "guardrail_rule", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "guardrail_violation_pkey", - "schema": "public", - "table": "guardrail_violation", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "installation_pkey", - "schema": "public", - "table": "installation", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "lock_pkey", - "schema": "public", - "table": "lock", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "log_pkey", - "schema": "public", - "table": "log", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "message_pkey", - "schema": "public", - "table": "message", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "model_pkey", - "schema": "public", - "table": "model", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "model_history_pkey", - "schema": "public", - "table": "model_history", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "model_provider_mapping_pkey", - "schema": "public", - "table": "model_provider_mapping", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "model_provider_mapping_history_pkey", - "schema": "public", - "table": "model_provider_mapping_history", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "organization_pkey", - "schema": "public", - "table": "organization", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "organization_action_pkey", - "schema": "public", - "table": "organization_action", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "passkey_pkey", - "schema": "public", - "table": "passkey", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "payment_method_pkey", - "schema": "public", - "table": "payment_method", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "project_pkey", - "schema": "public", - "table": "project", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "project_hourly_model_stats_pkey", - "schema": "public", - "table": "project_hourly_model_stats", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "project_hourly_stats_pkey", - "schema": "public", - "table": "project_hourly_stats", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "provider_pkey", - "schema": "public", - "table": "provider", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "provider_key_pkey", - "schema": "public", - "table": "provider_key", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "referral_pkey", - "schema": "public", - "table": "referral", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "session_pkey", - "schema": "public", - "table": "session", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "transaction_pkey", - "schema": "public", - "table": "transaction", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "user_pkey", - "schema": "public", - "table": "user", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "user_organization_pkey", - "schema": "public", - "table": "user_organization", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "verification_pkey", - "schema": "public", - "table": "verification", - "entityType": "pks" - }, - { - "nameExplicit": false, - "columns": [ - "api_key_id", - "hour_timestamp", - "used_model", - "used_provider" - ], - "nullsNotDistinct": false, - "name": "api_key_hourly_model_stats_api_key_id_hour_timestamp_used_model_used_provider_unique", - "entityType": "uniques", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "nameExplicit": false, - "columns": [ - "api_key_id", - "hour_timestamp" - ], - "nullsNotDistinct": false, - "name": "api_key_hourly_stats_api_key_id_hour_timestamp_unique", - "entityType": "uniques", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "nameExplicit": true, - "columns": [ - "organization_id", - "provider", - "model" - ], - "nullsNotDistinct": false, - "name": "discount_org_provider_model_unique", - "entityType": "uniques", - "schema": "public", - "table": "discount" - }, - { - "nameExplicit": false, - "columns": [ - "model_id", - "minute_timestamp" - ], - "nullsNotDistinct": false, - "name": "model_history_model_id_minute_timestamp_unique", - "entityType": "uniques", - "schema": "public", - "table": "model_history" - }, - { - "nameExplicit": false, - "columns": [ - "model_id", - "provider_id" - ], - "nullsNotDistinct": false, - "name": "model_provider_mapping_model_id_provider_id_unique", - "entityType": "uniques", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "nameExplicit": false, - "columns": [ - "model_provider_mapping_id", - "minute_timestamp" - ], - "nullsNotDistinct": false, - "name": "model_provider_mapping_history_model_provider_mapping_id_minute_timestamp_unique", - "entityType": "uniques", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "nameExplicit": false, - "columns": [ - "project_id", - "hour_timestamp", - "used_model", - "used_provider" - ], - "nullsNotDistinct": false, - "name": "project_hourly_model_stats_project_id_hour_timestamp_used_model_used_provider_unique", - "entityType": "uniques", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "nameExplicit": false, - "columns": [ - "project_id", - "hour_timestamp" - ], - "nullsNotDistinct": false, - "name": "project_hourly_stats_project_id_hour_timestamp_unique", - "entityType": "uniques", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id", - "name" - ], - "nullsNotDistinct": false, - "name": "provider_key_organization_id_name_unique", - "entityType": "uniques", - "schema": "public", - "table": "provider_key" - }, - { - "nameExplicit": false, - "columns": [ - "token" - ], - "nullsNotDistinct": false, - "name": "api_key_token_unique", - "schema": "public", - "table": "api_key", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "nullsNotDistinct": false, - "name": "guardrail_config_organization_id_key", - "schema": "public", - "table": "guardrail_config", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "uuid" - ], - "nullsNotDistinct": false, - "name": "installation_uuid_unique", - "schema": "public", - "table": "installation", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "key" - ], - "nullsNotDistinct": false, - "name": "lock_key_unique", - "schema": "public", - "table": "lock", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "stripe_customer_id" - ], - "nullsNotDistinct": false, - "name": "organization_stripe_customer_id_key", - "schema": "public", - "table": "organization", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "stripe_subscription_id" - ], - "nullsNotDistinct": false, - "name": "organization_stripe_subscription_id_key", - "schema": "public", - "table": "organization", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "dev_plan_stripe_subscription_id" - ], - "nullsNotDistinct": false, - "name": "organization_dev_plan_stripe_subscription_id_key", - "schema": "public", - "table": "organization", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "referred_organization_id" - ], - "nullsNotDistinct": false, - "name": "referral_referred_organization_id_key", - "schema": "public", - "table": "referral", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "token" - ], - "nullsNotDistinct": false, - "name": "session_token_unique", - "schema": "public", - "table": "session", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "email" - ], - "nullsNotDistinct": false, - "name": "user_email_unique", - "schema": "public", - "table": "user", - "entityType": "uniques" - } - ], - "renames": [] -} \ No newline at end of file diff --git a/packages/db/migrations/meta/1770637415_snapshot.json b/packages/db/migrations/meta/1770720582_snapshot.json similarity index 99% rename from packages/db/migrations/meta/1770637415_snapshot.json rename to packages/db/migrations/meta/1770720582_snapshot.json index a1aa768e44..70fb320753 100644 --- a/packages/db/migrations/meta/1770637415_snapshot.json +++ b/packages/db/migrations/meta/1770720582_snapshot.json @@ -1,8 +1,8 @@ { "version": "8", "dialect": "postgres", - "id": "3817fdb8-3ade-4054-a8b8-43a4189256be", - "prevId": "742ab22b-3f9b-4cad-935e-83c05956fed5", + "id": "db4b212f-e700-4117-acfc-f55f777e92db", + "prevId": "e5fcbbc1-a429-4cb2-9b9d-329dc6387ffc", "ddl": [ { "isRlsEnabled": false, @@ -1083,6 +1083,22 @@ "schema": "public", "table": "api_key_hourly_model_stats" }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, { "type": "text", "typeSchema": null, @@ -1615,6 +1631,22 @@ "schema": "public", "table": "api_key_hourly_stats" }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_input_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, { "type": "text", "typeSchema": null, @@ -6771,6 +6803,22 @@ "schema": "public", "table": "project_hourly_model_stats" }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, { "type": "text", "typeSchema": null, @@ -7290,6 +7338,22 @@ "schema": "public", "table": "project_hourly_stats" }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "cached_input_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, { "type": "text", "typeSchema": null, diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index 48bf86691a..2a1e92a8dd 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -628,15 +628,8 @@ { "idx": 89, "version": "8", - "when": 1770637154916, - "tag": "1770637154_nervous_guardsmen", - "breakpoints": true - }, - { - "idx": 90, - "version": "8", - "when": 1770637415423, - "tag": "1770637415_dear_speed_demon", + "when": 1770720582877, + "tag": "1770720582_groovy_black_panther", "breakpoints": true } ] From f1278690a661a3ab9b3b1c174c01a3a311b46bf1 Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Tue, 10 Feb 2026 17:54:42 +0700 Subject: [PATCH 17/24] fix: regenerate clean migrations Co-Authored-By: Claude Opus 4.6 --- .../1770716656_solid_franklin_storm.sql | 4 - ...nther.sql => 1770720725_youthful_raza.sql} | 0 .../migrations/meta/1770716656_snapshot.json | 10639 ---------------- ...snapshot.json => 1770720725_snapshot.json} | 2 +- packages/db/migrations/meta/_journal.json | 11 +- 5 files changed, 3 insertions(+), 10653 deletions(-) delete mode 100644 packages/db/migrations/1770716656_solid_franklin_storm.sql rename packages/db/migrations/{1770720582_groovy_black_panther.sql => 1770720725_youthful_raza.sql} (100%) delete mode 100644 packages/db/migrations/meta/1770716656_snapshot.json rename packages/db/migrations/meta/{1770720582_snapshot.json => 1770720725_snapshot.json} (99%) diff --git a/packages/db/migrations/1770716656_solid_franklin_storm.sql b/packages/db/migrations/1770716656_solid_franklin_storm.sql deleted file mode 100644 index fe4192587d..0000000000 --- a/packages/db/migrations/1770716656_solid_franklin_storm.sql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TABLE "api_key_hourly_model_stats" ADD COLUMN "cached_input_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE "api_key_hourly_stats" ADD COLUMN "cached_input_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE "project_hourly_model_stats" ADD COLUMN "cached_input_cost" real DEFAULT 0 NOT NULL;--> statement-breakpoint -ALTER TABLE "project_hourly_stats" ADD COLUMN "cached_input_cost" real DEFAULT 0 NOT NULL; \ No newline at end of file diff --git a/packages/db/migrations/1770720582_groovy_black_panther.sql b/packages/db/migrations/1770720725_youthful_raza.sql similarity index 100% rename from packages/db/migrations/1770720582_groovy_black_panther.sql rename to packages/db/migrations/1770720725_youthful_raza.sql diff --git a/packages/db/migrations/meta/1770716656_snapshot.json b/packages/db/migrations/meta/1770716656_snapshot.json deleted file mode 100644 index e32c878433..0000000000 --- a/packages/db/migrations/meta/1770716656_snapshot.json +++ /dev/null @@ -1,10639 +0,0 @@ -{ - "version": "8", - "dialect": "postgres", - "id": "85c1de3a-1895-4119-a6f5-bc1bacfb29ea", - "prevId": "3817fdb8-3ade-4054-a8b8-43a4189256be", - "ddl": [ - { - "isRlsEnabled": false, - "name": "account", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "api_key", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "api_key_hourly_model_stats", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "api_key_hourly_stats", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "api_key_iam_rule", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "audit_log", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "chat", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "discount", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "guardrail_config", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "guardrail_rule", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "guardrail_violation", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "installation", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "lock", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "log", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "message", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "model", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "model_history", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "model_provider_mapping", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "model_provider_mapping_history", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "organization", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "organization_action", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "passkey", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "payment_method", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "project", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "project_hourly_model_stats", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "project_hourly_stats", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "provider", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "provider_key", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "referral", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "session", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "transaction", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "user", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "user_organization", - "entityType": "tables", - "schema": "public" - }, - { - "isRlsEnabled": false, - "name": "verification", - "entityType": "tables", - "schema": "public" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "account_id", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "provider_id", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_id", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "access_token", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "refresh_token", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id_token", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "access_token_expires_at", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "refresh_token_expires_at", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "scope", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "password", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "account" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "token", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "description", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "usage_limit", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "usage", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "project_id", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "created_by", - "entityType": "columns", - "schema": "public", - "table": "api_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "api_key_id", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "project_id", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "hour_timestamp", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_model", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_provider", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cache_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "streamed_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "non_streamed_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "completed_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "length_limit_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "content_filter_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "tool_calls_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "canceled_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "unknown_finish_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "reasoning_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "data_storage_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "service_fee", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "discount_savings", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "image_input_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "image_output_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_input_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "api_key_id", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "project_id", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "hour_timestamp", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cache_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "streamed_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "non_streamed_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "completed_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "length_limit_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "content_filter_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "tool_calls_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "canceled_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "unknown_finish_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_error_count", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "reasoning_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_tokens", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "data_storage_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "service_fee", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "discount_savings", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "image_input_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "image_output_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_input_cost", - "entityType": "columns", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "api_key_id", - "entityType": "columns", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "rule_type", - "entityType": "columns", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "type": "json", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "rule_value", - "entityType": "columns", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_id", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "action", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "resource_type", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "resource_id", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "metadata", - "entityType": "columns", - "schema": "public", - "table": "audit_log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "title", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_id", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "web_search", - "entityType": "columns", - "schema": "public", - "table": "chat" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "provider", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "discount_percent", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reason", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "expires_at", - "entityType": "columns", - "schema": "public", - "table": "discount" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "true", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "enabled", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "type": "unknown", - "value": "'{\"prompt_injection\":{\"enabled\":true,\"action\":\"block\"},\"jailbreak\":{\"enabled\":true,\"action\":\"block\"},\"pii_detection\":{\"enabled\":true,\"action\":\"redact\"},\"secrets\":{\"enabled\":true,\"action\":\"block\"},\"file_types\":{\"enabled\":true,\"action\":\"block\"},\"document_leakage\":{\"enabled\":false,\"action\":\"warn\"}}'" - }, - "generated": null, - "identity": null, - "name": "system_rules", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "10", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "max_file_size_mb", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 1, - "default": { - "value": "'{image/jpeg,image/png,image/gif,image/webp}'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "allowed_file_types", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'redact'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "pii_action", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "guardrail_config" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "type", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "config", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "100", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "priority", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "true", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "enabled", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'block'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "action", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "guardrail_rule" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "log_id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "rule_id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "rule_name", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "category", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "action_taken", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "matched_pattern", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "matched_content", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "content_hash", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "api_key_id", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "guardrail_violation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "installation" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "installation" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "installation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "uuid", - "entityType": "columns", - "schema": "public", - "table": "installation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "type", - "entityType": "columns", - "schema": "public", - "table": "installation" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "lock" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "lock" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "lock" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "key", - "entityType": "columns", - "schema": "public", - "table": "lock" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "request_id", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "project_id", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "api_key_id", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "duration", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "time_to_first_token", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "time_to_first_reasoning_token", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "requested_model", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "requested_provider", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_model", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_model_mapping", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_provider", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "response_size", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "content", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reasoning_content", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "tools", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "tool_choice", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "tool_results", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "finish_reason", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "unified_finish_reason", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "prompt_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "completion_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "total_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reasoning_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "cached_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "messages", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "temperature", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "max_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "top_p", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "frequency_penalty", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "presence_penalty", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reasoning_effort", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "effort", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "response_format", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "has_error", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "error_details", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "input_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "output_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "cached_input_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "request_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "web_search_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "image_input_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "image_output_tokens", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "image_input_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "image_output_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "estimated_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "discount", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "service_fee", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "pricing_tier", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "canceled", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "streamed", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "mode", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_mode", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "source", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "custom_headers", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "routing_metadata", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "processed_at", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "raw_request", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "raw_response", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "upstream_request", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "upstream_response", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "trace_id", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "data_retention_cleaned_up", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "data_storage_cost", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "params", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_agent", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "plugins", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "plugin_results", - "entityType": "columns", - "schema": "public", - "table": "log" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "chat_id", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "role", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "content", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "images", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reasoning", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "tools", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "sequence", - "entityType": "columns", - "schema": "public", - "table": "message" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "released_at", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'(empty)'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "json", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "type": "unknown", - "value": "'[]'" - }, - "generated": null, - "identity": null, - "name": "aliases", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'(empty)'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "description", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "family", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "free", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "json", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "type": "unknown", - "value": "'[\"text\"]'" - }, - "generated": null, - "identity": null, - "name": "output", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'stable'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "stability", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "logs_count", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "errors_count", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_count", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "avg_time_to_first_token", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "avg_time_to_first_reasoning_token", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stats_updated_at", - "entityType": "columns", - "schema": "public", - "table": "model" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model_id", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "minute_timestamp", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "logs_count", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_count", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_input_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_output_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_reasoning_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_cached_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_duration", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_time_to_first_token", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_time_to_first_reasoning_token", - "entityType": "columns", - "schema": "public", - "table": "model_history" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model_id", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "provider_id", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model_name", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "input_price", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "output_price", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "cached_input_price", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "image_input_price", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "request_price", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "context_size", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "max_output", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "streaming", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "vision", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reasoning", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "reasoning_output", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "tools", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "json_output", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "json_output_schema", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "web_search", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "web_search_price", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "discount", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'stable'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "stability", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "json", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "supported_parameters", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "test", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "deprecated_at", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "deactivated_at", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "logs_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "avg_time_to_first_token", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "avg_time_to_first_reasoning_token", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stats_updated_at", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model_id", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "provider_id", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "model_provider_mapping_id", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "minute_timestamp", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "logs_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_errors_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_count", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_input_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_output_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_reasoning_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_cached_tokens", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_duration", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_time_to_first_token", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_time_to_first_reasoning_token", - "entityType": "columns", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "billing_email", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "billing_company", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "billing_address", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "billing_tax_id", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "billing_notes", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stripe_customer_id", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stripe_subscription_id", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "credits", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "auto_top_up_enabled", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'10'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "auto_top_up_threshold", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'10'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "auto_top_up_amount", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'free'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "plan", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "plan_expires_at", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "subscription_cancelled", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "trial_start_date", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "trial_end_date", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "is_trial_active", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'none'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "retention_level", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "referral_earnings", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "payment_failure_count", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "last_payment_failure_at", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "is_personal", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'none'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "dev_plan", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "dev_plan_credits_used", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "dev_plan_credits_limit", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "dev_plan_billing_cycle_start", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "dev_plan_stripe_subscription_id", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "dev_plan_cancelled", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "dev_plan_expires_at", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "dev_plan_allow_all_models", - "entityType": "columns", - "schema": "public", - "table": "organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "organization_action" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "organization_action" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "organization_action" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "organization_action" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "type", - "entityType": "columns", - "schema": "public", - "table": "organization_action" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "amount", - "entityType": "columns", - "schema": "public", - "table": "organization_action" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "description", - "entityType": "columns", - "schema": "public", - "table": "organization_action" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "public_key", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_id", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "credential_id", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "counter", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "device_type", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "backed_up", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "transports", - "entityType": "columns", - "schema": "public", - "table": "passkey" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "payment_method" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "payment_method" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "payment_method" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stripe_payment_method_id", - "entityType": "columns", - "schema": "public", - "table": "payment_method" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "payment_method" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "type", - "entityType": "columns", - "schema": "public", - "table": "payment_method" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "is_default", - "entityType": "columns", - "schema": "public", - "table": "payment_method" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "caching_enabled", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "60", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cache_duration_seconds", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'hybrid'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "mode", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "project" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "project_id", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "hour_timestamp", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_model", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "used_provider", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cache_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "streamed_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "non_streamed_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "completed_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "length_limit_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "content_filter_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "tool_calls_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "canceled_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "unknown_finish_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "reasoning_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "data_storage_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "service_fee", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "discount_savings", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "image_input_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "image_output_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_input_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "project_id", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "hour_timestamp", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cache_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "streamed_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "non_streamed_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "completed_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "length_limit_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "content_filter_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "tool_calls_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "canceled_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "unknown_finish_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_error_count", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "total_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "reasoning_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'0'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_tokens", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "input_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "output_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "request_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "data_storage_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "service_fee", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "discount_savings", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "image_input_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "image_output_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "real", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_input_cost", - "entityType": "columns", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "description", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "streaming", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "cancellation", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "color", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "website", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "announcement", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "logs_count", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "errors_count", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "client_errors_count", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "gateway_errors_count", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "upstream_errors_count", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "integer", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "0", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "cached_count", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "avg_time_to_first_token", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "real", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "avg_time_to_first_reasoning_token", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stats_updated_at", - "entityType": "columns", - "schema": "public", - "table": "provider" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "token", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "provider", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "base_url", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "jsonb", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "options", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": { - "value": "'active'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "provider_key" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "referral" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "referral" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "referral" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "referrer_organization_id", - "entityType": "columns", - "schema": "public", - "table": "referral" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "referred_organization_id", - "entityType": "columns", - "schema": "public", - "table": "referral" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "expires_at", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "token", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "ip_address", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_agent", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_id", - "entityType": "columns", - "schema": "public", - "table": "session" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "type", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "amount", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "numeric", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "credit_amount", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'USD'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "currency", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'completed'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "status", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stripe_payment_intent_id", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "stripe_invoice_id", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "description", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "related_transaction_id", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "refund_reason", - "entityType": "columns", - "schema": "public", - "table": "transaction" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "name", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "email", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "email_verified", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "text", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "image", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "boolean", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "false", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "onboarding_completed", - "entityType": "columns", - "schema": "public", - "table": "user" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "user_organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "user_organization" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "user_organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "user_id", - "entityType": "columns", - "schema": "public", - "table": "user_organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "organization_id", - "entityType": "columns", - "schema": "public", - "table": "user_organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "'owner'", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "role", - "entityType": "columns", - "schema": "public", - "table": "user_organization" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "id", - "entityType": "columns", - "schema": "public", - "table": "verification" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "identifier", - "entityType": "columns", - "schema": "public", - "table": "verification" - }, - { - "type": "text", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "value", - "entityType": "columns", - "schema": "public", - "table": "verification" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": true, - "dimensions": 0, - "default": { - "value": "now()", - "type": "unknown" - }, - "generated": null, - "identity": null, - "name": "expires_at", - "entityType": "columns", - "schema": "public", - "table": "verification" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "created_at", - "entityType": "columns", - "schema": "public", - "table": "verification" - }, - { - "type": "timestamp", - "typeSchema": null, - "notNull": false, - "dimensions": 0, - "default": null, - "generated": null, - "identity": null, - "name": "updated_at", - "entityType": "columns", - "schema": "public", - "table": "verification" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "user_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "account_user_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "account" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "project_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_project_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "created_by", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_created_by_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "api_key_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_hourly_model_stats_api_key_id_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "project_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_hourly_model_stats_project_id_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_hourly_model_stats_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "api_key_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_hourly_stats_api_key_id_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "project_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_hourly_stats_project_id_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_hourly_stats_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "api_key_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_iam_rule_api_key_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "rule_type", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_iam_rule_rule_type_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "api_key_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "status", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "api_key_iam_rule_api_key_id_status_idx", - "entityType": "indexes", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "created_at", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "audit_log_organization_id_created_at_idx", - "entityType": "indexes", - "schema": "public", - "table": "audit_log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "user_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "audit_log_user_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "audit_log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "action", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "audit_log_action_idx", - "entityType": "indexes", - "schema": "public", - "table": "audit_log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "resource_type", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "audit_log_resource_type_idx", - "entityType": "indexes", - "schema": "public", - "table": "audit_log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "user_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "chat_user_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "chat" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "discount_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "discount" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "provider", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "discount_provider_idx", - "entityType": "indexes", - "schema": "public", - "table": "discount" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "model", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "discount_model_idx", - "entityType": "indexes", - "schema": "public", - "table": "discount" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "guardrail_config_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "guardrail_config" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "guardrail_rule_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "guardrail_rule" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "priority", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "guardrail_rule_priority_idx", - "entityType": "indexes", - "schema": "public", - "table": "guardrail_rule" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "created_at", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "guardrail_violation_org_created_idx", - "entityType": "indexes", - "schema": "public", - "table": "guardrail_violation" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "rule_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "created_at", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "guardrail_violation_rule_created_idx", - "entityType": "indexes", - "schema": "public", - "table": "guardrail_violation" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "project_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "created_at", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "log_project_id_created_at_idx", - "entityType": "indexes", - "schema": "public", - "table": "log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "created_at", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "used_model", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "used_provider", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "log_created_at_used_model_used_provider_idx", - "entityType": "indexes", - "schema": "public", - "table": "log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "project_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "created_at", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": "data_retention_cleaned_up = false", - "with": "", - "method": "btree", - "concurrently": false, - "name": "log_data_retention_pending_idx", - "entityType": "indexes", - "schema": "public", - "table": "log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "project_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "used_model", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "log_project_id_used_model_idx", - "entityType": "indexes", - "schema": "public", - "table": "log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "created_at", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": "processed_at IS NULL", - "with": "", - "method": "btree", - "concurrently": false, - "name": "log_processed_at_null_idx", - "entityType": "indexes", - "schema": "public", - "table": "log" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "chat_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "message_chat_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "message" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "status", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "model_status_idx", - "entityType": "indexes", - "schema": "public", - "table": "model" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "minute_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "model_history_minute_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "model_history" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "status", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "model_provider_mapping_status_idx", - "entityType": "indexes", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "minute_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "model_provider_mapping_history_minute_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "minute_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "provider_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "model_provider_mapping_history_minute_timestamp_provider_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "minute_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "model_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "model_provider_mapping_history_minute_timestamp_model_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "organization_action_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "organization_action" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "user_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "passkey_user_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "passkey" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "payment_method_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "payment_method" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "project_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "project" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "project_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - }, - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "project_hourly_model_stats_project_id_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "project_hourly_model_stats_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "hour_timestamp", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "project_hourly_stats_hour_timestamp_idx", - "entityType": "indexes", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "status", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "provider_status_idx", - "entityType": "indexes", - "schema": "public", - "table": "provider" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "provider_key_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "provider_key" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "referrer_organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "referral_referrer_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "referral" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "referred_organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "referral_referred_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "referral" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "user_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "session_user_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "session" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "transaction_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "transaction" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "user_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "user_organization_user_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "user_organization" - }, - { - "nameExplicit": true, - "columns": [ - { - "value": "organization_id", - "isExpression": false, - "asc": true, - "nullsFirst": false, - "opclass": null - } - ], - "isUnique": false, - "where": null, - "with": "", - "method": "btree", - "concurrently": false, - "name": "user_organization_organization_id_idx", - "entityType": "indexes", - "schema": "public", - "table": "user_organization" - }, - { - "nameExplicit": false, - "columns": [ - "user_id" - ], - "schemaTo": "public", - "tableTo": "user", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "account_user_id_user_id_fk", - "entityType": "fks", - "schema": "public", - "table": "account" - }, - { - "nameExplicit": false, - "columns": [ - "project_id" - ], - "schemaTo": "public", - "tableTo": "project", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "api_key_project_id_project_id_fk", - "entityType": "fks", - "schema": "public", - "table": "api_key" - }, - { - "nameExplicit": false, - "columns": [ - "created_by" - ], - "schemaTo": "public", - "tableTo": "user", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "api_key_created_by_user_id_fk", - "entityType": "fks", - "schema": "public", - "table": "api_key" - }, - { - "nameExplicit": false, - "columns": [ - "api_key_id" - ], - "schemaTo": "public", - "tableTo": "api_key", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "api_key_iam_rule_api_key_id_api_key_id_fk", - "entityType": "fks", - "schema": "public", - "table": "api_key_iam_rule" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "audit_log_organization_id_organization_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "audit_log" - }, - { - "nameExplicit": false, - "columns": [ - "user_id" - ], - "schemaTo": "public", - "tableTo": "user", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "audit_log_user_id_user_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "audit_log" - }, - { - "nameExplicit": false, - "columns": [ - "user_id" - ], - "schemaTo": "public", - "tableTo": "user", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "chat_user_id_user_id_fk", - "entityType": "fks", - "schema": "public", - "table": "chat" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "discount_organization_id_organization_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "discount" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "guardrail_config_organization_id_organization_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "guardrail_config" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "guardrail_rule_organization_id_organization_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "guardrail_rule" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "guardrail_violation_organization_id_organization_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "guardrail_violation" - }, - { - "nameExplicit": false, - "columns": [ - "chat_id" - ], - "schemaTo": "public", - "tableTo": "chat", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "message_chat_id_chat_id_fk", - "entityType": "fks", - "schema": "public", - "table": "message" - }, - { - "nameExplicit": false, - "columns": [ - "model_id" - ], - "schemaTo": "public", - "tableTo": "model", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "model_provider_mapping_model_id_model_id_fk", - "entityType": "fks", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "nameExplicit": false, - "columns": [ - "provider_id" - ], - "schemaTo": "public", - "tableTo": "provider", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "model_provider_mapping_provider_id_provider_id_fk", - "entityType": "fks", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "organization_action_organization_id_organization_id_fk", - "entityType": "fks", - "schema": "public", - "table": "organization_action" - }, - { - "nameExplicit": false, - "columns": [ - "user_id" - ], - "schemaTo": "public", - "tableTo": "user", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "passkey_user_id_user_id_fk", - "entityType": "fks", - "schema": "public", - "table": "passkey" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "payment_method_organization_id_organization_id_fk", - "entityType": "fks", - "schema": "public", - "table": "payment_method" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "project_organization_id_organization_id_fk", - "entityType": "fks", - "schema": "public", - "table": "project" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "provider_key_organization_id_organization_id_fk", - "entityType": "fks", - "schema": "public", - "table": "provider_key" - }, - { - "nameExplicit": false, - "columns": [ - "referrer_organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "referral_referrer_organization_id_organization_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "referral" - }, - { - "nameExplicit": false, - "columns": [ - "referred_organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "referral_referred_organization_id_organization_id_fkey", - "entityType": "fks", - "schema": "public", - "table": "referral" - }, - { - "nameExplicit": false, - "columns": [ - "user_id" - ], - "schemaTo": "public", - "tableTo": "user", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "session_user_id_user_id_fk", - "entityType": "fks", - "schema": "public", - "table": "session" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "transaction_organization_id_organization_id_fk", - "entityType": "fks", - "schema": "public", - "table": "transaction" - }, - { - "nameExplicit": false, - "columns": [ - "user_id" - ], - "schemaTo": "public", - "tableTo": "user", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "user_organization_user_id_user_id_fk", - "entityType": "fks", - "schema": "public", - "table": "user_organization" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "schemaTo": "public", - "tableTo": "organization", - "columnsTo": [ - "id" - ], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "name": "user_organization_organization_id_organization_id_fk", - "entityType": "fks", - "schema": "public", - "table": "user_organization" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "account_pkey", - "schema": "public", - "table": "account", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "api_key_pkey", - "schema": "public", - "table": "api_key", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "api_key_hourly_model_stats_pkey", - "schema": "public", - "table": "api_key_hourly_model_stats", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "api_key_hourly_stats_pkey", - "schema": "public", - "table": "api_key_hourly_stats", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "api_key_iam_rule_pkey", - "schema": "public", - "table": "api_key_iam_rule", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "audit_log_pkey", - "schema": "public", - "table": "audit_log", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "chat_pkey", - "schema": "public", - "table": "chat", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "discount_pkey", - "schema": "public", - "table": "discount", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "guardrail_config_pkey", - "schema": "public", - "table": "guardrail_config", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "guardrail_rule_pkey", - "schema": "public", - "table": "guardrail_rule", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "guardrail_violation_pkey", - "schema": "public", - "table": "guardrail_violation", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "installation_pkey", - "schema": "public", - "table": "installation", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "lock_pkey", - "schema": "public", - "table": "lock", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "log_pkey", - "schema": "public", - "table": "log", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "message_pkey", - "schema": "public", - "table": "message", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "model_pkey", - "schema": "public", - "table": "model", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "model_history_pkey", - "schema": "public", - "table": "model_history", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "model_provider_mapping_pkey", - "schema": "public", - "table": "model_provider_mapping", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "model_provider_mapping_history_pkey", - "schema": "public", - "table": "model_provider_mapping_history", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "organization_pkey", - "schema": "public", - "table": "organization", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "organization_action_pkey", - "schema": "public", - "table": "organization_action", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "passkey_pkey", - "schema": "public", - "table": "passkey", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "payment_method_pkey", - "schema": "public", - "table": "payment_method", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "project_pkey", - "schema": "public", - "table": "project", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "project_hourly_model_stats_pkey", - "schema": "public", - "table": "project_hourly_model_stats", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "project_hourly_stats_pkey", - "schema": "public", - "table": "project_hourly_stats", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "provider_pkey", - "schema": "public", - "table": "provider", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "provider_key_pkey", - "schema": "public", - "table": "provider_key", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "referral_pkey", - "schema": "public", - "table": "referral", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "session_pkey", - "schema": "public", - "table": "session", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "transaction_pkey", - "schema": "public", - "table": "transaction", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "user_pkey", - "schema": "public", - "table": "user", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "user_organization_pkey", - "schema": "public", - "table": "user_organization", - "entityType": "pks" - }, - { - "columns": [ - "id" - ], - "nameExplicit": false, - "name": "verification_pkey", - "schema": "public", - "table": "verification", - "entityType": "pks" - }, - { - "nameExplicit": false, - "columns": [ - "api_key_id", - "hour_timestamp", - "used_model", - "used_provider" - ], - "nullsNotDistinct": false, - "name": "api_key_hourly_model_stats_api_key_id_hour_timestamp_used_model_used_provider_unique", - "entityType": "uniques", - "schema": "public", - "table": "api_key_hourly_model_stats" - }, - { - "nameExplicit": false, - "columns": [ - "api_key_id", - "hour_timestamp" - ], - "nullsNotDistinct": false, - "name": "api_key_hourly_stats_api_key_id_hour_timestamp_unique", - "entityType": "uniques", - "schema": "public", - "table": "api_key_hourly_stats" - }, - { - "nameExplicit": true, - "columns": [ - "organization_id", - "provider", - "model" - ], - "nullsNotDistinct": false, - "name": "discount_org_provider_model_unique", - "entityType": "uniques", - "schema": "public", - "table": "discount" - }, - { - "nameExplicit": false, - "columns": [ - "model_id", - "minute_timestamp" - ], - "nullsNotDistinct": false, - "name": "model_history_model_id_minute_timestamp_unique", - "entityType": "uniques", - "schema": "public", - "table": "model_history" - }, - { - "nameExplicit": false, - "columns": [ - "model_id", - "provider_id" - ], - "nullsNotDistinct": false, - "name": "model_provider_mapping_model_id_provider_id_unique", - "entityType": "uniques", - "schema": "public", - "table": "model_provider_mapping" - }, - { - "nameExplicit": false, - "columns": [ - "model_provider_mapping_id", - "minute_timestamp" - ], - "nullsNotDistinct": false, - "name": "model_provider_mapping_history_model_provider_mapping_id_minute_timestamp_unique", - "entityType": "uniques", - "schema": "public", - "table": "model_provider_mapping_history" - }, - { - "nameExplicit": false, - "columns": [ - "project_id", - "hour_timestamp", - "used_model", - "used_provider" - ], - "nullsNotDistinct": false, - "name": "project_hourly_model_stats_project_id_hour_timestamp_used_model_used_provider_unique", - "entityType": "uniques", - "schema": "public", - "table": "project_hourly_model_stats" - }, - { - "nameExplicit": false, - "columns": [ - "project_id", - "hour_timestamp" - ], - "nullsNotDistinct": false, - "name": "project_hourly_stats_project_id_hour_timestamp_unique", - "entityType": "uniques", - "schema": "public", - "table": "project_hourly_stats" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id", - "name" - ], - "nullsNotDistinct": false, - "name": "provider_key_organization_id_name_unique", - "entityType": "uniques", - "schema": "public", - "table": "provider_key" - }, - { - "nameExplicit": false, - "columns": [ - "token" - ], - "nullsNotDistinct": false, - "name": "api_key_token_unique", - "schema": "public", - "table": "api_key", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "organization_id" - ], - "nullsNotDistinct": false, - "name": "guardrail_config_organization_id_key", - "schema": "public", - "table": "guardrail_config", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "uuid" - ], - "nullsNotDistinct": false, - "name": "installation_uuid_unique", - "schema": "public", - "table": "installation", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "key" - ], - "nullsNotDistinct": false, - "name": "lock_key_unique", - "schema": "public", - "table": "lock", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "stripe_customer_id" - ], - "nullsNotDistinct": false, - "name": "organization_stripe_customer_id_key", - "schema": "public", - "table": "organization", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "stripe_subscription_id" - ], - "nullsNotDistinct": false, - "name": "organization_stripe_subscription_id_key", - "schema": "public", - "table": "organization", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "dev_plan_stripe_subscription_id" - ], - "nullsNotDistinct": false, - "name": "organization_dev_plan_stripe_subscription_id_key", - "schema": "public", - "table": "organization", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "referred_organization_id" - ], - "nullsNotDistinct": false, - "name": "referral_referred_organization_id_key", - "schema": "public", - "table": "referral", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "token" - ], - "nullsNotDistinct": false, - "name": "session_token_unique", - "schema": "public", - "table": "session", - "entityType": "uniques" - }, - { - "nameExplicit": false, - "columns": [ - "email" - ], - "nullsNotDistinct": false, - "name": "user_email_unique", - "schema": "public", - "table": "user", - "entityType": "uniques" - } - ], - "renames": [] -} \ No newline at end of file diff --git a/packages/db/migrations/meta/1770720582_snapshot.json b/packages/db/migrations/meta/1770720725_snapshot.json similarity index 99% rename from packages/db/migrations/meta/1770720582_snapshot.json rename to packages/db/migrations/meta/1770720725_snapshot.json index 70fb320753..8c911b4816 100644 --- a/packages/db/migrations/meta/1770720582_snapshot.json +++ b/packages/db/migrations/meta/1770720725_snapshot.json @@ -1,7 +1,7 @@ { "version": "8", "dialect": "postgres", - "id": "db4b212f-e700-4117-acfc-f55f777e92db", + "id": "da8b9a5f-76d0-423b-a9f6-4328c3d2c37f", "prevId": "e5fcbbc1-a429-4cb2-9b9d-329dc6387ffc", "ddl": [ { diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index 17816dd6c6..467fd26b23 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -628,15 +628,8 @@ { "idx": 89, "version": "8", - "when": 1770720582877, - "tag": "1770720582_groovy_black_panther", - "breakpoints": true - }, - { - "idx": 91, - "version": "8", - "when": 1770716656316, - "tag": "1770716656_solid_franklin_storm", + "when": 1770720725838, + "tag": "1770720725_youthful_raza", "breakpoints": true } ] From a81383c8937652a606a77b311679daf1fe0156f4 Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Tue, 10 Feb 2026 19:06:00 +0700 Subject: [PATCH 18/24] feat(stats): enhance log processing for backfill and reprocessing --- .../src/services/project-stats-aggregator.ts | 153 ++++++++++++++---- 1 file changed, 120 insertions(+), 33 deletions(-) diff --git a/apps/worker/src/services/project-stats-aggregator.ts b/apps/worker/src/services/project-stats-aggregator.ts index 565cfb3915..53f8fa6f12 100644 --- a/apps/worker/src/services/project-stats-aggregator.ts +++ b/apps/worker/src/services/project-stats-aggregator.ts @@ -9,6 +9,7 @@ import { gte, lt, and, + isNull, } from "@llmgateway/db"; import { logger } from "@llmgateway/logger"; @@ -352,23 +353,27 @@ async function recalculateApiKeyHourlyModelStats( } } +// Number of hours to always re-process to catch late-arriving logs from queue lag +const RECENT_REPROCESS_HOURS = + Number(process.env.STATS_RECENT_REPROCESS_HOURS) || 3; + +// Batch size for backfill processing per run +const BACKFILL_BATCH_SIZE = + Number(process.env.STATS_BACKFILL_BATCH_SIZE) || 100; + /** - * Process logs from recent hours that may not have aggregation data yet. - * Scans the last 24 hours and creates/updates aggregation rows as needed. + * Process all logs that haven't been aggregated yet (backfill) and re-process + * recent hours to catch late-arriving logs from queue processing lag. */ export async function processRecentLogs() { const database = db; const currentHourStart = getCurrentHourStart(); - // Look back 24 hours for any project-hour buckets that need processing - const lookbackStart = new Date( - currentHourStart.getTime() - 24 * 60 * 60 * 1000, - ); - - logger.debug("Processing recent logs for stats aggregation..."); + let totalBucketsProcessed = 0; try { - // Find distinct project-hour combinations from recent logs (excluding current hour) - const recentBuckets = await database + // Phase 1: Backfill - find project-hour buckets that have NO stats rows yet + // This has no date limit, so it processes all historical data + const backfillBuckets = await database .select({ projectId: log.projectId, hourTimestamp: sql`date_trunc('hour', ${log.createdAt})`.as( @@ -376,48 +381,130 @@ export async function processRecentLogs() { ), }) .from(log) + .leftJoin( + projectHourlyStats, + and( + sql`${projectHourlyStats.projectId} = ${log.projectId}`, + sql`${projectHourlyStats.hourTimestamp} = date_trunc('hour', ${log.createdAt})`, + ), + ) .where( and( - gte(log.createdAt, lookbackStart), lt(log.createdAt, currentHourStart), + isNull(projectHourlyStats.projectId), ), ) .groupBy(log.projectId, sql`date_trunc('hour', ${log.createdAt})`) - .limit(100); + .orderBy(sql`date_trunc('hour', ${log.createdAt}) ASC`) + .limit(BACKFILL_BATCH_SIZE); - if (recentBuckets.length === 0) { - logger.debug("No recent logs found for stats aggregation"); - return { bucketsProcessed: 0 }; + if (backfillBuckets.length > 0) { + const bucketDates = backfillBuckets.map((b) => + new Date(b.hourTimestamp).getTime(), + ); + const oldestBucket = new Date(Math.min(...bucketDates)); + const newestBucket = new Date(Math.max(...bucketDates)); + + logger.info( + `[backfill] Found ${backfillBuckets.length} unprocessed project-hour buckets (oldest: ${oldestBucket.toISOString()}, newest: ${newestBucket.toISOString()})`, + ); + + for (let i = 0; i < backfillBuckets.length; i++) { + const bucket = backfillBuckets[i]; + const hourTimestamp = new Date(bucket.hourTimestamp); + + await recalculateProjectHourlyStats(bucket.projectId, hourTimestamp); + await recalculateProjectHourlyModelStats( + bucket.projectId, + hourTimestamp, + ); + await recalculateApiKeyHourlyStats(bucket.projectId, hourTimestamp); + await recalculateApiKeyHourlyModelStats( + bucket.projectId, + hourTimestamp, + ); + + logger.info( + `[backfill] Processed bucket ${i + 1}/${backfillBuckets.length}: project=${bucket.projectId} hour=${hourTimestamp.toISOString()}`, + ); + } + + totalBucketsProcessed += backfillBuckets.length; + + if (backfillBuckets.length === BACKFILL_BATCH_SIZE) { + logger.info( + `[backfill] Batch limit reached (${BACKFILL_BATCH_SIZE}), more unprocessed buckets may remain — will continue in next run`, + ); + } else { + logger.info( + `[backfill] Complete: ${backfillBuckets.length} buckets processed`, + ); + } + } else { + logger.debug("[backfill] No unprocessed buckets found"); } - logger.info( - `Found ${recentBuckets.length} project-hour buckets to process`, + // Phase 2: Re-process recent hours to catch late-arriving logs from queue lag + const reprocessStart = new Date( + currentHourStart.getTime() - RECENT_REPROCESS_HOURS * 60 * 60 * 1000, ); - for (const bucket of recentBuckets) { - const hourTimestamp = new Date(bucket.hourTimestamp); - - // Recalculate all aggregation tables for this bucket - await recalculateProjectHourlyStats(bucket.projectId, hourTimestamp); - await recalculateProjectHourlyModelStats(bucket.projectId, hourTimestamp); - await recalculateApiKeyHourlyStats(bucket.projectId, hourTimestamp); - await recalculateApiKeyHourlyModelStats(bucket.projectId, hourTimestamp); + const recentBuckets = await database + .select({ + projectId: log.projectId, + hourTimestamp: sql`date_trunc('hour', ${log.createdAt})`.as( + "hourTimestamp", + ), + }) + .from(log) + .where( + and( + gte(log.createdAt, reprocessStart), + lt(log.createdAt, currentHourStart), + ), + ) + .groupBy(log.projectId, sql`date_trunc('hour', ${log.createdAt})`); - logger.debug( - `Processed bucket ${bucket.projectId}/${hourTimestamp.toISOString()}`, + if (recentBuckets.length > 0) { + logger.info( + `[recent] Re-processing ${recentBuckets.length} project-hour buckets from last ${RECENT_REPROCESS_HOURS} hours (${reprocessStart.toISOString()} to ${currentHourStart.toISOString()})`, ); + + for (let i = 0; i < recentBuckets.length; i++) { + const bucket = recentBuckets[i]; + const hourTimestamp = new Date(bucket.hourTimestamp); + + await recalculateProjectHourlyStats(bucket.projectId, hourTimestamp); + await recalculateProjectHourlyModelStats( + bucket.projectId, + hourTimestamp, + ); + await recalculateApiKeyHourlyStats(bucket.projectId, hourTimestamp); + await recalculateApiKeyHourlyModelStats( + bucket.projectId, + hourTimestamp, + ); + + logger.info( + `[recent] Processed bucket ${i + 1}/${recentBuckets.length}: project=${bucket.projectId} hour=${hourTimestamp.toISOString()}`, + ); + } + + totalBucketsProcessed += recentBuckets.length; + } else { + logger.debug("[recent] No recent buckets to re-process"); } logger.info( - `Stats aggregation complete: ${recentBuckets.length} buckets processed`, + `Stats aggregation complete: ${totalBucketsProcessed} total buckets processed`, ); return { - bucketsProcessed: recentBuckets.length, + bucketsProcessed: totalBucketsProcessed, }; } catch (error) { logger.error( - "Error processing recent logs for stats aggregation", + "Error processing logs for stats aggregation", error instanceof Error ? error : new Error(String(error)), ); throw error; @@ -431,7 +518,7 @@ export async function refreshCurrentHourStats() { const database = db; const currentHourStart = getCurrentHourStart(); - logger.debug( + logger.info( `Refreshing current hour stats for ${currentHourStart.toISOString()}`, ); @@ -451,8 +538,8 @@ export async function refreshCurrentHourStats() { await recalculateApiKeyHourlyModelStats(projectId, currentHourStart); } - logger.debug( - `Refreshed current hour stats for ${projectsWithCurrentHourLogs.length} projects`, + logger.info( + `Refreshed current hour stats (${currentHourStart.toISOString()}) for ${projectsWithCurrentHourLogs.length} projects`, ); } catch (error) { logger.error( From c5bdf4d5c84795dff14d7eb08f6efa6fbefb9641 Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Tue, 10 Feb 2026 19:26:01 +0700 Subject: [PATCH 19/24] feat(stats): add stale detection and model breakdown - Replace fixed 24h lookback with two-phase processing: Phase 1 (backfill): finds unprocessed buckets via LEFT JOIN Phase 2 (stale): detects buckets with new logs via HAVING - Add per-API-key model breakdown using apiKeyHourlyModelStats - Improve aggregation logging with [backfill]/[stale] prefixes Co-Authored-By: Claude Opus 4.6 --- apps/api/src/routes/activity.ts | 67 ++++++++++++- .../src/services/project-stats-aggregator.ts | 57 +++++++---- apps/worker/src/worker.ts | 2 +- packages/scripts/src/generate-test-logs.ts | 96 ++++++++++++++----- 4 files changed, 175 insertions(+), 47 deletions(-) diff --git a/apps/api/src/routes/activity.ts b/apps/api/src/routes/activity.ts index 517a6a93e3..59f3be3f63 100644 --- a/apps/api/src/routes/activity.ts +++ b/apps/api/src/routes/activity.ts @@ -15,6 +15,7 @@ import { projectHourlyStats, projectHourlyModelStats, apiKeyHourlyStats, + apiKeyHourlyModelStats, } from "@llmgateway/db"; import type { ServerTypes } from "@/vars.js"; @@ -219,8 +220,68 @@ activity.openapi(getActivity, async (c) => { .groupBy(sql`DATE(${apiKeyHourlyStats.hourTimestamp})`) .orderBy(sql`DATE(${apiKeyHourlyStats.hourTimestamp}) ASC`); - // Note: We don't have per-apikey-model aggregation, so model breakdown is empty for apiKeyId filter - // This is a tradeoff to avoid exploding cardinality (apiKey * model * provider * hour) + // Query model breakdown from apiKeyHourlyModelStats table + const modelBreakdowns = await db + .select({ + date: sql`DATE(${apiKeyHourlyModelStats.hourTimestamp})`.as( + "date", + ), + usedModel: apiKeyHourlyModelStats.usedModel, + usedProvider: apiKeyHourlyModelStats.usedProvider, + requestCount: + sql`COALESCE(SUM(${apiKeyHourlyModelStats.requestCount}), 0)`.as( + "requestCount", + ), + inputTokens: + sql`COALESCE(SUM(CAST(${apiKeyHourlyModelStats.inputTokens} AS NUMERIC)), 0)`.as( + "inputTokens", + ), + outputTokens: + sql`COALESCE(SUM(CAST(${apiKeyHourlyModelStats.outputTokens} AS NUMERIC)), 0)`.as( + "outputTokens", + ), + totalTokens: + sql`COALESCE(SUM(CAST(${apiKeyHourlyModelStats.totalTokens} AS NUMERIC)), 0)`.as( + "totalTokens", + ), + cost: sql`COALESCE(SUM(${apiKeyHourlyModelStats.cost}), 0)`.as( + "cost", + ), + }) + .from(apiKeyHourlyModelStats) + .where( + and( + eq(apiKeyHourlyModelStats.apiKeyId, apiKeyId), + inArray(apiKeyHourlyModelStats.projectId, projectIds), + gte(apiKeyHourlyModelStats.hourTimestamp, startDate), + lte(apiKeyHourlyModelStats.hourTimestamp, endDate), + ), + ) + .groupBy( + sql`DATE(${apiKeyHourlyModelStats.hourTimestamp}), ${apiKeyHourlyModelStats.usedModel}, ${apiKeyHourlyModelStats.usedProvider}`, + ) + .orderBy( + sql`DATE(${apiKeyHourlyModelStats.hourTimestamp}) ASC, ${apiKeyHourlyModelStats.usedModel} ASC`, + ); + + const modelBreakdownByDate = new Map< + string, + z.infer[] + >(); + for (const breakdown of modelBreakdowns) { + if (!modelBreakdownByDate.has(breakdown.date)) { + modelBreakdownByDate.set(breakdown.date, []); + } + modelBreakdownByDate.get(breakdown.date)!.push({ + id: breakdown.usedModel || "unknown", + provider: breakdown.usedProvider || "unknown", + requestCount: Number(breakdown.requestCount), + inputTokens: Number(breakdown.inputTokens), + outputTokens: Number(breakdown.outputTokens), + totalTokens: Number(breakdown.totalTokens), + cost: Number(breakdown.cost), + }); + } // Process daily aggregates and add calculated fields const activityData = hourlyAggregates.map((day) => { @@ -266,7 +327,7 @@ activity.openapi(getActivity, async (c) => { cacheCount, cacheRate, discountSavings, - modelBreakdown: [], // No per-apikey model breakdown to avoid cardinality explosion + modelBreakdown: modelBreakdownByDate.get(day.date) || [], }; }); diff --git a/apps/worker/src/services/project-stats-aggregator.ts b/apps/worker/src/services/project-stats-aggregator.ts index 53f8fa6f12..026283d0f7 100644 --- a/apps/worker/src/services/project-stats-aggregator.ts +++ b/apps/worker/src/services/project-stats-aggregator.ts @@ -353,10 +353,6 @@ async function recalculateApiKeyHourlyModelStats( } } -// Number of hours to always re-process to catch late-arriving logs from queue lag -const RECENT_REPROCESS_HOURS = - Number(process.env.STATS_RECENT_REPROCESS_HOURS) || 3; - // Batch size for backfill processing per run const BACKFILL_BATCH_SIZE = Number(process.env.STATS_BACKFILL_BATCH_SIZE) || 100; @@ -444,12 +440,10 @@ export async function processRecentLogs() { logger.debug("[backfill] No unprocessed buckets found"); } - // Phase 2: Re-process recent hours to catch late-arriving logs from queue lag - const reprocessStart = new Date( - currentHourStart.getTime() - RECENT_REPROCESS_HOURS * 60 * 60 * 1000, - ); - - const recentBuckets = await database + // Phase 2: Re-process stale buckets where new logs arrived after the last aggregation. + // Joins the log table with projectHourlyStats and finds buckets where + // the newest log (max createdAt) is newer than the stats row's updatedAt. + const staleBuckets = await database .select({ projectId: log.projectId, hourTimestamp: sql`date_trunc('hour', ${log.createdAt})`.as( @@ -457,21 +451,36 @@ export async function processRecentLogs() { ), }) .from(log) - .where( + .innerJoin( + projectHourlyStats, and( - gte(log.createdAt, reprocessStart), - lt(log.createdAt, currentHourStart), + sql`${projectHourlyStats.projectId} = ${log.projectId}`, + sql`${projectHourlyStats.hourTimestamp} = date_trunc('hour', ${log.createdAt})`, ), ) - .groupBy(log.projectId, sql`date_trunc('hour', ${log.createdAt})`); + .where(lt(log.createdAt, currentHourStart)) + .groupBy( + log.projectId, + sql`date_trunc('hour', ${log.createdAt})`, + projectHourlyStats.updatedAt, + ) + .having(sql`max(${log.createdAt}) > ${projectHourlyStats.updatedAt}`) + .orderBy(sql`date_trunc('hour', ${log.createdAt}) ASC`) + .limit(BACKFILL_BATCH_SIZE); + + if (staleBuckets.length > 0) { + const bucketDates = staleBuckets.map((b) => + new Date(b.hourTimestamp).getTime(), + ); + const oldestStale = new Date(Math.min(...bucketDates)); + const newestStale = new Date(Math.max(...bucketDates)); - if (recentBuckets.length > 0) { logger.info( - `[recent] Re-processing ${recentBuckets.length} project-hour buckets from last ${RECENT_REPROCESS_HOURS} hours (${reprocessStart.toISOString()} to ${currentHourStart.toISOString()})`, + `[stale] Found ${staleBuckets.length} stale project-hour buckets with new logs (oldest: ${oldestStale.toISOString()}, newest: ${newestStale.toISOString()})`, ); - for (let i = 0; i < recentBuckets.length; i++) { - const bucket = recentBuckets[i]; + for (let i = 0; i < staleBuckets.length; i++) { + const bucket = staleBuckets[i]; const hourTimestamp = new Date(bucket.hourTimestamp); await recalculateProjectHourlyStats(bucket.projectId, hourTimestamp); @@ -486,13 +495,19 @@ export async function processRecentLogs() { ); logger.info( - `[recent] Processed bucket ${i + 1}/${recentBuckets.length}: project=${bucket.projectId} hour=${hourTimestamp.toISOString()}`, + `[stale] Processed bucket ${i + 1}/${staleBuckets.length}: project=${bucket.projectId} hour=${hourTimestamp.toISOString()}`, ); } - totalBucketsProcessed += recentBuckets.length; + totalBucketsProcessed += staleBuckets.length; + + if (staleBuckets.length === BACKFILL_BATCH_SIZE) { + logger.info( + `[stale] Batch limit reached (${BACKFILL_BATCH_SIZE}), more stale buckets may remain — will continue in next run`, + ); + } } else { - logger.debug("[recent] No recent buckets to re-process"); + logger.debug("[stale] No stale buckets found"); } logger.info( diff --git a/apps/worker/src/worker.ts b/apps/worker/src/worker.ts index 7767244933..40f95f7b5c 100644 --- a/apps/worker/src/worker.ts +++ b/apps/worker/src/worker.ts @@ -523,7 +523,7 @@ export async function batchProcessLogs(): Promise { const row = schema.parse(raw); // Log each processed log with JSON format - logger.info("Processing log", { + logger.trace("Processing log", { kind: "log-process", status: row.hasError ? "error" : row.cached ? "cached" : "success", logId: row.id, diff --git a/packages/scripts/src/generate-test-logs.ts b/packages/scripts/src/generate-test-logs.ts index 5e0cdf1d99..3ede3844f5 100644 --- a/packages/scripts/src/generate-test-logs.ts +++ b/packages/scripts/src/generate-test-logs.ts @@ -20,6 +20,7 @@ const shortid = (size = 20) => generate(size); // Model configurations with realistic distributions // discount is applied to smaller/cheaper models (0.3 = 30% discount) +// cachedInputCostPer1k is typically 50% of input cost (or 0 if model doesn't support caching) const MODELS = [ { id: "gpt-4o", @@ -29,7 +30,9 @@ const MODELS = [ avgOutputTokens: 300, inputCostPer1k: 0.005, outputCostPer1k: 0.015, - discount: 0, // No discount for premium model + cachedInputCostPer1k: 0.0025, + cacheChance: 0.35, + discount: 0, }, { id: "gpt-4o-mini", @@ -39,7 +42,9 @@ const MODELS = [ avgOutputTokens: 250, inputCostPer1k: 0.00015, outputCostPer1k: 0.0006, - discount: 0.3, // 30% discount for smaller model + cachedInputCostPer1k: 0.000075, + cacheChance: 0.4, + discount: 0.3, }, { id: "claude-3-5-sonnet-20241022", @@ -49,7 +54,9 @@ const MODELS = [ avgOutputTokens: 400, inputCostPer1k: 0.003, outputCostPer1k: 0.015, - discount: 0, // No discount for premium model + cachedInputCostPer1k: 0.0003, + cacheChance: 0.3, + discount: 0, }, { id: "claude-3-5-haiku-20241022", @@ -59,7 +66,9 @@ const MODELS = [ avgOutputTokens: 200, inputCostPer1k: 0.0008, outputCostPer1k: 0.004, - discount: 0.3, // 30% discount for smaller model + cachedInputCostPer1k: 0.00008, + cacheChance: 0.25, + discount: 0.3, }, { id: "gemini-2.5-pro", @@ -69,7 +78,9 @@ const MODELS = [ avgOutputTokens: 350, inputCostPer1k: 0.00125, outputCostPer1k: 0.005, - discount: 0, // No discount for premium model + cachedInputCostPer1k: 0.000315, + cacheChance: 0.3, + discount: 0, }, { id: "gemini-2.5-flash", @@ -79,7 +90,9 @@ const MODELS = [ avgOutputTokens: 200, inputCostPer1k: 0.000075, outputCostPer1k: 0.0003, - discount: 0.3, // 30% discount for smaller model + cachedInputCostPer1k: 0.00001875, + cacheChance: 0.35, + discount: 0.3, }, { id: "deepseek-chat", @@ -89,7 +102,9 @@ const MODELS = [ avgOutputTokens: 300, inputCostPer1k: 0.00014, outputCostPer1k: 0.00028, - discount: 0.3, // 30% discount for smaller model + cachedInputCostPer1k: 0.000014, + cacheChance: 0.2, + discount: 0.3, }, ]; @@ -125,6 +140,15 @@ function randomFloat(min: number, max: number): number { return Math.random() * (max - min) + min; } +// Log-normal distribution for more realistic heavy-tailed randomness +// Most values cluster near the median, but occasional large outliers occur +function logNormalRandom(median: number, sigma: number): number { + const u1 = Math.random(); + const u2 = Math.random(); + const z = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2); + return median * Math.exp(sigma * z); +} + function randomDate(daysBack: number): Date { const now = new Date(); const msBack = randomInt(0, daysBack * 24 * 60 * 60 * 1000); @@ -140,28 +164,52 @@ function generateLog( const model = weightedRandom(MODELS); const finishReason = weightedRandom(FINISH_REASONS); - // Add variance to token counts (50-150% of average) - const inputTokens = Math.round(model.avgInputTokens * randomFloat(0.5, 1.5)); - const outputTokens = Math.round( - model.avgOutputTokens * randomFloat(0.5, 1.5), + // Use log-normal distribution for wide, realistic variance + // sigma=0.8 gives roughly 2x-5x spread in either direction from the median + const inputTokens = Math.max( + 1, + Math.round(logNormalRandom(model.avgInputTokens, 0.8)), + ); + const outputTokens = Math.max( + 1, + Math.round(logNormalRandom(model.avgOutputTokens, 0.9)), ); + + // Determine if this request has cached input tokens + const hasCachedTokens = Math.random() < model.cacheChance; + // Cached tokens are a portion (20-80%) of the input tokens + const cachedTokens = hasCachedTokens + ? Math.round(inputTokens * randomFloat(0.2, 0.8)) + : 0; + const totalTokens = inputTokens + outputTokens; // Calculate costs (before discount) - const inputCostBeforeDiscount = (inputTokens / 1000) * model.inputCostPer1k; - const outputCostBeforeDiscount = (outputTokens / 1000) * model.outputCostPer1k; - const costBeforeDiscount = inputCostBeforeDiscount + outputCostBeforeDiscount; + // For cached tokens, use the cheaper cached input price + const uncachedInputTokens = inputTokens - cachedTokens; + const inputCostBeforeDiscount = + (uncachedInputTokens / 1000) * model.inputCostPer1k; + const cachedInputCostBeforeDiscount = + (cachedTokens / 1000) * model.cachedInputCostPer1k; + const outputCostBeforeDiscount = + (outputTokens / 1000) * model.outputCostPer1k; + const costBeforeDiscount = + inputCostBeforeDiscount + + cachedInputCostBeforeDiscount + + outputCostBeforeDiscount; // Apply discount if model has one const discount = model.discount; const discountMultiplier = 1 - discount; const inputCost = inputCostBeforeDiscount * discountMultiplier; + const cachedInputCost = cachedInputCostBeforeDiscount * discountMultiplier; const outputCost = outputCostBeforeDiscount * discountMultiplier; const cost = costBeforeDiscount * discountMultiplier; - // Random duration (100ms - 5000ms, with most being fast) - const duration = Math.round( - Math.pow(randomFloat(10, 70), 2), // Skewed towards faster responses + // Log-normal duration for wide spread (most fast, some very slow) + const duration = Math.max( + 50, + Math.round(logNormalRandom(800, 1.0)), ); // Error states based on finish reason @@ -173,8 +221,10 @@ function generateLog( const streamed = Math.random() > 0.3; // 70% are streamed const cached = Math.random() > 0.9; // 10% are cached - // Time to first token (only for streamed, 50-500ms) - const timeToFirstToken = streamed ? randomInt(50, 500) : null; + // Time to first token (only for streamed, log-normal for variability) + const timeToFirstToken = streamed + ? Math.max(20, Math.round(logNormalRandom(150, 0.7))) + : null; // Generate date within the specified range const createdAt = randomDate(daysBack); @@ -195,13 +245,15 @@ function generateLog( requestedProvider: model.provider, usedModel: model.id, usedProvider: model.provider, - responseSize: outputTokens * 4, // Rough estimate + responseSize: outputTokens * randomInt(3, 6), // Variable bytes-per-token estimate promptTokens: String(inputTokens), completionTokens: String(outputTokens), totalTokens: String(totalTokens), + cachedTokens: cachedTokens > 0 ? String(cachedTokens) : null, cost, inputCost, outputCost, + cachedInputCost: cachedTokens > 0 ? cachedInputCost : null, requestCost: 0, discount, hasError, @@ -214,8 +266,8 @@ function generateLog( messages: JSON.stringify([ { role: "user", content: "Test message for visualization" }, ]), - temperature: randomFloat(0, 1), - maxTokens: randomInt(100, 4000), + temperature: randomFloat(0, 1.5), + maxTokens: Math.round(logNormalRandom(2000, 0.6)), }; } From ba07bac9772d89d894d103d3c0fe61d6f0016c4b Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Tue, 10 Feb 2026 19:40:22 +0700 Subject: [PATCH 20/24] style: use sharp lines in dashboard charts Co-Authored-By: Claude Opus 4.6 --- apps/ui/src/components/dashboard/overview.tsx | 8 ++++---- apps/ui/src/components/usage/cache-rate-chart.tsx | 2 +- apps/ui/src/components/usage/error-rate-chart.tsx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/ui/src/components/dashboard/overview.tsx b/apps/ui/src/components/dashboard/overview.tsx index af5fa6edfc..b80913c3cb 100644 --- a/apps/ui/src/components/dashboard/overview.tsx +++ b/apps/ui/src/components/dashboard/overview.tsx @@ -184,7 +184,7 @@ export function Overview({ {metric === "costs" ? ( <> ) : ( Date: Tue, 10 Feb 2026 20:12:48 +0700 Subject: [PATCH 21/24] feat(stats): add configuration for backfill and stale detection --- .../src/services/project-stats-aggregator.ts | 279 ++++++++++-------- 1 file changed, 159 insertions(+), 120 deletions(-) diff --git a/apps/worker/src/services/project-stats-aggregator.ts b/apps/worker/src/services/project-stats-aggregator.ts index 026283d0f7..7ef8c3c64f 100644 --- a/apps/worker/src/services/project-stats-aggregator.ts +++ b/apps/worker/src/services/project-stats-aggregator.ts @@ -353,13 +353,24 @@ async function recalculateApiKeyHourlyModelStats( } } -// Batch size for backfill processing per run -const BACKFILL_BATCH_SIZE = - Number(process.env.STATS_BACKFILL_BATCH_SIZE) || 100; +// Batch size per run (shared by both phases) +const STATS_BATCH_SIZE = Number(process.env.STATS_BATCH_SIZE) || 100; + +// Phase 1: Backfill — process hours with no stats rows yet +// STATS_BACKFILL_ENABLED: "true" (default) or "false" +// STATS_BACKFILL_DAYS: how far back to look (default: 30, 0 = unlimited) +const STATS_BACKFILL_ENABLED = process.env.STATS_BACKFILL_ENABLED !== "false"; +const STATS_BACKFILL_DAYS = Number(process.env.STATS_BACKFILL_DAYS) || 30; + +// Phase 2: Stale detection — re-process hours where new logs arrived after aggregation +// STATS_STALE_ENABLED: "true" (default) or "false" +// STATS_STALE_DAYS: how far back to check for stale buckets (default: 7, 0 = unlimited) +const STATS_STALE_ENABLED = process.env.STATS_STALE_ENABLED !== "false"; +const STATS_STALE_DAYS = Number(process.env.STATS_STALE_DAYS) || 7; /** * Process all logs that haven't been aggregated yet (backfill) and re-process - * recent hours to catch late-arriving logs from queue processing lag. + * stale buckets where new logs arrived after the last aggregation. */ export async function processRecentLogs() { const database = db; @@ -368,146 +379,174 @@ export async function processRecentLogs() { try { // Phase 1: Backfill - find project-hour buckets that have NO stats rows yet - // This has no date limit, so it processes all historical data - const backfillBuckets = await database - .select({ - projectId: log.projectId, - hourTimestamp: sql`date_trunc('hour', ${log.createdAt})`.as( - "hourTimestamp", - ), - }) - .from(log) - .leftJoin( - projectHourlyStats, - and( - sql`${projectHourlyStats.projectId} = ${log.projectId}`, - sql`${projectHourlyStats.hourTimestamp} = date_trunc('hour', ${log.createdAt})`, - ), - ) - .where( - and( - lt(log.createdAt, currentHourStart), - isNull(projectHourlyStats.projectId), - ), - ) - .groupBy(log.projectId, sql`date_trunc('hour', ${log.createdAt})`) - .orderBy(sql`date_trunc('hour', ${log.createdAt}) ASC`) - .limit(BACKFILL_BATCH_SIZE); - - if (backfillBuckets.length > 0) { - const bucketDates = backfillBuckets.map((b) => - new Date(b.hourTimestamp).getTime(), - ); - const oldestBucket = new Date(Math.min(...bucketDates)); - const newestBucket = new Date(Math.max(...bucketDates)); + if (STATS_BACKFILL_ENABLED) { + const backfillStart = + STATS_BACKFILL_DAYS > 0 + ? new Date( + currentHourStart.getTime() - + STATS_BACKFILL_DAYS * 24 * 60 * 60 * 1000, + ) + : undefined; logger.info( - `[backfill] Found ${backfillBuckets.length} unprocessed project-hour buckets (oldest: ${oldestBucket.toISOString()}, newest: ${newestBucket.toISOString()})`, + `[backfill] Scanning for unprocessed buckets (lookback: ${backfillStart ? backfillStart.toISOString() : "unlimited"})`, ); - for (let i = 0; i < backfillBuckets.length; i++) { - const bucket = backfillBuckets[i]; - const hourTimestamp = new Date(bucket.hourTimestamp); - - await recalculateProjectHourlyStats(bucket.projectId, hourTimestamp); - await recalculateProjectHourlyModelStats( - bucket.projectId, - hourTimestamp, - ); - await recalculateApiKeyHourlyStats(bucket.projectId, hourTimestamp); - await recalculateApiKeyHourlyModelStats( - bucket.projectId, - hourTimestamp, + const backfillBuckets = await database + .select({ + projectId: log.projectId, + hourTimestamp: sql`date_trunc('hour', ${log.createdAt})`.as( + "hourTimestamp", + ), + }) + .from(log) + .leftJoin( + projectHourlyStats, + and( + sql`${projectHourlyStats.projectId} = ${log.projectId}`, + sql`${projectHourlyStats.hourTimestamp} = date_trunc('hour', ${log.createdAt})`, + ), + ) + .where( + and( + lt(log.createdAt, currentHourStart), + isNull(projectHourlyStats.projectId), + backfillStart ? gte(log.createdAt, backfillStart) : undefined, + ), + ) + .groupBy(log.projectId, sql`date_trunc('hour', ${log.createdAt})`) + .orderBy(sql`date_trunc('hour', ${log.createdAt}) ASC`) + .limit(STATS_BATCH_SIZE); + + if (backfillBuckets.length > 0) { + const bucketDates = backfillBuckets.map((b) => + new Date(b.hourTimestamp).getTime(), ); + const oldestBucket = new Date(Math.min(...bucketDates)); + const newestBucket = new Date(Math.max(...bucketDates)); logger.info( - `[backfill] Processed bucket ${i + 1}/${backfillBuckets.length}: project=${bucket.projectId} hour=${hourTimestamp.toISOString()}`, + `[backfill] Found ${backfillBuckets.length} unprocessed project-hour buckets (oldest: ${oldestBucket.toISOString()}, newest: ${newestBucket.toISOString()})`, ); - } - - totalBucketsProcessed += backfillBuckets.length; - if (backfillBuckets.length === BACKFILL_BATCH_SIZE) { - logger.info( - `[backfill] Batch limit reached (${BACKFILL_BATCH_SIZE}), more unprocessed buckets may remain — will continue in next run`, - ); + for (let i = 0; i < backfillBuckets.length; i++) { + const bucket = backfillBuckets[i]; + const hourTimestamp = new Date(bucket.hourTimestamp); + + await recalculateProjectHourlyStats(bucket.projectId, hourTimestamp); + await recalculateProjectHourlyModelStats( + bucket.projectId, + hourTimestamp, + ); + await recalculateApiKeyHourlyStats(bucket.projectId, hourTimestamp); + await recalculateApiKeyHourlyModelStats( + bucket.projectId, + hourTimestamp, + ); + + logger.info( + `[backfill] Processed bucket ${i + 1}/${backfillBuckets.length}: project=${bucket.projectId} hour=${hourTimestamp.toISOString()}`, + ); + } + + totalBucketsProcessed += backfillBuckets.length; + + if (backfillBuckets.length === STATS_BATCH_SIZE) { + logger.info( + `[backfill] Batch limit reached (${STATS_BATCH_SIZE}), more unprocessed buckets may remain — will continue in next run`, + ); + } else { + logger.info( + `[backfill] Complete: ${backfillBuckets.length} buckets processed`, + ); + } } else { - logger.info( - `[backfill] Complete: ${backfillBuckets.length} buckets processed`, - ); + logger.debug("[backfill] No unprocessed buckets found"); } - } else { - logger.debug("[backfill] No unprocessed buckets found"); } // Phase 2: Re-process stale buckets where new logs arrived after the last aggregation. - // Joins the log table with projectHourlyStats and finds buckets where - // the newest log (max createdAt) is newer than the stats row's updatedAt. - const staleBuckets = await database - .select({ - projectId: log.projectId, - hourTimestamp: sql`date_trunc('hour', ${log.createdAt})`.as( - "hourTimestamp", - ), - }) - .from(log) - .innerJoin( - projectHourlyStats, - and( - sql`${projectHourlyStats.projectId} = ${log.projectId}`, - sql`${projectHourlyStats.hourTimestamp} = date_trunc('hour', ${log.createdAt})`, - ), - ) - .where(lt(log.createdAt, currentHourStart)) - .groupBy( - log.projectId, - sql`date_trunc('hour', ${log.createdAt})`, - projectHourlyStats.updatedAt, - ) - .having(sql`max(${log.createdAt}) > ${projectHourlyStats.updatedAt}`) - .orderBy(sql`date_trunc('hour', ${log.createdAt}) ASC`) - .limit(BACKFILL_BATCH_SIZE); - - if (staleBuckets.length > 0) { - const bucketDates = staleBuckets.map((b) => - new Date(b.hourTimestamp).getTime(), - ); - const oldestStale = new Date(Math.min(...bucketDates)); - const newestStale = new Date(Math.max(...bucketDates)); + // Iterates over the small project_hourly_stats table and uses a correlated + // subquery to check if any log in that bucket is newer than updatedAt. + // This leverages the (project_id, created_at) index for fast lookups. + if (STATS_STALE_ENABLED) { + const staleStart = + STATS_STALE_DAYS > 0 + ? new Date( + currentHourStart.getTime() - + STATS_STALE_DAYS * 24 * 60 * 60 * 1000, + ) + : undefined; logger.info( - `[stale] Found ${staleBuckets.length} stale project-hour buckets with new logs (oldest: ${oldestStale.toISOString()}, newest: ${newestStale.toISOString()})`, + `[stale] Scanning for stale buckets (lookback: ${staleStart ? staleStart.toISOString() : "unlimited"})`, ); - for (let i = 0; i < staleBuckets.length; i++) { - const bucket = staleBuckets[i]; - const hourTimestamp = new Date(bucket.hourTimestamp); - - await recalculateProjectHourlyStats(bucket.projectId, hourTimestamp); - await recalculateProjectHourlyModelStats( - bucket.projectId, - hourTimestamp, - ); - await recalculateApiKeyHourlyStats(bucket.projectId, hourTimestamp); - await recalculateApiKeyHourlyModelStats( - bucket.projectId, - hourTimestamp, + const staleBuckets = await database + .select({ + projectId: projectHourlyStats.projectId, + hourTimestamp: projectHourlyStats.hourTimestamp, + }) + .from(projectHourlyStats) + .where( + and( + staleStart + ? gte(projectHourlyStats.hourTimestamp, staleStart) + : undefined, + sql`EXISTS ( + SELECT 1 FROM ${log} + WHERE ${log.projectId} = ${projectHourlyStats.projectId} + AND ${log.createdAt} >= ${projectHourlyStats.hourTimestamp} + AND ${log.createdAt} < ${projectHourlyStats.hourTimestamp} + interval '1 hour' + AND ${log.createdAt} > ${projectHourlyStats.updatedAt} + LIMIT 1 + )`, + ), + ) + .orderBy(projectHourlyStats.hourTimestamp) + .limit(STATS_BATCH_SIZE); + + if (staleBuckets.length > 0) { + const bucketDates = staleBuckets.map((b) => + new Date(b.hourTimestamp).getTime(), ); + const oldestStale = new Date(Math.min(...bucketDates)); + const newestStale = new Date(Math.max(...bucketDates)); logger.info( - `[stale] Processed bucket ${i + 1}/${staleBuckets.length}: project=${bucket.projectId} hour=${hourTimestamp.toISOString()}`, + `[stale] Found ${staleBuckets.length} stale project-hour buckets with new logs (oldest: ${oldestStale.toISOString()}, newest: ${newestStale.toISOString()})`, ); - } - - totalBucketsProcessed += staleBuckets.length; - if (staleBuckets.length === BACKFILL_BATCH_SIZE) { - logger.info( - `[stale] Batch limit reached (${BACKFILL_BATCH_SIZE}), more stale buckets may remain — will continue in next run`, - ); + for (let i = 0; i < staleBuckets.length; i++) { + const bucket = staleBuckets[i]; + const hourTimestamp = new Date(bucket.hourTimestamp); + + await recalculateProjectHourlyStats(bucket.projectId, hourTimestamp); + await recalculateProjectHourlyModelStats( + bucket.projectId, + hourTimestamp, + ); + await recalculateApiKeyHourlyStats(bucket.projectId, hourTimestamp); + await recalculateApiKeyHourlyModelStats( + bucket.projectId, + hourTimestamp, + ); + + logger.info( + `[stale] Processed bucket ${i + 1}/${staleBuckets.length}: project=${bucket.projectId} hour=${hourTimestamp.toISOString()}`, + ); + } + + totalBucketsProcessed += staleBuckets.length; + + if (staleBuckets.length === STATS_BATCH_SIZE) { + logger.info( + `[stale] Batch limit reached (${STATS_BATCH_SIZE}), more stale buckets may remain — will continue in next run`, + ); + } + } else { + logger.debug("[stale] No stale buckets found"); } - } else { - logger.debug("[stale] No stale buckets found"); } logger.info( From ef16624083e15124dee63dcbf30bf4c456dea6ad Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Tue, 10 Feb 2026 21:06:48 +0700 Subject: [PATCH 22/24] feat(stats): add per-mode breakdowns to aggregations Add credits/api-keys breakdowns for request count, cost, service fee, and data storage cost to all 4 aggregation tables and the activity API. Co-Authored-By: Claude Opus 4.6 --- apps/admin/src/lib/api/v1.d.ts | 8 ++ apps/api/src/routes/activity.ts | 106 ++++++++++++++++++ apps/api/src/testing.ts | 33 ++++++ apps/code/src/lib/api/v1.d.ts | 8 ++ apps/playground/src/lib/api/v1.d.ts | 8 ++ apps/ui/src/lib/api/v1.d.ts | 8 ++ apps/ui/src/types/activity.ts | 16 +++ .../src/services/project-stats-aggregator.ts | 33 ++++++ packages/db/src/schema.ts | 36 ++++++ 9 files changed, 256 insertions(+) diff --git a/apps/admin/src/lib/api/v1.d.ts b/apps/admin/src/lib/api/v1.d.ts index 0468f37d52..5d9581086b 100644 --- a/apps/admin/src/lib/api/v1.d.ts +++ b/apps/admin/src/lib/api/v1.d.ts @@ -981,6 +981,14 @@ export interface paths { cacheCount: number; cacheRate: number; discountSavings: number; + creditsRequestCount: number; + apiKeysRequestCount: number; + creditsCost: number; + apiKeysCost: number; + creditsServiceFee: number; + apiKeysServiceFee: number; + creditsDataStorageCost: number; + apiKeysDataStorageCost: number; modelBreakdown: { id: string; provider: string; diff --git a/apps/api/src/routes/activity.ts b/apps/api/src/routes/activity.ts index 59f3be3f63..c3746a909f 100644 --- a/apps/api/src/routes/activity.ts +++ b/apps/api/src/routes/activity.ts @@ -54,6 +54,14 @@ const dailyActivitySchema = z.object({ cacheCount: z.number(), cacheRate: z.number(), discountSavings: z.number(), + creditsRequestCount: z.number(), + apiKeysRequestCount: z.number(), + creditsCost: z.number(), + apiKeysCost: z.number(), + creditsServiceFee: z.number(), + apiKeysServiceFee: z.number(), + creditsDataStorageCost: z.number(), + apiKeysDataStorageCost: z.number(), modelBreakdown: z.array(modelUsageSchema), }); @@ -207,6 +215,38 @@ activity.openapi(getActivity, async (c) => { sql`COALESCE(SUM(${apiKeyHourlyStats.cachedInputCost}), 0)`.as( "cachedInputCost", ), + creditsRequestCount: + sql`COALESCE(SUM(${apiKeyHourlyStats.creditsRequestCount}), 0)`.as( + "creditsRequestCount", + ), + apiKeysRequestCount: + sql`COALESCE(SUM(${apiKeyHourlyStats.apiKeysRequestCount}), 0)`.as( + "apiKeysRequestCount", + ), + creditsCost: + sql`COALESCE(SUM(${apiKeyHourlyStats.creditsCost}), 0)`.as( + "creditsCost", + ), + apiKeysCost: + sql`COALESCE(SUM(${apiKeyHourlyStats.apiKeysCost}), 0)`.as( + "apiKeysCost", + ), + creditsServiceFee: + sql`COALESCE(SUM(${apiKeyHourlyStats.creditsServiceFee}), 0)`.as( + "creditsServiceFee", + ), + apiKeysServiceFee: + sql`COALESCE(SUM(${apiKeyHourlyStats.apiKeysServiceFee}), 0)`.as( + "apiKeysServiceFee", + ), + creditsDataStorageCost: + sql`COALESCE(SUM(${apiKeyHourlyStats.creditsDataStorageCost}), 0)`.as( + "creditsDataStorageCost", + ), + apiKeysDataStorageCost: + sql`COALESCE(SUM(${apiKeyHourlyStats.apiKeysDataStorageCost}), 0)`.as( + "apiKeysDataStorageCost", + ), }) .from(apiKeyHourlyStats) .where( @@ -302,6 +342,15 @@ activity.openapi(getActivity, async (c) => { const imageOutputCost = Number(day.imageOutputCost); const cachedInputCost = Number(day.cachedInputCost); + const creditsRequestCount = Number(day.creditsRequestCount); + const apiKeysRequestCount = Number(day.apiKeysRequestCount); + const creditsCost = Number(day.creditsCost); + const apiKeysCost = Number(day.apiKeysCost); + const creditsServiceFee = Number(day.creditsServiceFee); + const apiKeysServiceFee = Number(day.apiKeysServiceFee); + const creditsDataStorageCost = Number(day.creditsDataStorageCost); + const apiKeysDataStorageCost = Number(day.apiKeysDataStorageCost); + const errorRate = requestCount > 0 ? (errorCount / requestCount) * 100 : 0; const cacheRate = @@ -327,6 +376,14 @@ activity.openapi(getActivity, async (c) => { cacheCount, cacheRate, discountSavings, + creditsRequestCount, + apiKeysRequestCount, + creditsCost, + apiKeysCost, + creditsServiceFee, + apiKeysServiceFee, + creditsDataStorageCost, + apiKeysDataStorageCost, modelBreakdown: modelBreakdownByDate.get(day.date) || [], }; }); @@ -404,6 +461,38 @@ activity.openapi(getActivity, async (c) => { sql`COALESCE(SUM(${projectHourlyStats.discountSavings}), 0)`.as( "discountSavings", ), + creditsRequestCount: + sql`COALESCE(SUM(${projectHourlyStats.creditsRequestCount}), 0)`.as( + "creditsRequestCount", + ), + apiKeysRequestCount: + sql`COALESCE(SUM(${projectHourlyStats.apiKeysRequestCount}), 0)`.as( + "apiKeysRequestCount", + ), + creditsCost: + sql`COALESCE(SUM(${projectHourlyStats.creditsCost}), 0)`.as( + "creditsCost", + ), + apiKeysCost: + sql`COALESCE(SUM(${projectHourlyStats.apiKeysCost}), 0)`.as( + "apiKeysCost", + ), + creditsServiceFee: + sql`COALESCE(SUM(${projectHourlyStats.creditsServiceFee}), 0)`.as( + "creditsServiceFee", + ), + apiKeysServiceFee: + sql`COALESCE(SUM(${projectHourlyStats.apiKeysServiceFee}), 0)`.as( + "apiKeysServiceFee", + ), + creditsDataStorageCost: + sql`COALESCE(SUM(${projectHourlyStats.creditsDataStorageCost}), 0)`.as( + "creditsDataStorageCost", + ), + apiKeysDataStorageCost: + sql`COALESCE(SUM(${projectHourlyStats.apiKeysDataStorageCost}), 0)`.as( + "apiKeysDataStorageCost", + ), }) .from(projectHourlyStats) .where( @@ -499,6 +588,15 @@ activity.openapi(getActivity, async (c) => { const cacheCount = Number(day.cacheCount); const discountSavings = Number(day.discountSavings); + const creditsRequestCount = Number(day.creditsRequestCount); + const apiKeysRequestCount = Number(day.apiKeysRequestCount); + const creditsCost = Number(day.creditsCost); + const apiKeysCost = Number(day.apiKeysCost); + const creditsServiceFee = Number(day.creditsServiceFee); + const apiKeysServiceFee = Number(day.apiKeysServiceFee); + const creditsDataStorageCost = Number(day.creditsDataStorageCost); + const apiKeysDataStorageCost = Number(day.apiKeysDataStorageCost); + const errorRate = requestCount > 0 ? (errorCount / requestCount) * 100 : 0; const cacheRate = requestCount > 0 ? (cacheCount / requestCount) * 100 : 0; @@ -522,6 +620,14 @@ activity.openapi(getActivity, async (c) => { cacheCount, cacheRate, discountSavings, + creditsRequestCount, + apiKeysRequestCount, + creditsCost, + apiKeysCost, + creditsServiceFee, + apiKeysServiceFee, + creditsDataStorageCost, + apiKeysDataStorageCost, modelBreakdown: modelBreakdownByDate.get(day.date) || [], }; }); diff --git a/apps/api/src/testing.ts b/apps/api/src/testing.ts index bec35f1920..3fcf052aae 100644 --- a/apps/api/src/testing.ts +++ b/apps/api/src/testing.ts @@ -161,6 +161,39 @@ function getCommonAggregationFields() { sql`coalesce(sum(${tables.log.cachedInputCost}), 0)`.as( "cachedInputCost", ), + // Per-mode breakdowns + creditsRequestCount: + sql`sum(case when ${tables.log.usedMode} = 'credits' then 1 else 0 end)::int`.as( + "creditsRequestCount", + ), + apiKeysRequestCount: + sql`sum(case when ${tables.log.usedMode} = 'api-keys' then 1 else 0 end)::int`.as( + "apiKeysRequestCount", + ), + creditsCost: + sql`coalesce(sum(case when ${tables.log.usedMode} = 'credits' then ${tables.log.cost} else 0 end), 0)`.as( + "creditsCost", + ), + apiKeysCost: + sql`coalesce(sum(case when ${tables.log.usedMode} = 'api-keys' then ${tables.log.cost} else 0 end), 0)`.as( + "apiKeysCost", + ), + creditsServiceFee: + sql`coalesce(sum(case when ${tables.log.usedMode} = 'credits' then ${tables.log.serviceFee} else 0 end), 0)`.as( + "creditsServiceFee", + ), + apiKeysServiceFee: + sql`coalesce(sum(case when ${tables.log.usedMode} = 'api-keys' then ${tables.log.serviceFee} else 0 end), 0)`.as( + "apiKeysServiceFee", + ), + creditsDataStorageCost: + sql`coalesce(sum(case when ${tables.log.usedMode} = 'credits' then cast(${tables.log.dataStorageCost} as real) else 0 end), 0)`.as( + "creditsDataStorageCost", + ), + apiKeysDataStorageCost: + sql`coalesce(sum(case when ${tables.log.usedMode} = 'api-keys' then cast(${tables.log.dataStorageCost} as real) else 0 end), 0)`.as( + "apiKeysDataStorageCost", + ), }; } diff --git a/apps/code/src/lib/api/v1.d.ts b/apps/code/src/lib/api/v1.d.ts index 0468f37d52..5d9581086b 100644 --- a/apps/code/src/lib/api/v1.d.ts +++ b/apps/code/src/lib/api/v1.d.ts @@ -981,6 +981,14 @@ export interface paths { cacheCount: number; cacheRate: number; discountSavings: number; + creditsRequestCount: number; + apiKeysRequestCount: number; + creditsCost: number; + apiKeysCost: number; + creditsServiceFee: number; + apiKeysServiceFee: number; + creditsDataStorageCost: number; + apiKeysDataStorageCost: number; modelBreakdown: { id: string; provider: string; diff --git a/apps/playground/src/lib/api/v1.d.ts b/apps/playground/src/lib/api/v1.d.ts index 0468f37d52..5d9581086b 100644 --- a/apps/playground/src/lib/api/v1.d.ts +++ b/apps/playground/src/lib/api/v1.d.ts @@ -981,6 +981,14 @@ export interface paths { cacheCount: number; cacheRate: number; discountSavings: number; + creditsRequestCount: number; + apiKeysRequestCount: number; + creditsCost: number; + apiKeysCost: number; + creditsServiceFee: number; + apiKeysServiceFee: number; + creditsDataStorageCost: number; + apiKeysDataStorageCost: number; modelBreakdown: { id: string; provider: string; diff --git a/apps/ui/src/lib/api/v1.d.ts b/apps/ui/src/lib/api/v1.d.ts index 0468f37d52..5d9581086b 100644 --- a/apps/ui/src/lib/api/v1.d.ts +++ b/apps/ui/src/lib/api/v1.d.ts @@ -981,6 +981,14 @@ export interface paths { cacheCount: number; cacheRate: number; discountSavings: number; + creditsRequestCount: number; + apiKeysRequestCount: number; + creditsCost: number; + apiKeysCost: number; + creditsServiceFee: number; + apiKeysServiceFee: number; + creditsDataStorageCost: number; + apiKeysDataStorageCost: number; modelBreakdown: { id: string; provider: string; diff --git a/apps/ui/src/types/activity.ts b/apps/ui/src/types/activity.ts index 1730a7f019..55dbaac8fb 100644 --- a/apps/ui/src/types/activity.ts +++ b/apps/ui/src/types/activity.ts @@ -30,6 +30,14 @@ export interface DailyActivity { cacheCount: number; cacheRate: number; discountSavings: number; + creditsRequestCount: number; + apiKeysRequestCount: number; + creditsCost: number; + apiKeysCost: number; + creditsServiceFee: number; + apiKeysServiceFee: number; + creditsDataStorageCost: number; + apiKeysDataStorageCost: number; modelBreakdown: ActivityModelUsage[]; } @@ -59,6 +67,14 @@ export type ActivitT = cacheCount: number; cacheRate: number; discountSavings: number; + creditsRequestCount: number; + apiKeysRequestCount: number; + creditsCost: number; + apiKeysCost: number; + creditsServiceFee: number; + apiKeysServiceFee: number; + creditsDataStorageCost: number; + apiKeysDataStorageCost: number; modelBreakdown: ActivityModelUsage[]; }[]; } diff --git a/apps/worker/src/services/project-stats-aggregator.ts b/apps/worker/src/services/project-stats-aggregator.ts index 7ef8c3c64f..3c659677e6 100644 --- a/apps/worker/src/services/project-stats-aggregator.ts +++ b/apps/worker/src/services/project-stats-aggregator.ts @@ -158,6 +158,39 @@ function getCommonAggregationFields() { cachedInputCost: sql`coalesce(sum(${log.cachedInputCost}), 0)`.as( "cachedInputCost", ), + // Per-mode breakdowns + creditsRequestCount: + sql`sum(case when ${log.usedMode} = 'credits' then 1 else 0 end)::int`.as( + "creditsRequestCount", + ), + apiKeysRequestCount: + sql`sum(case when ${log.usedMode} = 'api-keys' then 1 else 0 end)::int`.as( + "apiKeysRequestCount", + ), + creditsCost: + sql`coalesce(sum(case when ${log.usedMode} = 'credits' then ${log.cost} else 0 end), 0)`.as( + "creditsCost", + ), + apiKeysCost: + sql`coalesce(sum(case when ${log.usedMode} = 'api-keys' then ${log.cost} else 0 end), 0)`.as( + "apiKeysCost", + ), + creditsServiceFee: + sql`coalesce(sum(case when ${log.usedMode} = 'credits' then ${log.serviceFee} else 0 end), 0)`.as( + "creditsServiceFee", + ), + apiKeysServiceFee: + sql`coalesce(sum(case when ${log.usedMode} = 'api-keys' then ${log.serviceFee} else 0 end), 0)`.as( + "apiKeysServiceFee", + ), + creditsDataStorageCost: + sql`coalesce(sum(case when ${log.usedMode} = 'credits' then cast(${log.dataStorageCost} as real) else 0 end), 0)`.as( + "creditsDataStorageCost", + ), + apiKeysDataStorageCost: + sql`coalesce(sum(case when ${log.usedMode} = 'api-keys' then cast(${log.dataStorageCost} as real) else 0 end), 0)`.as( + "apiKeysDataStorageCost", + ), }; } diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts index f678c921f5..1d4811a575 100644 --- a/packages/db/src/schema.ts +++ b/packages/db/src/schema.ts @@ -1220,6 +1220,15 @@ export const projectHourlyStats = pgTable( imageInputCost: real().notNull().default(0), imageOutputCost: real().notNull().default(0), cachedInputCost: real().notNull().default(0), + // Per-mode breakdowns + creditsRequestCount: integer().notNull().default(0), + apiKeysRequestCount: integer().notNull().default(0), + creditsCost: real().notNull().default(0), + apiKeysCost: real().notNull().default(0), + creditsServiceFee: real().notNull().default(0), + apiKeysServiceFee: real().notNull().default(0), + creditsDataStorageCost: real().notNull().default(0), + apiKeysDataStorageCost: real().notNull().default(0), }, (table) => [ // Unique constraint for one record per project-hour (also creates implicit index) @@ -1277,6 +1286,15 @@ export const projectHourlyModelStats = pgTable( imageInputCost: real().notNull().default(0), imageOutputCost: real().notNull().default(0), cachedInputCost: real().notNull().default(0), + // Per-mode breakdowns + creditsRequestCount: integer().notNull().default(0), + apiKeysRequestCount: integer().notNull().default(0), + creditsCost: real().notNull().default(0), + apiKeysCost: real().notNull().default(0), + creditsServiceFee: real().notNull().default(0), + apiKeysServiceFee: real().notNull().default(0), + creditsDataStorageCost: real().notNull().default(0), + apiKeysDataStorageCost: real().notNull().default(0), }, (table) => [ // Unique constraint for one record per project-hour-model-provider @@ -1345,6 +1363,15 @@ export const apiKeyHourlyStats = pgTable( imageInputCost: real().notNull().default(0), imageOutputCost: real().notNull().default(0), cachedInputCost: real().notNull().default(0), + // Per-mode breakdowns + creditsRequestCount: integer().notNull().default(0), + apiKeysRequestCount: integer().notNull().default(0), + creditsCost: real().notNull().default(0), + apiKeysCost: real().notNull().default(0), + creditsServiceFee: real().notNull().default(0), + apiKeysServiceFee: real().notNull().default(0), + creditsDataStorageCost: real().notNull().default(0), + apiKeysDataStorageCost: real().notNull().default(0), }, (table) => [ // Unique constraint for one record per api-key-hour @@ -1413,6 +1440,15 @@ export const apiKeyHourlyModelStats = pgTable( imageInputCost: real().notNull().default(0), imageOutputCost: real().notNull().default(0), cachedInputCost: real().notNull().default(0), + // Per-mode breakdowns + creditsRequestCount: integer().notNull().default(0), + apiKeysRequestCount: integer().notNull().default(0), + creditsCost: real().notNull().default(0), + apiKeysCost: real().notNull().default(0), + creditsServiceFee: real().notNull().default(0), + apiKeysServiceFee: real().notNull().default(0), + creditsDataStorageCost: real().notNull().default(0), + apiKeysDataStorageCost: real().notNull().default(0), }, (table) => [ // Unique constraint for one record per api-key-hour-model-provider From 1eb6d363823973e777eeeb122e4051baef17a25c Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Tue, 10 Feb 2026 23:29:32 +0700 Subject: [PATCH 23/24] fix: regenerate clean migrations Co-Authored-By: Claude Opus 4.6 --- ...hful_raza.sql => 1770740952_same_lake.sql} | 32 ++ ...snapshot.json => 1770740952_snapshot.json} | 514 +++++++++++++++++- packages/db/migrations/meta/_journal.json | 4 +- 3 files changed, 547 insertions(+), 3 deletions(-) rename packages/db/migrations/{1770720725_youthful_raza.sql => 1770740952_same_lake.sql} (84%) rename packages/db/migrations/meta/{1770720725_snapshot.json => 1770740952_snapshot.json} (95%) diff --git a/packages/db/migrations/1770720725_youthful_raza.sql b/packages/db/migrations/1770740952_same_lake.sql similarity index 84% rename from packages/db/migrations/1770720725_youthful_raza.sql rename to packages/db/migrations/1770740952_same_lake.sql index 34848a7cdb..1087053794 100644 --- a/packages/db/migrations/1770720725_youthful_raza.sql +++ b/packages/db/migrations/1770740952_same_lake.sql @@ -36,6 +36,14 @@ CREATE TABLE "api_key_hourly_model_stats" ( "image_input_cost" real DEFAULT 0 NOT NULL, "image_output_cost" real DEFAULT 0 NOT NULL, "cached_input_cost" real DEFAULT 0 NOT NULL, + "credits_request_count" integer DEFAULT 0 NOT NULL, + "api_keys_request_count" integer DEFAULT 0 NOT NULL, + "credits_cost" real DEFAULT 0 NOT NULL, + "api_keys_cost" real DEFAULT 0 NOT NULL, + "credits_service_fee" real DEFAULT 0 NOT NULL, + "api_keys_service_fee" real DEFAULT 0 NOT NULL, + "credits_data_storage_cost" real DEFAULT 0 NOT NULL, + "api_keys_data_storage_cost" real DEFAULT 0 NOT NULL, CONSTRAINT "api_key_hourly_model_stats_api_key_id_hour_timestamp_used_model_used_provider_unique" UNIQUE("api_key_id","hour_timestamp","used_model","used_provider") ); --> statement-breakpoint @@ -75,6 +83,14 @@ CREATE TABLE "api_key_hourly_stats" ( "image_input_cost" real DEFAULT 0 NOT NULL, "image_output_cost" real DEFAULT 0 NOT NULL, "cached_input_cost" real DEFAULT 0 NOT NULL, + "credits_request_count" integer DEFAULT 0 NOT NULL, + "api_keys_request_count" integer DEFAULT 0 NOT NULL, + "credits_cost" real DEFAULT 0 NOT NULL, + "api_keys_cost" real DEFAULT 0 NOT NULL, + "credits_service_fee" real DEFAULT 0 NOT NULL, + "api_keys_service_fee" real DEFAULT 0 NOT NULL, + "credits_data_storage_cost" real DEFAULT 0 NOT NULL, + "api_keys_data_storage_cost" real DEFAULT 0 NOT NULL, CONSTRAINT "api_key_hourly_stats_api_key_id_hour_timestamp_unique" UNIQUE("api_key_id","hour_timestamp") ); --> statement-breakpoint @@ -115,6 +131,14 @@ CREATE TABLE "project_hourly_model_stats" ( "image_input_cost" real DEFAULT 0 NOT NULL, "image_output_cost" real DEFAULT 0 NOT NULL, "cached_input_cost" real DEFAULT 0 NOT NULL, + "credits_request_count" integer DEFAULT 0 NOT NULL, + "api_keys_request_count" integer DEFAULT 0 NOT NULL, + "credits_cost" real DEFAULT 0 NOT NULL, + "api_keys_cost" real DEFAULT 0 NOT NULL, + "credits_service_fee" real DEFAULT 0 NOT NULL, + "api_keys_service_fee" real DEFAULT 0 NOT NULL, + "credits_data_storage_cost" real DEFAULT 0 NOT NULL, + "api_keys_data_storage_cost" real DEFAULT 0 NOT NULL, CONSTRAINT "project_hourly_model_stats_project_id_hour_timestamp_used_model_used_provider_unique" UNIQUE("project_id","hour_timestamp","used_model","used_provider") ); --> statement-breakpoint @@ -153,6 +177,14 @@ CREATE TABLE "project_hourly_stats" ( "image_input_cost" real DEFAULT 0 NOT NULL, "image_output_cost" real DEFAULT 0 NOT NULL, "cached_input_cost" real DEFAULT 0 NOT NULL, + "credits_request_count" integer DEFAULT 0 NOT NULL, + "api_keys_request_count" integer DEFAULT 0 NOT NULL, + "credits_cost" real DEFAULT 0 NOT NULL, + "api_keys_cost" real DEFAULT 0 NOT NULL, + "credits_service_fee" real DEFAULT 0 NOT NULL, + "api_keys_service_fee" real DEFAULT 0 NOT NULL, + "credits_data_storage_cost" real DEFAULT 0 NOT NULL, + "api_keys_data_storage_cost" real DEFAULT 0 NOT NULL, CONSTRAINT "project_hourly_stats_project_id_hour_timestamp_unique" UNIQUE("project_id","hour_timestamp") ); --> statement-breakpoint diff --git a/packages/db/migrations/meta/1770720725_snapshot.json b/packages/db/migrations/meta/1770740952_snapshot.json similarity index 95% rename from packages/db/migrations/meta/1770720725_snapshot.json rename to packages/db/migrations/meta/1770740952_snapshot.json index 8c911b4816..dfd2cac051 100644 --- a/packages/db/migrations/meta/1770720725_snapshot.json +++ b/packages/db/migrations/meta/1770740952_snapshot.json @@ -1,7 +1,7 @@ { "version": "8", "dialect": "postgres", - "id": "da8b9a5f-76d0-423b-a9f6-4328c3d2c37f", + "id": "0cc932b3-1121-42eb-8399-2d8ac4000313", "prevId": "e5fcbbc1-a429-4cb2-9b9d-329dc6387ffc", "ddl": [ { @@ -1099,6 +1099,134 @@ "schema": "public", "table": "api_key_hourly_model_stats" }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_request_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_request_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_service_fee", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_service_fee", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_model_stats" + }, { "type": "text", "typeSchema": null, @@ -1647,6 +1775,134 @@ "schema": "public", "table": "api_key_hourly_stats" }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_request_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_request_count", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_service_fee", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_service_fee", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "api_key_hourly_stats" + }, { "type": "text", "typeSchema": null, @@ -6819,6 +7075,134 @@ "schema": "public", "table": "project_hourly_model_stats" }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_request_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_request_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_service_fee", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_service_fee", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_model_stats" + }, { "type": "text", "typeSchema": null, @@ -7354,6 +7738,134 @@ "schema": "public", "table": "project_hourly_stats" }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_request_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_request_count", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_service_fee", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_service_fee", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "credits_data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, + { + "type": "real", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": { + "value": "0", + "type": "unknown" + }, + "generated": null, + "identity": null, + "name": "api_keys_data_storage_cost", + "entityType": "columns", + "schema": "public", + "table": "project_hourly_stats" + }, { "type": "text", "typeSchema": null, diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index 467fd26b23..25fd79e226 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -628,8 +628,8 @@ { "idx": 89, "version": "8", - "when": 1770720725838, - "tag": "1770720725_youthful_raza", + "when": 1770740952200, + "tag": "1770740952_same_lake", "breakpoints": true } ] From dc0434a8435c5b69026d55c4df16e41f37c26727 Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Wed, 11 Feb 2026 00:16:53 +0700 Subject: [PATCH 24/24] fix(stats): use UTC strings for timestamps Avoid the pg driver's local-timezone interpretation of `timestamp without timezone` columns by formatting timestamps as UTC strings and casting via ::timestamp in SQL. Co-Authored-By: Claude Opus 4.6 --- .../src/services/project-stats-aggregator.ts | 171 +++++++++--------- 1 file changed, 85 insertions(+), 86 deletions(-) diff --git a/apps/worker/src/services/project-stats-aggregator.ts b/apps/worker/src/services/project-stats-aggregator.ts index 3c659677e6..e0fcc701fe 100644 --- a/apps/worker/src/services/project-stats-aggregator.ts +++ b/apps/worker/src/services/project-stats-aggregator.ts @@ -6,8 +6,6 @@ import { apiKeyHourlyStats, apiKeyHourlyModelStats, sql, - gte, - lt, and, isNull, } from "@llmgateway/db"; @@ -18,28 +16,32 @@ export const PROJECT_STATS_REFRESH_INTERVAL_SECONDS = Number(process.env.PROJECT_STATS_REFRESH_INTERVAL_SECONDS) || 60; /** - * Helper function to round any date to the start of its hour in UTC (00 minutes, 00 seconds, 00 milliseconds) - * Uses UTC to match PostgreSQL's date_trunc behavior + * Format a JS Date as a UTC timestamp string (YYYY-MM-DD HH:MM:SS). + * Avoids the pg driver's local-timezone interpretation of `timestamp without timezone` + * by keeping timestamps as strings and casting via `::timestamp` in SQL. */ -function roundToHourStart(date: Date): Date { - return new Date( - Date.UTC( - date.getUTCFullYear(), - date.getUTCMonth(), - date.getUTCDate(), - date.getUTCHours(), - 0, - 0, - 0, - ), - ); +function formatUTCTimestamp(date: Date): string { + return date.toISOString().slice(0, 19).replace("T", " "); } /** - * Helper function to get the current hour start + * Get the current hour start as a UTC timestamp string */ -function getCurrentHourStart(): Date { - return roundToHourStart(new Date()); +function getCurrentHourStart(): string { + const now = new Date(); + return formatUTCTimestamp( + new Date( + Date.UTC( + now.getUTCFullYear(), + now.getUTCMonth(), + now.getUTCDate(), + now.getUTCHours(), + 0, + 0, + 0, + ), + ), + ); } /** @@ -195,13 +197,13 @@ function getCommonAggregationFields() { } /** - * Calculate and store hourly statistics for a specific project and hour + * Calculate and store hourly statistics for a specific project and hour. + * hourTimestamp is a UTC string (YYYY-MM-DD HH:MM:SS) to avoid JS Date timezone issues. */ async function recalculateProjectHourlyStats( projectId: string, - hourTimestamp: Date, + hourTimestamp: string, ) { - const hourEnd = new Date(hourTimestamp.getTime() + 60 * 60 * 1000); const database = db; const [stats] = await database @@ -210,8 +212,8 @@ async function recalculateProjectHourlyStats( .where( and( sql`${log.projectId} = ${projectId}`, - gte(log.createdAt, hourTimestamp), - lt(log.createdAt, hourEnd), + sql`${log.createdAt} >= ${hourTimestamp}::timestamp`, + sql`${log.createdAt} < ${hourTimestamp}::timestamp + interval '1 hour'`, ), ); @@ -223,7 +225,7 @@ async function recalculateProjectHourlyStats( .insert(projectHourlyStats) .values({ projectId, - hourTimestamp, + hourTimestamp: sql`${hourTimestamp}::timestamp`, ...stats, }) .onConflictDoUpdate({ @@ -240,9 +242,8 @@ async function recalculateProjectHourlyStats( */ async function recalculateProjectHourlyModelStats( projectId: string, - hourTimestamp: Date, + hourTimestamp: string, ) { - const hourEnd = new Date(hourTimestamp.getTime() + 60 * 60 * 1000); const database = db; const modelStats = await database @@ -255,8 +256,8 @@ async function recalculateProjectHourlyModelStats( .where( and( sql`${log.projectId} = ${projectId}`, - gte(log.createdAt, hourTimestamp), - lt(log.createdAt, hourEnd), + sql`${log.createdAt} >= ${hourTimestamp}::timestamp`, + sql`${log.createdAt} < ${hourTimestamp}::timestamp + interval '1 hour'`, ), ) .groupBy(log.usedModel, log.usedProvider); @@ -267,7 +268,7 @@ async function recalculateProjectHourlyModelStats( .insert(projectHourlyModelStats) .values({ projectId, - hourTimestamp, + hourTimestamp: sql`${hourTimestamp}::timestamp`, usedModel, usedProvider, ...statsFields, @@ -292,9 +293,8 @@ async function recalculateProjectHourlyModelStats( */ async function recalculateApiKeyHourlyStats( projectId: string, - hourTimestamp: Date, + hourTimestamp: string, ) { - const hourEnd = new Date(hourTimestamp.getTime() + 60 * 60 * 1000); const database = db; const apiKeyStats = await database @@ -306,8 +306,8 @@ async function recalculateApiKeyHourlyStats( .where( and( sql`${log.projectId} = ${projectId}`, - gte(log.createdAt, hourTimestamp), - lt(log.createdAt, hourEnd), + sql`${log.createdAt} >= ${hourTimestamp}::timestamp`, + sql`${log.createdAt} < ${hourTimestamp}::timestamp + interval '1 hour'`, ), ) .groupBy(log.apiKeyId); @@ -319,7 +319,7 @@ async function recalculateApiKeyHourlyStats( .values({ apiKeyId, projectId, - hourTimestamp, + hourTimestamp: sql`${hourTimestamp}::timestamp`, ...statsFields, }) .onConflictDoUpdate({ @@ -337,9 +337,8 @@ async function recalculateApiKeyHourlyStats( */ async function recalculateApiKeyHourlyModelStats( projectId: string, - hourTimestamp: Date, + hourTimestamp: string, ) { - const hourEnd = new Date(hourTimestamp.getTime() + 60 * 60 * 1000); const database = db; const apiKeyModelStats = await database @@ -353,8 +352,8 @@ async function recalculateApiKeyHourlyModelStats( .where( and( sql`${log.projectId} = ${projectId}`, - gte(log.createdAt, hourTimestamp), - lt(log.createdAt, hourEnd), + sql`${log.createdAt} >= ${hourTimestamp}::timestamp`, + sql`${log.createdAt} < ${hourTimestamp}::timestamp + interval '1 hour'`, ), ) .groupBy(log.apiKeyId, log.usedModel, log.usedProvider); @@ -366,7 +365,7 @@ async function recalculateApiKeyHourlyModelStats( .values({ apiKeyId, projectId, - hourTimestamp, + hourTimestamp: sql`${hourTimestamp}::timestamp`, usedModel, usedProvider, ...statsFields, @@ -415,22 +414,22 @@ export async function processRecentLogs() { if (STATS_BACKFILL_ENABLED) { const backfillStart = STATS_BACKFILL_DAYS > 0 - ? new Date( - currentHourStart.getTime() - - STATS_BACKFILL_DAYS * 24 * 60 * 60 * 1000, + ? formatUTCTimestamp( + new Date(Date.now() - STATS_BACKFILL_DAYS * 24 * 60 * 60 * 1000), ) : undefined; logger.info( - `[backfill] Scanning for unprocessed buckets (lookback: ${backfillStart ? backfillStart.toISOString() : "unlimited"})`, + `[backfill] Scanning for unprocessed buckets (lookback: ${backfillStart ?? "unlimited"})`, ); const backfillBuckets = await database .select({ projectId: log.projectId, - hourTimestamp: sql`date_trunc('hour', ${log.createdAt})`.as( - "hourTimestamp", - ), + hourTimestamp: + sql`to_char(date_trunc('hour', ${log.createdAt}), 'YYYY-MM-DD HH24:MI:SS')`.as( + "hourTimestamp", + ), }) .from(log) .leftJoin( @@ -442,9 +441,11 @@ export async function processRecentLogs() { ) .where( and( - lt(log.createdAt, currentHourStart), + sql`${log.createdAt} < ${currentHourStart}::timestamp`, isNull(projectHourlyStats.projectId), - backfillStart ? gte(log.createdAt, backfillStart) : undefined, + backfillStart + ? sql`${log.createdAt} >= ${backfillStart}::timestamp` + : undefined, ), ) .groupBy(log.projectId, sql`date_trunc('hour', ${log.createdAt})`) @@ -452,33 +453,32 @@ export async function processRecentLogs() { .limit(STATS_BATCH_SIZE); if (backfillBuckets.length > 0) { - const bucketDates = backfillBuckets.map((b) => - new Date(b.hourTimestamp).getTime(), - ); - const oldestBucket = new Date(Math.min(...bucketDates)); - const newestBucket = new Date(Math.max(...bucketDates)); - logger.info( - `[backfill] Found ${backfillBuckets.length} unprocessed project-hour buckets (oldest: ${oldestBucket.toISOString()}, newest: ${newestBucket.toISOString()})`, + `[backfill] Found ${backfillBuckets.length} unprocessed project-hour buckets (oldest: ${backfillBuckets[0].hourTimestamp}, newest: ${backfillBuckets[backfillBuckets.length - 1].hourTimestamp})`, ); for (let i = 0; i < backfillBuckets.length; i++) { const bucket = backfillBuckets[i]; - const hourTimestamp = new Date(bucket.hourTimestamp); - await recalculateProjectHourlyStats(bucket.projectId, hourTimestamp); + await recalculateProjectHourlyStats( + bucket.projectId, + bucket.hourTimestamp, + ); await recalculateProjectHourlyModelStats( bucket.projectId, - hourTimestamp, + bucket.hourTimestamp, + ); + await recalculateApiKeyHourlyStats( + bucket.projectId, + bucket.hourTimestamp, ); - await recalculateApiKeyHourlyStats(bucket.projectId, hourTimestamp); await recalculateApiKeyHourlyModelStats( bucket.projectId, - hourTimestamp, + bucket.hourTimestamp, ); logger.info( - `[backfill] Processed bucket ${i + 1}/${backfillBuckets.length}: project=${bucket.projectId} hour=${hourTimestamp.toISOString()}`, + `[backfill] Processed bucket ${i + 1}/${backfillBuckets.length}: project=${bucket.projectId} hour=${bucket.hourTimestamp}`, ); } @@ -505,26 +505,28 @@ export async function processRecentLogs() { if (STATS_STALE_ENABLED) { const staleStart = STATS_STALE_DAYS > 0 - ? new Date( - currentHourStart.getTime() - - STATS_STALE_DAYS * 24 * 60 * 60 * 1000, + ? formatUTCTimestamp( + new Date(Date.now() - STATS_STALE_DAYS * 24 * 60 * 60 * 1000), ) : undefined; logger.info( - `[stale] Scanning for stale buckets (lookback: ${staleStart ? staleStart.toISOString() : "unlimited"})`, + `[stale] Scanning for stale buckets (lookback: ${staleStart ?? "unlimited"})`, ); const staleBuckets = await database .select({ projectId: projectHourlyStats.projectId, - hourTimestamp: projectHourlyStats.hourTimestamp, + hourTimestamp: + sql`to_char(${projectHourlyStats.hourTimestamp}, 'YYYY-MM-DD HH24:MI:SS')`.as( + "hourTimestamp", + ), }) .from(projectHourlyStats) .where( and( staleStart - ? gte(projectHourlyStats.hourTimestamp, staleStart) + ? sql`${projectHourlyStats.hourTimestamp} >= ${staleStart}::timestamp` : undefined, sql`EXISTS ( SELECT 1 FROM ${log} @@ -540,33 +542,32 @@ export async function processRecentLogs() { .limit(STATS_BATCH_SIZE); if (staleBuckets.length > 0) { - const bucketDates = staleBuckets.map((b) => - new Date(b.hourTimestamp).getTime(), - ); - const oldestStale = new Date(Math.min(...bucketDates)); - const newestStale = new Date(Math.max(...bucketDates)); - logger.info( - `[stale] Found ${staleBuckets.length} stale project-hour buckets with new logs (oldest: ${oldestStale.toISOString()}, newest: ${newestStale.toISOString()})`, + `[stale] Found ${staleBuckets.length} stale project-hour buckets with new logs (oldest: ${staleBuckets[0].hourTimestamp}, newest: ${staleBuckets[staleBuckets.length - 1].hourTimestamp})`, ); for (let i = 0; i < staleBuckets.length; i++) { const bucket = staleBuckets[i]; - const hourTimestamp = new Date(bucket.hourTimestamp); - await recalculateProjectHourlyStats(bucket.projectId, hourTimestamp); + await recalculateProjectHourlyStats( + bucket.projectId, + bucket.hourTimestamp, + ); await recalculateProjectHourlyModelStats( bucket.projectId, - hourTimestamp, + bucket.hourTimestamp, + ); + await recalculateApiKeyHourlyStats( + bucket.projectId, + bucket.hourTimestamp, ); - await recalculateApiKeyHourlyStats(bucket.projectId, hourTimestamp); await recalculateApiKeyHourlyModelStats( bucket.projectId, - hourTimestamp, + bucket.hourTimestamp, ); logger.info( - `[stale] Processed bucket ${i + 1}/${staleBuckets.length}: project=${bucket.projectId} hour=${hourTimestamp.toISOString()}`, + `[stale] Processed bucket ${i + 1}/${staleBuckets.length}: project=${bucket.projectId} hour=${bucket.hourTimestamp}`, ); } @@ -605,9 +606,7 @@ export async function refreshCurrentHourStats() { const database = db; const currentHourStart = getCurrentHourStart(); - logger.info( - `Refreshing current hour stats for ${currentHourStart.toISOString()}`, - ); + logger.info(`Refreshing current hour stats for ${currentHourStart}`); try { const projectsWithCurrentHourLogs = await database @@ -615,7 +614,7 @@ export async function refreshCurrentHourStats() { projectId: log.projectId, }) .from(log) - .where(gte(log.createdAt, currentHourStart)) + .where(sql`${log.createdAt} >= ${currentHourStart}::timestamp`) .groupBy(log.projectId); for (const { projectId } of projectsWithCurrentHourLogs) { @@ -626,7 +625,7 @@ export async function refreshCurrentHourStats() { } logger.info( - `Refreshed current hour stats (${currentHourStart.toISOString()}) for ${projectsWithCurrentHourLogs.length} projects`, + `Refreshed current hour stats (${currentHourStart}) for ${projectsWithCurrentHourLogs.length} projects`, ); } catch (error) { logger.error(