CREATE TABLE IF NOT EXISTS api_calls (id INT AUTO_INCREMENT PRIMARY KEY, timestamp DATETIME NOT NULL, model VARCHAR(100) NOT NULL, service VARCHAR(50) NOT NULL, message_count INT NOT NULL, function_name VARCHAR(100), response_time_ms INT, prompt_tokens INT, completion_tokens INT, total_tokens INT, cost DECIMAL(10,6), success BOOLEAN NOT NULL DEFAULT TRUE, error_message TEXT, match_id VARCHAR(36), move_id VARCHAR(36), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, INDEX (model), INDEX (service), INDEX (match_id), INDEX (move_id)) ENGINE=InnoDB;
