Welcome to RDK S600 Developer Kit repository
1.OpenRouter large model API aggregation platform
OpenRouter Large Model API Aggregation Platform Text Interaction
OpenRouter Large Model API Aggregation Platform Text InteractionConcept Introduction1.1 What is "OpenRouter"?2. Practical Operations2.1 Obtaining API Credentials2.2 Illustrated Guide2.3 Configuration File Modification
Concept Introduction
1.1 What is "OpenRouter"?
OpenRouter is a large model API aggregation platform. You can think of it as a "universal remote control for large models". Typically, if you want to use OpenAI's GPT-4, Anthropic's Claude-3, and Google's Gemini, you would need to register accounts on three separate platforms, obtain three sets of API Keys, and write three different sets of calling code for their respective API formats.
OpenRouter solves this problem. It provides a unified API interface (compatible with OpenAI's API format), and with just one OpenRouter API Key, you can call all the above models and hundreds of other open-source and closed-source models through this single entry point.
The core advantages of integrating OpenRouter in the largemodel project are:
- Ultimate Flexibility: You can seamlessly switch between GPT, Claude, Llama, and any other model by simply changing one model name in the configuration file, without modifying any code.
- Cost Efficiency: OpenRouter provides clear pricing for each model, allowing you to conveniently compare and select the most cost-effective model for specific tasks.
- Explore Cutting-edge Models: Many new and excellent open-source models are included on OpenRouter as soon as they are released, allowing developers to quickly try them out.
In the largemodel project, you can enable this powerful aggregation platform by configuring the llm_platform parameter to openrouter.
2. Practical Operations
2.1 Obtaining API Credentials
- Register on OpenRouter: Visit OpenRouter.ai, and register an account using Google or email. If the link is invalid, you need to search for the "OpenRouter" platform yourself.
- Top Up: OpenRouter uses a prepaid model. You need to top up a small amount (e.g., $5) on the "Credits" page before you can start using it. Alternatively, you can directly use its free models, but they have rate limits.
- Create API Key: On the "Keys" page, click "Create Key" to generate a new API Key, and copy and save it immediately.
2.2 Illustrated Guide
- First go to the following website. If the link is invalid, you need to search for the "OpenRouter" platform yourself, then look for keywords related to large models.

- Register and log in to your account
- After registering, click to enter the model marketplace

- You can type "free" in the search bar to find models that can be called for free.

- Hover over the clipboard icon next to a model to see the name used when calling the model, and click to copy it.

- Move the mouse to the upper right corner next to the avatar, it will expand, and you can click Keys to go in and create a key.

- Click to apply for an API key

- After applying, you will receive an API key string

2.3 Configuration File Modification
Open
large_model_interface.yaml:vim ~/yahboom_ws/install/largemodel/share/largemodel/config/large_model_interface.yamlThen replace sk-xxxxxxxxxx in openrouter_api_key with the API key you just copied.
openrouter_model is used to configure the model for conversations.
xxxxxxxxxx# OpenRouter Platform Configurationopenrouter_api_key: "sk-xxxxxxxxxxxxxxxxxxx"openrouter_model: "moonshotai/kimi-k2:free" # Model to use, e.g. "google/gemini-pro-vision"Open
yahboom.yaml:xxxxxxxxxxvim ~/yahboom_ws/install/largemodel/share/largemodel/config/yahboom.yamlSwitch Platform: Change the
llm_platformparameter toopenrouter.xxxxxxxxxxllm_platform'openrouter'
After switching the platform parameter, return to the workspace and recompile to take effect.