You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by fm...@apache.org on 2026/06/01 08:20:46 UTC
(camel) branch main updated (e0e4649053a5 -> b14d479a6423)
This is an automated email from the ASF dual-hosted git repository.
Croway pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
from e0e4649053a5 chore(deps): Bump org.apache.activemq:activemq-client-jakarta
new 3da8716e9adb CAMEL-23500: Document camel-openai usage with OpenAI-compatible providers
new c3a9b61112cd CAMEL-23500: Add install commands and provider links per review feedback
new b14d479a6423 CAMEL-23500: Remove duplicate Compatibility/Third-Party sections per review feedback
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../src/main/docs/openai-component.adoc | 142 ++++++++++++++++++---
1 file changed, 125 insertions(+), 17 deletions(-)
(camel) 01/03: CAMEL-23500: Document camel-openai usage with OpenAI-compatible providers
Posted by fm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3da8716e9adbd9ec533a3157d38bc724a2c87c53
Author: Karol <ka...@gmail.com>
AuthorDate: Thu May 28 23:59:12 2026 +0200
CAMEL-23500: Document camel-openai usage with OpenAI-compatible providers
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.
---
.../src/main/docs/openai-component.adoc | 107 +++++++++++++++++++++
1 file changed, 107 insertions(+)
diff --git a/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc b/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc
index 61a90d3c1d9f..64c9bc046e93 100644
--- a/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc
+++ b/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc
@@ -492,6 +492,113 @@ String-valued fields are set directly. Non-string fields (numbers, booleans, obj
NOTE: This maps fields from the response message's additional properties (fields not part of the standard schema). Standard response fields like `content`, `role`, and `tool_calls` are not accessible through this option.
+== OpenAI-Compatible Providers
+
+Because the component speaks the OpenAI API, you do not need a separate component to use third-party
+gateways or local model servers that expose an OpenAI-compatible API. Point `baseUrl` at the provider,
+set `apiKey` if it requires one, and use the same operations and options as with OpenAI.
+
+[cols="1,2,2",options="header"]
+|===
+| Provider | `baseUrl` | Notes
+
+| OpenAI | `https://api.openai.com/v1` | Default; `baseUrl` can be omitted
+| OpenRouter | `https://openrouter.ai/api/v1` | Multi-model gateway with provider routing and fallbacks
+| Ollama | `http://localhost:11434/v1` | Local LLM server
+| LM Studio | `http://localhost:1234/v1` | Local model runner
+| vLLM | `http://localhost:8000/v1` | High-throughput, self-hosted serving engine
+|===
+
+=== Ollama (local)
+
+Ollama runs models locally and does not require an API key.
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("direct:chat")
+ .setBody(constant("What is Apache Camel?"))
+ .to("openai:chat-completion?baseUrl=http://localhost:11434/v1&model=llama3.2");
+----
+
+YAML::
++
+[source,yaml]
+----
+- to:
+ uri: openai:chat-completion
+ parameters:
+ baseUrl: http://localhost:11434/v1
+ model: llama3.2
+ userMessage: What is Apache Camel?
+----
+====
+
+For local embeddings, use an embedding model such as `nomic-embed-text` (see the *Embedding Models by
+Provider* table below).
+
+=== LM Studio (local)
+
+LM Studio serves the model currently loaded in the app. Set `model` to the identifier shown in its UI.
+
+[source,java]
+----
+from("direct:chat")
+ .to("openai:chat-completion?baseUrl=http://localhost:1234/v1&model=local-model");
+----
+
+=== vLLM (self-hosted)
+
+[source,java]
+----
+from("direct:chat")
+ .to("openai:chat-completion?baseUrl=http://localhost:8000/v1"
+ + "&model=meta-llama/Llama-3.1-8B-Instruct");
+----
+
+If vLLM was started with `--api-key`, pass the same value via the `apiKey` option.
+
+=== OpenRouter
+
+https://openrouter.ai[OpenRouter] is an OpenAI-compatible gateway that routes requests across many
+model providers. Set `baseUrl` to its endpoint and select a model with a cross-provider identifier:
+
+[source,java]
+----
+from("direct:chat")
+ .to("openai:chat-completion?baseUrl=https://openrouter.ai/api/v1"
+ + "&apiKey={{openrouter.api.key}}"
+ + "&model=anthropic/claude-sonnet-4-20250514");
+----
+
+==== Provider Routing
+
+OpenRouter accepts a `provider` object in the request body to control routing order and fallbacks.
+Pass it through the `additionalBodyProperty` option as a JSON value — the component parses JSON-valued
+properties and adds them to the request body:
+
+[source,yaml]
+----
+- to:
+ uri: openai:chat-completion
+ parameters:
+ baseUrl: https://openrouter.ai/api/v1
+ apiKey: "{{openrouter.api.key}}"
+ model: anthropic/claude-sonnet-4-20250514
+ additionalBodyProperty.provider: '{"order":["anthropic","google"],"allow_fallbacks":false}'
+----
+
+[NOTE]
+====
+OpenRouter's optional attribution headers (`HTTP-Referer` and `X-Title`, which identify your app on
+the OpenRouter rankings) are sent as HTTP request headers, not body properties. The component does not
+currently expose a way to set custom HTTP request headers, so they cannot be configured today. They
+are optional and do not affect chat completions.
+====
+
== Compatibility
This component works with any OpenAI API-compatible endpoint by setting the `baseUrl` parameter. This includes:
(camel) 03/03: CAMEL-23500: Remove duplicate Compatibility/Third-Party sections per review feedback
Posted by fm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b14d479a64238ae78ed0ab824e60c8f5a1f4441f
Author: Karol <ka...@gmail.com>
AuthorDate: Sat May 30 23:09:01 2026 +0200
CAMEL-23500: Remove duplicate Compatibility/Third-Party sections per review feedback
---
.../src/main/docs/openai-component.adoc | 27 +++-------------------
1 file changed, 3 insertions(+), 24 deletions(-)
diff --git a/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc b/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc
index c5b2e8509375..aa7a50bc3e8c 100644
--- a/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc
+++ b/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc
@@ -256,17 +256,6 @@ from("direct:conversation")
.log("Second response: ${body}"); // Will remember "Alice"
----
-=== Using Third-Party or Local OpenAI-Compatible Endpoint
-
-.Usage example:
-[source,java]
-----
-from("direct:local")
- .setBody(constant("Hello from local LLM"))
- .to("openai:chat-completion?baseUrl=http://localhost:1234/v1&model=local-model")
- .log("${body}");
-----
-
== Input Handling
The component accepts the following types of input in the message body:
@@ -498,6 +487,9 @@ Because the component speaks the OpenAI API, you do not need a separate componen
gateways or local model servers that expose an OpenAI-compatible API. Point `baseUrl` at the provider,
set `apiKey` if it requires one, and use the same operations and options as with OpenAI.
+NOTE: Ensure the provider supports the chat completions and/or embeddings endpoint format you use.
+Authentication requirements and minor API variations differ between providers.
+
[cols="1,2,2",options="header"]
|===
| Provider | `baseUrl` | Notes
@@ -621,19 +613,6 @@ currently expose a way to set custom HTTP request headers, so they cannot be con
are optional and do not affect chat completions.
====
-== Compatibility
-
-This component works with any OpenAI API-compatible endpoint by setting the `baseUrl` parameter. This includes:
-
-- OpenAI official API (`https://api.openai.com/v1`)
-- Local LLM servers (e.g., Ollama, LM Studio, LocalAI)
-- Third-party OpenAI-compatible providers
-
-[NOTE]
-====
-When using local or third-party providers, ensure they support the chat completions and/or embeddings API endpoint format. Some providers may have different authentication requirements or API variations.
-====
-
=== Embedding Models by Provider
[cols="1,2,1"]
(camel) 02/03: CAMEL-23500: Add install commands and provider links per review feedback
Posted by fm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit c3a9b61112cdb4e612e814aed31247864eaac322
Author: Karol <ka...@gmail.com>
AuthorDate: Sat May 30 20:08:33 2026 +0200
CAMEL-23500: Add install commands and provider links per review feedback
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
---
.../src/main/docs/openai-component.adoc | 26 ++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc b/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc
index 64c9bc046e93..c5b2e8509375 100644
--- a/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc
+++ b/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc
@@ -511,7 +511,13 @@ set `apiKey` if it requires one, and use the same operations and options as with
=== Ollama (local)
-Ollama runs models locally and does not require an API key.
+https://ollama.com[Ollama] runs models locally and does not require an API key. Install Ollama and
+pull the model used in the example below:
+
+[source,bash]
+----
+ollama run llama3.2
+----
[tabs]
====
@@ -542,7 +548,8 @@ Provider* table below).
=== LM Studio (local)
-LM Studio serves the model currently loaded in the app. Set `model` to the identifier shown in its UI.
+https://lmstudio.ai[LM Studio] serves the model currently loaded in the app. Set `model` to the
+identifier shown in its UI.
[source,java]
----
@@ -552,6 +559,14 @@ from("direct:chat")
=== vLLM (self-hosted)
+https://docs.vllm.ai[vLLM] is a high-throughput LLM serving engine. Install it with `pip install vllm`
+and start the model used in the example below:
+
+[source,bash]
+----
+vllm serve meta-llama/Llama-3.1-8B-Instruct --port 8000
+----
+
[source,java]
----
from("direct:chat")
@@ -561,6 +576,13 @@ from("direct:chat")
If vLLM was started with `--api-key`, pass the same value via the `apiKey` option.
+On Apple Silicon, the `vllm-mlx` variant uses Apple's MLX framework and runs the same way:
+
+[source,bash]
+----
+vllm-mlx serve mlx-community/Qwen2.5-7B-Instruct-4bit --port 8000
+----
+
=== OpenRouter
https://openrouter.ai[OpenRouter] is an OpenAI-compatible gateway that routes requests across many