rawModel = $model; } /** The option key that stores this provider's API key. */ abstract protected function keyOption(): string; public function apiKey(): string { return (string) get_option($this->keyOption(), ''); } public function model(): string { return $this->rawModel; } public function isConfigured(): bool { return $this->apiKey() !== ''; } public function supportsStreaming(): bool { return true; } public function supportsPenalties(): bool { return true; } public function chatBodyExtras(): array { return []; } public function tokenOverhead(): int { return 0; } public function headers(): array { return [ 'Content-Type: application/json', 'Authorization: Bearer ' . $this->apiKey(), ]; } public function streamBody(string $prompt, float $temperature): array { return [ 'model' => $this->model(), 'messages' => [['role' => 'user', 'content' => $prompt]], 'temperature' => $temperature, 'stream' => true, ]; } }