api_key = $api_key; $this->model = $model; } public function get_api_url(): string { return 'https://api.openai.com/v1/chat/completions'; } public function get_headers(): array { return [ 'Authorization' => 'Bearer ' . $this->api_key, 'Content-Type' => 'application/json', ]; } public function get_model(): string { return $this->model; } public function prepare_payload(string $prompt): array { return [ 'model' => $this->model, 'messages' => [ ['role' => 'system', 'content' => 'You are an AI assistant.'], ['role' => 'user', 'content' => $prompt], ], 'temperature' => 0.7, ]; } }