CAMEL-23500: Document camel-openai usage with OpenAI-compatible providers#23614
Conversation
gnodet
left a comment
There was a problem hiding this comment.
Documentation-only addition — well-written guide for using camel-openai with OpenAI-compatible providers (Ollama, LM Studio, vLLM, OpenRouter). The provider routing example for OpenRouter with additionalBodyProperty.provider is particularly useful, and the note about the limitation with custom HTTP headers is transparent.
Good use of AsciiDoc tabs for Java/YAML examples. Provider table is clean and actionable.
LGTM.
Fully automatic review from Claude Code
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
All tested modules (8 modules)
|
|
Hi @k-krawczyk thanks for your contribution! I added a couple of comments |
|
@Croway I cannot see your questions here on github |
|
@davsclaus uh, that is strange, I can see those both in the conversation page, and the |
|
@Croway happy to address any concerns — I don't see the comments on the PR either (and there are none |
|
|
||
| === Ollama (local) | ||
|
|
||
| Ollama runs models locally and does not require an API key. |
There was a problem hiding this comment.
Can you add the ollama command to install and run llama3.2, as in the example route? and a link to the ollama website?
|
|
||
| === LM Studio (local) | ||
|
|
||
| LM Studio serves the model currently loaded in the app. Set `model` to the identifier shown in its UI. |
There was a problem hiding this comment.
Please add a link to LM Studio website/documentation
…ders Add an "OpenAI-Compatible Providers" section to the OpenAI component docs with baseUrl-based configuration examples for OpenRouter, Ollama, LM Studio, and vLLM, so users discover that no separate component is needed. For OpenRouter, document selecting models via cross-provider identifiers and controlling provider routing/fallbacks through additionalBodyProperty (a JSON body value). Note that OpenRouter's optional HTTP-Referer/X-Title attribution headers cannot be set today, since the component does not expose custom HTTP request headers.
Per review on PR apache#23614: - Ollama: link to ollama.com and the "ollama run llama3.2" command - LM Studio: link to lmstudio.ai - vLLM: link to docs.vllm.ai, "pip install vllm" + "vllm serve" command, plus a note on the vllm-mlx variant for Apple Silicon with an example command
5486065 to
3062455
Compare
|
Thanks @Croway — all four addressed:
|
davsclaus
left a comment
There was a problem hiding this comment.
Nice documentation addition — the examples are clear and the honest note about the HTTP header limitation is helpful.
One structural concern: the doc already has two sections covering similar ground that should be consolidated with this new content:
- Line 259 —
=== Using Third-Party or Local OpenAI-Compatible Endpointshows an LM Studio example atlocalhost:1234/v1, nearly identical to the new LM Studio example in this PR. - Line 495 —
== Compatibilitylists the same providers (OpenAI, Ollama, LM Studio, third-party) that the new section now covers in detail.
With the new section in place, these existing sections become redundant. Could you either remove/consolidate them into the new section, or at least add cross-references so readers aren't presented with three overlapping sections?
This review covers project conventions and documentation structure. It does not replace specialized review tools such as CodeRabbit, Sourcery, or SonarCloud.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Per review on PR #23614: - Ollama: link to ollama.com and the "ollama run llama3.2" command - LM Studio: link to lmstudio.ai - vLLM: link to docs.vllm.ai, "pip install vllm" + "vllm serve" command, plus a note on the vllm-mlx variant for Apple Silicon with an example command
Summary
Adds an "OpenAI-Compatible Providers" section to the OpenAI component documentation, with
baseUrl-based configuration examples for OpenRouter, Ollama, LM Studio, and vLLM. This makes it discoverable that no separate component is needed to use third-party gateways or local model servers.Changes
== OpenAI-Compatible Providerssection inopenai-component.adoc:baseUrlreference table (OpenAI, OpenRouter, Ollama, LM Studio, vLLM)additionalBodyProperty(a JSON body value)Docs-only; no code changes. The
docs/components/.../openai-component.adocpage is a symlink to the component source, so only the source file changes.On the OpenRouter attribution headers
The ticket also asked to document setting OpenRouter's
HTTP-Referer/X-Titleattribution headers via exchange headers. After checking the code, the component does not currently expose a way to set custom HTTP request headers: the client is built with onlyapiKey/baseUrl/SSL and the producer calls.create(params)withoutRequestOptions. So I documented this as a current limitation rather than referencing a non-existent option. I'd suggest a small follow-up enhancement to add a custom request-header option (e.g.additionalRequestHeader.), which theopenai-javaSDK supports viaRequestOptions.putHeader— happy to take that on.On a dedicated OpenRouter kamelet
The ticket asked to evaluate one. Given
baseUrlreduces OpenRouter to a one-line configuration, a dedicated kamelet adds little value over the documented approach, so I'd lean against it.Reported by Claude Code on behalf of Karol Krawczyk