metadata()->getId(); } /** * Prepares the parameters for the image generation API request. * * Removes parameters that Azure OpenAI deployments reject: * - response_format: gpt-image-1 rejects it with 400. * - model: Azure routes via deployment URL, not a body param. * * @param array $prompt The prompt messages. * @return array The parameters for the API request. */ protected function prepareGenerateImageParams( array $prompt ): array { $params = parent::prepareGenerateImageParams( $prompt ); unset( $params['model'], $params['response_format'] ); return $params; } /** * Create a request targeting the Azure OpenAI deployment endpoint. * * The Model Inference API does not expose /images/generations, so we * route through the Azure OpenAI API surface instead: * {resource_root}/openai/deployments/{deployment}/{path}?api-version=... * * @param HttpMethodEnum $method The HTTP method. * @param string $path The API path (e.g. 'images/generations'). * @param array $headers Optional headers. * @param mixed $data Optional request data. * @return Request The request object. */ protected function createRequest( HttpMethodEnum $method, string $path, array $headers = [], $data = null ): Request { $resource_root = AzureAiFoundryProvider::resourceRootUrl(); $deployment = $this->getDeploymentId(); $api_version = AzureAiFoundryProvider::openAiApiVersion(); $url = $resource_root . '/openai/deployments/' . rawurlencode( $deployment ) . '/' . ltrim( $path, '/' ) . '?api-version=' . rawurlencode( $api_version ); return new Request( $method, $url, $headers, $data, $this->getRequestOptions() ); } }