mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
feat(vercel-ai-gateway): support embeddings, images and credit usage
Extend Vercel AI Gateway beyond chat: add OpenAI-compatible embeddings and image generation endpoints, credit balance fetch on the usage dashboard, retry on 429, and models catalog fetcher. Thinking/reasoning mapping is omitted pending a project-wide refactor. Co-authored-by: Ngô Tấn Tài <tantai@newnol.io.vn> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
decolua
co-authored by
Cursor
parent
d9b030011f
commit
b33cbb0280
@@ -207,6 +207,24 @@ export function parseQuotaData(provider, data) {
|
||||
}
|
||||
break;
|
||||
|
||||
case "vercel-ai-gateway":
|
||||
// Vercel returns currency credit balance, not request quotas.
|
||||
// The 'Remaining (USD)' row needs explicit remainingPercentage because
|
||||
// its used/total values would otherwise compute the wrong direction
|
||||
// (e.g. used=95.5 / total=100 → 4% instead of 96%).
|
||||
if (data.quotas) {
|
||||
Object.entries(data.quotas).forEach(([name, quota]) => {
|
||||
normalizedQuotas.push({
|
||||
name,
|
||||
used: quota.used || 0,
|
||||
total: quota.total || 0,
|
||||
resetAt: quota.resetAt || null,
|
||||
remainingPercentage: quota.remainingPercentage,
|
||||
});
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Generic fallback for unknown providers
|
||||
if (data.quotas) {
|
||||
|
||||
Reference in New Issue
Block a user