Skip to content

Route embeddings and transcription through Vercel#4490

Open
chrarnoldus wants to merge 1 commit into
mainfrom
feat/vercel-routing-embeddings-transcription
Open

Route embeddings and transcription through Vercel#4490
chrarnoldus wants to merge 1 commit into
mainfrom
feat/vercel-routing-embeddings-transcription

Conversation

@chrarnoldus

Copy link
Copy Markdown
Contributor

Summary

  • add independent Redis-backed Vercel routing percentages for chat, embeddings, and transcription
  • route eligible embeddings through the existing Vercel model/provider conversion path
  • adapt transcription requests to Vercel AI Gateway's beta /v4/ai/transcription-model REST contract
  • account for Vercel provider metadata costs and preserve organization routing policies

Validation

  • pnpm format
  • pnpm --filter web lint
  • focused runtime assertions for gateway config migration and the transcription adapter
  • focused Jest suites could not run because Postgres is unavailable and Docker is not installed in the execution environment
  • TypeScript checks exceeded the execution environment's 120-second command limit

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
@chrarnoldus chrarnoldus self-assigned this Jul 10, 2026
};

return {
audio: body.input_audio.data,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: safety_identifier/user are silently dropped for Vercel-routed transcription

route.ts explicitly sets body.safety_identifier = generateProviderSpecificHash(user.id, provider) and body.user = body.safety_identifier before building the upstream body, specifically for upstream abuse/fraud attribution. For the OpenRouter path, buildUpstreamBody returns body unchanged, so these fields reach the upstream. For the Vercel path added here, buildVercelTranscriptionBody constructs an entirely new object containing only audio, mediaType, and providerOptionssafety_identifier and user are never forwarded. This is inconsistent with the embeddings Vercel path, which preserves safety_identifier in the upstream body. If Vercel's /v4/ai/transcription-model contract has no equivalent field, per-user abuse attribution is silently lost for all transcription traffic routed to Vercel.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

The new Vercel transcription REST adapter drops the safety_identifier/user abuse-attribution fields that are explicitly set upstream, unlike the parallel embeddings path which preserves them.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
apps/web/src/lib/ai-gateway/transcriptions/transcription-request.ts 58 safety_identifier/user are silently dropped for Vercel-routed transcription requests
Files Reviewed (16 files)
  • apps/web/src/app/admin/gateway/RoutingContent.tsx
  • apps/web/src/app/api/openrouter/audio/transcriptions/route.test.ts
  • apps/web/src/app/api/openrouter/audio/transcriptions/route.ts
  • apps/web/src/app/api/openrouter/embeddings/route.ts
  • apps/web/src/lib/ai-gateway/embeddings/embedding-request.ts
  • apps/web/src/lib/ai-gateway/gateway-config.test.ts
  • apps/web/src/lib/ai-gateway/gateway-config.ts
  • apps/web/src/lib/ai-gateway/llm-proxy-helpers.test.ts
  • apps/web/src/lib/ai-gateway/llm-proxy-helpers.ts
  • apps/web/src/lib/ai-gateway/providers/get-provider.ts
  • apps/web/src/lib/ai-gateway/providers/getEmbeddingProvider.test.ts
  • apps/web/src/lib/ai-gateway/providers/vercel/index.ts
  • apps/web/src/lib/ai-gateway/transcriptions/transcription-request.test.ts
  • apps/web/src/lib/ai-gateway/transcriptions/transcription-request.ts - 1 issue
  • apps/web/src/routers/admin/gateway-config-router.ts
  • packages/db/src/schema-types.ts

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-5-20260630 · Input: 66 · Output: 35.9K · Cached: 3.6M

Review guidance: REVIEW.md from base branch main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant