fix: keep upstream token budgets billing-safe
This commit is contained in:
1 parent
4ec47cdb23
commit
e0c926104e
4 files changed
+131
-44
No files matched your search
+1
-3
@@ -86,9 +86,7 @@ public class GatewayController {
|
||||
String providerId=String.valueOf(model.get("providerId"));
|
||||
boolean mock="provider-mock".equals(providerId);
|
||||
if(!mock && !provider.isConfigured(providerId)) throw new ApiException("PROVIDER_NOT_CONFIGURED","该供应商尚未配置密钥,不能执行真实调用",503);
|
||||
Map<String,Object> normalizedInput = new LinkedHashMap<>(input);
|
||||
OpenAiCompatibleProvider.prepareRequestForModel(String.valueOf(model.get("upstreamModel")), normalizedInput);
|
||||
ChatMeter.Request request=ChatMeter.request(normalizedInput,json);
|
||||
ChatMeter.Request request=ChatMeter.request(input,json);
|
||||
guard.checkRate(UUID.fromString(String.valueOf(key.get("id"))), false);
|
||||
// Reserve both limits atomically. A queued request never consumes a
|
||||
// model slot while waiting for the API-Key slot (or vice versa).
|
||||
|
||||
Reference in new issue
Block a user