Claus Ibsen created CAMEL-27402:
-----------------------------------

             Summary: camel-openai - work without an API key, for local 
OpenAI-compatible servers such as Ollama
                 Key: CAMEL-27402
                 URL: https://issues.apache.org/jira/browse/CAMEL-27402
             Project: Camel
          Issue Type: Improvement
          Components: camel-openai
            Reporter: Claus Ibsen
             Fix For: 4.24.0


{{OpenAIEndpoint}} sets {{apiKey}} on the {{OpenAIOkHttpClient}} builder only 
when one is configured (the option, or the {{OPENAI_API_KEY}} environment 
variable). Without one, the OpenAI SDK refuses to build the client:

{noformat}
java.lang.IllegalStateException: At least one credential source must be 
specified: credential (apiKey), workloadIdentity, or adminApiKey
{noformat}

So a route that calls a local server that checks no key, such as Ollama, vLLM 
or LM Studio with {{baseUrl}} set, has to configure a dummy key.

Expected: with no {{apiKey}}, no {{OPENAI_API_KEY}} and no {{oauthProfile}}, 
the component builds the client without a credential, so no {{Authorization}} 
header is sent (or, if the SDK cannot do that, with an internal placeholder 
that is never logged), and a server that needs a key answers 401 as usual. The 
docs of {{apiKey}} say that it is optional for such servers. A test with a stub 
server checks that the request is sent without a key.

Found while adding the openai-chat-action Kamelet to the Kamelet catalog 
(apache/camel-kamelets#3365, 2026-11-22).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to