Federico Mariani created CAMEL-23968:
----------------------------------------

             Summary: camel-openai: expose SDK client request timeout, max 
retries and custom request headers
                 Key: CAMEL-23968
                 URL: https://issues.apache.org/jira/browse/CAMEL-23968
             Project: Camel
          Issue Type: Improvement
          Components: camel-openai
    Affects Versions: 4.21.0
            Reporter: Federico Mariani


{{OpenAIEndpoint.createClient}} configures only {{apiKey}}, {{baseUrl}} and SSL 
on {{OpenAIOkHttpClient.Builder}}. Three client knobs of the pinned SDK 
(4.41.0) matter for real Camel integration scenarios and currently cannot be 
set:
* {{requestTimeout}} → {{Builder.timeout(Duration)}} — the SDK default (10 
minutes total) is rarely right inside a synchronous route; every comparable 
Camel component exposes a request timeout;
* {{maxRetries}} → {{Builder.maxRetries(int)}} — the SDK's built-in retry is 
rate-limit aware (honors {{Retry-After}} on 429), which route-level redelivery 
cannot replicate at the HTTP layer; SDK default is 2;
* {{additionalHeader.<name>}} (multiValue, mirroring the existing 
{{additionalBodyProperty.<name>}} pattern) → {{Builder.putHeader(...)}} — 
static request headers needed by API gateways and OpenAI-compatible providers. 
This single option also covers the org/project and Azure cases without 
dedicated options: {{OpenAI-Organization}} / {{OpenAI-Project}} are plain HTTP 
headers, as is Azure's {{api-key}} auth. Values may contain secrets, so the 
option should be marked accordingly in metadata.

All three are applied once in {{createClient}} — no per-exchange cost.

Deliberately *not* proposed, to keep the option surface small:
* {{organization(String)}} / {{project(String)}} — modern OpenAI keys are 
project-scoped ({{sk-proj-...}}); the legacy header case is covered by 
{{additionalHeader.OpenAI-Organization}};
* {{proxy(Proxy)}} / {{proxyAuthenticator(...)}} — OkHttp defaults to the JVM 
{{ProxySelector}}, so standard {{-Dhttps.proxyHost}}/{{-Dhttps.proxyPort}} 
corporate egress configuration already applies; revisit only if a per-endpoint 
proxy is actually requested;
* {{azureServiceVersion(...)}} / {{azureUrlPathMode(...)}} — Azure OpenAI 
already works via {{baseUrl}} + {{oauthProfile}} (documented); api-version 
selection can be a separate Azure-specific ticket if a user reports needing it;
* {{responseValidation(boolean)}} — SDK debugging aid, not an integration 
concern.

_This issue was drafted by Claude Code on behalf of Federico Mariani_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to