CAMEL-23500: Document camel-openai usage with OpenAI-compatible providers#23614
CAMEL-23500: Document camel-openai usage with OpenAI-compatible providers#23614k-krawczyk wants to merge 3 commits into
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
| .to("openai:chat-completion?baseUrl=http://localhost:1234/v1&model=local-model"); | ||
| ---- | ||
|
|
||
| === vLLM (self-hosted) |
There was a problem hiding this comment.
Can you add the vLLM command to install and run meta-llama/Llama-3.1-8B-Instruct, as in the example route? and a link to the vLLM website?
For example, locally I am using vllm-mlx a lot on mac os, can you mention this as well? For example, this is how I run it on my mac vllm-mlx serve mlx-community/Qwen3.6-35B-A3B-4bit --port 8000
|
|
||
| If vLLM was started with `--api-key`, pass the same value via the `apiKey` option. | ||
|
|
||
| === OpenRouter |
There was a problem hiding this comment.
Did you manage to actually test it with openrouter? To be honest, when I opened the jira issue, I never used openrouter, I just supposed it would work :D if you have openrouter, and can do a quick test would be nice, otherwise, no worries, maybe @orpiske can test and review the docs (if needed) in the future
…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.
|
|
||
| == OpenAI-Compatible Providers | ||
|
|
||
| Because the component speaks the OpenAI API, you do not need a separate component to use third-party |
There was a problem hiding this comment.
This new section overlaps with the existing == Compatibility section further down (currently at line 495 on main), which lists the same providers. It also overlaps with === Using Third-Party or Local OpenAI-Compatible Endpoint (line 259 on main) which has a near-identical LM Studio example.
Now that this comprehensive section exists, consider:
- Removing the brief
=== Using Third-Party or Local OpenAI-Compatible Endpointsection (line 259) since it's now a subset of this content - Trimming the
== Compatibilitysection to avoid repeating the provider list, or merging it into this section
There was a problem hiding this comment.
Thanks for catching the overlap. Pushed 2264fbd which:
- Removes
=== Using Third-Party or Local OpenAI-Compatible Endpoint(was line 259); its example is now covered by=== LM Studio (local)in the new section. - Removes the
== Compatibilityheading along with its intro paragraph, bullet list, and NOTE block (redundant with the new provider table). - Preserves the caveat about provider variations from the old
== CompatibilityNOTE as aNOTE:in the intro of== OpenAI-Compatible Providers. - Promotes
=== Embedding Models by Providerto sit under== OpenAI-Compatible Providers, right before== Embeddings Operation, so all provider info stays grouped.
Net: -24/+3 lines, single source of truth for OpenAI-compatible provider docs.
Reported by Claude Code on behalf of Karol Krawczyk
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