1.OpenRouter large model API aggregation platform

1.OpenRouter large model API aggregation platformConcept Introduction1.1 What is "OpenRouter"?2. Practical Operations2.1 Obtaining API Credentials2.2 Graphical Process2.3 Configuration File Modifications

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 need to register accounts on each platform, obtain three sets of API keys, and write three different sets of calling code for each of their different API formats.

OpenRouter solves this problem. It provides a unified API interface (compatible with OpenAI's API format). With just one OpenRouter API key, you can access all of these models, as well as hundreds of other open and closed-source models, through this single entry point.

The core advantages of integrating OpenRouter into largemodel projects are:

In the largemodel project, configure the llm_platform parameter to openrouter to enable this powerful aggregation platform.

2. Practical Operations

2.1 Obtaining API Credentials

  1. Register for OpenRouter: Visit OpenRouter.ai and register an account using Google or email. If the connection fails, search for the "OpenRouter" platform yourself.
  2. Top Up: OpenRouter uses a prepaid payment model. You must first top up a small amount (e.g., $5) on the "Credits" page to start using it. Alternatively, you can directly use the free models, but there are rate limits.
  3. Create an API Key: On the "Keys" page, click "Create Key" to generate a new API key. Copy and save it immediately.

2.2 Graphical Process

  1. First visit the following website. If the connection fails, search for the "OpenRouter" platform and then search for keywords related to large models.

OpenRouter

image-20250801163705985

  1. Register and log in to your account.
  2. After registering your account, click to enter the Model Plaza.

image-20250801165400079

  1. Type "free" in the search bar to find models that can be used for free.

image-20250807175353717

  1. Hover your mouse over the clipboard icon next to the model to see the name you'll use when calling the model. Click to copy it.

image-20250807175436229

  1. Hover your mouse over the profile picture in the upper-right corner. It will expand. Click Keys to create a key.

image-20250807180439598

  1. Click Apply for an API key.

image-20250807180556227

  1. After applying, you will receive an API key.

image-20250801171806192

2.3 Configuration File Modifications

  1. Open large_model_interface.yaml:

In openrouter_api_key, replace sk-xxxxxxxxxx with the API key you copied earlier.

openrouter_model is used to configure the large model for communication.

  1. Open yahboom.yaml:
  1. Switch the platform: Change the llm_platform parameter to openrouter.

After switching the platform parameters, return to the workspace and compile again for the changes to take effect.