new-api icon indicating copy to clipboard operation
new-api copied to clipboard

[Feature] Passthrough mode should keep model name mapping (or add a toggle)

Open woohahahaaa opened this issue 5 months ago • 1 comments

Problem

In passthrough (透传) mode, new-api forwards the request body as-is, which means the configured model name mapping is also bypassed — the original model name from the client is sent to the upstream instead of the mapped one.

From a product-design perspective this is a bit awkward: passthrough mode is meant to skip new-api's request-body rewriting, but model name mapping is the one rewrite that almost every operator relies on (it's how they decouple the client-side model name from the upstream model name). Skipping it silently in passthrough mode means a config that works in normal mode can suddenly fail in passthrough mode, with no warning.

Suggested change

Add a toggle on the channel, something like:

  • Passthrough mode: forward everything (current behavior)
  • Passthrough mode + keep model name mapping: forward everything except the model name — i.e. rewrite the model name using the configured mapping, then pass the rest of the body through unchanged.

Or, more generally, an opt-in flag such as keepModelMapping: true in the channel config.

This way operators can still benefit from passthrough (e.g. sending unsupported fields straight through to upstream) without losing the one rewrite they actually depend on.

Notes

I hit this on the Volcengine (火山引擎) Coding Plan channel — a model whose mapping shortens the model name prefix caused upstream to fail with 404 The requested model does not support the coding plan feature. Other models with the same upstream that just append a suffix to the original name still work fine in passthrough mode, which is what pointed me at the model-mapping bypass rather than an upstream issue.

newapi version: latest main

woohahahaaa avatar Jun 20 '26 17:06 woohahahaaa

[Bot Review]

Thanks for the suggestion. This issue doesn't use the required feature request template, so please resubmit it with the template sections filled in, including version, submission checks, feature description, and use case.