[
https://issues.apache.org/jira/browse/CAMEL-27514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18150305#comment-18150305
]
Guillaume Nodet commented on CAMEL-27514:
-----------------------------------------
This issue is being investigated by a coding agent (on behalf of gnodet).
Two root causes confirmed in LlmClient.java:
1. *Double /v1 prefix*: tryExplicitUrl() (line 2351) concatenates url +
"/v1/models" without checking if url already ends with "/v1". A URL like
https://api.openai.com/v1 produces https://api.openai.com/v1/v1/models. The
normalization in normalizeOpenAiModelsUrl() handles this correctly but
detectEndpoint() does not use it.
2. *Missing API key on health check*: isEndpointReachable() passes Map.of()
(empty headers) to tryHealthCheck() for the OpenAI /v1/models probe. Servers
like api.openai.com require Authorization: Bearer <key> and return 401, which
is treated as unreachable. The 401-is-reachable exception only applies to Azure
endpoints.
Fix: strip trailing /v1 before appending health-check paths in detectEndpoint()
/ isEndpointReachable(), and pass the api key header when probing openai-type
endpoints.
_Note: This comment was generated by an AI coding agent and requires manual
verification._
> camel-jbang - the AI commands reject an OpenAI-compatible --url that ends
> with /v1 or needs the API key on /v1/models
> ---------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27514
> URL: https://issues.apache.org/jira/browse/CAMEL-27514
> Project: Camel
> Issue Type: Bug
> Components: camel-jbang
> Affects Versions: 4.23.0
> Reporter: Federico Mariani
> Assignee: Guillaume Nodet
> Priority: Major
>
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)