-- AI Usage Log — Token tracking for cost analysis CREATE TABLE IF NOT EXISTS ai_usage_log ( id CHAR(36) PRIMARY KEY, input_tokens INT UNSIGNED NOT NULL DEFAULT 0, output_tokens INT UNSIGNED NOT NULL DEFAULT 0, total_tokens INT UNSIGNED NOT NULL DEFAULT 0, cost_usd DECIMAL(12, 8) NOT NULL DEFAULT 0, cost_jod DECIMAL(12, 8) NOT NULL DEFAULT 0, model VARCHAR(50) NOT NULL DEFAULT 'gemini-flash-lite', created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, INDEX idx_created (created_at), INDEX idx_model (model) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;