@@ -197,6 +197,8 @@ Integrate your favorite models into CAMEL-AI with straightforward Python calls.
197197
198198 <Tab title = " Qwen" >
199199
200+ Leverage [ Qwen] ( https://qwenlm.github.io/ ) 's state-of-the-art models for coding and reasoning:
201+
200202 ``` python
201203 from camel.models import ModelFactory
202204 from camel.types import ModelPlatformType, ModelType
@@ -214,11 +216,82 @@ Integrate your favorite models into CAMEL-AI with straightforward Python calls.
214216 print (response.msgs[0 ].content)
215217 ```
216218
219+ </Tab >
220+
221+ <Tab title = " OpenRouter" >
222+ Access a wide variety of models through [ OpenRouter] ( https://openrouter.ai/ ) 's unified API:
223+
224+ ** Setup:** Set your OpenRouter API key as an environment variable:
225+ ``` bash
226+ export OPENROUTER_API_KEY=" your-api-key-here"
227+ ```
228+
229+ ``` python
230+ from camel.models import ModelFactory
231+ from camel.types import ModelPlatformType, ModelType
232+ from camel.configs import OpenRouterConfig
233+ from camel.agents import ChatAgent
234+
235+ # Using predefined OpenRouter models
236+ model = ModelFactory.create(
237+ model_platform = ModelPlatformType.OPENROUTER ,
238+ model_type = ModelType.OPENROUTER_LLAMA_3_1_70B ,
239+ model_config_dict = OpenRouterConfig(temperature = 0.2 ).as_dict(),
240+ )
241+
242+ agent = ChatAgent(
243+ system_message = " You are a helpful assistant." ,
244+ model = model
245+ )
246+
247+ response = agent.step(" Say hi to CAMEL AI community." )
248+ print (response.msgs[0 ].content)
249+ ```
250+
251+ <Note type = " info" >
252+ CAMEL supports several predefined OpenRouter models including:
253+ - ` OPENROUTER_LLAMA_3_1_405B ` - Meta's Llama 3.1 405B model
254+ - ` OPENROUTER_LLAMA_3_1_70B ` - Meta's Llama 3.1 70B model
255+ - ` OPENROUTER_LLAMA_4_MAVERICK ` - Meta's Llama 4 Maverick model
256+ - ` OPENROUTER_LLAMA_4_SCOUT ` - Meta's Llama 4 Scout model
257+ - ` OPENROUTER_OLYMPICODER_7B ` - Open R1's OlympicCoder 7B model
258+ - ` OPENROUTER_HORIZON_ALPHA ` - Horizon Alpha model
259+
260+ Free versions are also available for some models (e.g., ` OPENROUTER_LLAMA_4_MAVERICK_FREE ` ).
261+ </Note >
262+
263+ You can also use any OpenRouter model via the OpenAI-compatible interface:
264+
265+ ``` python
266+ import os
267+ from camel.models import ModelFactory
268+ from camel.types import ModelPlatformType
269+
270+ # Use any model available on OpenRouter
271+ model = ModelFactory.create(
272+ model_platform = ModelPlatformType.OPENAI_COMPATIBLE_MODEL ,
273+ model_type = " anthropic/claude-3.5-sonnet" , # Any OpenRouter model
274+ url = " https://openrouter.ai/api/v1" ,
275+ api_key = os.getenv(" OPENROUTER_API_KEY" ),
276+ model_config_dict = {" temperature" : 0.2 },
277+ )
278+
279+ agent = ChatAgent(
280+ system_message = " You are a helpful assistant." ,
281+ model = model
282+ )
283+
284+ response = agent.step(" Explain quantum computing in simple terms." )
285+ print (response.msgs[0 ].content)
286+ ```
287+
288+ ** Available Models:** View the full list of models available through OpenRouter at [ openrouter.ai/models] ( https://openrouter.ai/models ) .
289+
217290 </Tab >
218291
219292 <Tab title = " Groq" >
220293
221- Using Groq's powerful models (e.g., Llama 3.3-70B):
294+ Using [ Groq] ( https://groq.com/ ) 's powerful models (e.g., Llama 3.3-70B):
222295
223296 ``` python
224297 from camel.models import ModelFactory
0 commit comments