Model Redirect
Automatically generates "Standard Model → Actual Model" mappings for New API channels, allowing you to call unified model names (e.g.,
gpt-4o) downstream, with the system automatically routing to the actual models provided by various upstream gateways.
Feature Overview
- Unified Model Invocation Entrypoint
- You can uniformly use a set of "standard model names" (e.g.,
gpt-4o,claude-4.5-haiku) in New API. - Model Redirect will map them to the actual available model names for each channel.
- You can uniformly use a set of "standard model names" (e.g.,
- Automatic Mapping Generation
- Automatically calculates the most suitable correspondences based on the
modelslist reported by channels and a set of "standard model lists." - Supports incremental merging by channel, preserving your manually configured mappings.
- Automatically calculates the most suitable correspondences based on the
- Use in Conjunction with Model Synchronization and Channel Management
- Typically used with New API Model List Synchronization and New API Channel Management:
- Model Synchronization is responsible for pulling the upstream available model list into New API.
- Model Redirect is responsible for aligning these models to a set of "standard models."
- Typically used with New API Model List Synchronization and New API Channel Management:
Prerequisites
- New API Integration Settings have been configured in the plugin:
- Fill in Admin URL, Admin Token, and User ID.
- At least one valid channel exists in New API, and the channel's
modelsfield contains a list of available models. - A model synchronization has been completed (recommended) to ensure the model list within the channel is up-to-date.
Accessing Settings
- Open the plugin → Navigate to the Settings page.
- Switch to the "New API" tab.
- Locate the "Model Redirect" area (
id="model-redirect") at the bottom of the page. - You will see:
- An enable toggle
- A multi-select list for standard models
- A "Regenerate Mappings Now" button
Key Configuration Items
- Enable Model Redirect
- When enabled, the Model Redirect algorithm will be invoked when you manually click "Regenerate" or during specific synchronization processes.
- Standard Model List
- Built-in standard models from common vendors, for example:
- OpenAI Series:
gpt-4o,gpt-4o-mini,o3,o3-mini, etc. - Mainstream models from Anthropic / Google / Mistral / DeepSeek / Qwen, etc.
- OpenAI Series:
- You can add or remove as needed, or manually enter custom standard model names.
- Built-in standard models from common vendors, for example:
- Regenerate Mappings Now
- After clicking the button, the plugin will:
- Fetch all channel lists (filtering out manually/automatically disabled channels).
- Calculate the "Standard Model → Actual Model" mapping table for each channel.
- Merge the results with the existing
model_mappingand write them back (new keys overwrite old values).
- After clicking the button, the plugin will:
- Clear Model Redirect Mappings (Dangerous Operation)
- Clicking this will first open a Preview/Selection modal, loading the channel list for the current site:
- Select All channels by default;
- Supports Select All / Deselect All quick actions;
- Supports individually selecting channels to clear.
- After clicking "Continue" in the preview modal, a secondary confirmation (unreachable by accident) will appear:
- Upon confirmation,
model_mapping = "{}"will be written to the selected channels (clearing mappings). - Channels not selected will not be modified.
- This operation will clear any custom mappings you may have manually maintained and cannot be undone.
- Upon confirmation,
- If partial failures occur:
- The plugin will continue to attempt clearing other channels;
- The UI will provide a summary of successes/failures and display failure details in the modal for you to retry or handle manually.
- Clicking this will first open a Preview/Selection modal, loading the channel list for the current site:
How It Works (Briefly)
- Read the Model Redirect configuration from user preferences:
- If not enabled, return directly and prompt "Feature is disabled."
- Calculate the standard model set:
- If you haven't customized it, use the built-in complete set of standard models.
- Obtain all channel lists through the New API management interface.
- For each channel:
- Parse the channel's
modelsfield into a list of actual models. - Perform multi-stage matching for each standard model:
- If the channel itself contains a model with the same name, skip (no redirection needed).
- Otherwise, find the closest candidate actual model based on the unified "Model Normalization Rule" (
renameModel). - Version Guard: Only match models of the same version; do not downgrade/upgrade across versions (e.g.,
claude-4.5-sonnetwill not be mapped toclaude-3.5-sonnet; if no same-version candidate is found, skip this standard model). - Select an unused actual model from the candidate set and write the
standardModel -> actualModelmapping.
- Merge the new mappings with the channel's existing
model_mappingJSON and write them back.
- Parse the channel's
- Summarize the number of successfully updated channels and reasons for failure, displayed as a toast in the UI.
Typical Use Cases
- Unifying OpenAI Compatible Model Names
- Different upstream providers may use slightly different model naming conventions (e.g., with prefixes/suffixes).
- Through Model Redirect, you can consistently use unified names in downstream applications, such as
gpt-4o, with New API routing to the actual model based on the mapping.
- Coordinating with Channel Priority
- Set weights/priorities for different channels in New API, and then combine with unified standard model names to achieve multi-upstream disaster recovery and traffic distribution.
Frequently Asked Questions
- Prompting for Missing New API Configuration
- Please first fill in the Admin URL, Token, and User ID in "Basic Settings → New API Integration Settings" and save.
- Prompting that the Feature is Not Enabled
- Confirm that the "Enable Model Redirect" toggle has been turned on in the "Model Redirect" area.
- Some Standard Models Did Not Generate Mappings
- This indicates that no matching actual model was found in the corresponding channel, or all candidates were already occupied by other standard models.
- It's also possible that the channel has no same-version candidate models: the plugin will not generate mappings by downgrading/upgrading across versions.
- You can check if the channel's
modelsfield is complete, or adjust the standard model list.
- Will Existing Manual Configurations Be Overwritten?
- For the same
standardModel, newly generated mappings will overwrite old values; - Other keys added manually but not overwritten will remain in
model_mapping.
- For the same
Usage Recommendations
- It is recommended to first validate the generation results on a test environment or a small number of channels before performing batch redirection on all channels.
- If you primarily maintain your model list through New API Model Synchronization, it is recommended to click "Regenerate Mappings" after completing the synchronization.
