chore: track model variant in honeycomb (#26188)

This commit is contained in:
Victor Navarro
2026-05-07 19:38:04 +02:00
committed by GitHub
parent a300a6cc7a
commit 626a488fb8
8 changed files with 10 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ export function POST(input: APIEvent) {
modelList: "lite",
parseApiKey: (headers: Headers) => headers.get("authorization")?.split(" ")[1],
parseModel: (url: string, body: any) => body.model,
parseVariant: (url: string, body: any) => body.reasoningEffort ?? body.reasoning_effort,
parseIsStream: (url: string, body: any) => !!body.stream,
})
}

View File

@@ -7,6 +7,7 @@ export function POST(input: APIEvent) {
modelList: "lite",
parseApiKey: (headers: Headers) => headers.get("x-api-key") ?? undefined,
parseModel: (url: string, body: any) => body.model,
parseVariant: (url: string, body: any) => body.effort,
parseIsStream: (url: string, body: any) => !!body.stream,
})
}

View File

@@ -71,6 +71,7 @@ export async function handler(
modelList: "lite" | "full"
parseApiKey: (headers: Headers) => string | undefined
parseModel: (url: string, body: any) => string
parseVariant: (url: string, body: any) => string | undefined
parseIsStream: (url: string, body: any) => boolean
},
) {
@@ -93,6 +94,7 @@ export async function handler(
const url = input.request.url
const body = await input.request.json()
const model = opts.parseModel(url, body)
const variant = opts.parseVariant(url, body)
const isStream = opts.parseIsStream(url, body)
const rawIp = input.request.headers.get("x-real-ip") ?? ""
const ip = rawIp.includes(":") ? rawIp.split(":").slice(0, 4).join(":") : rawIp
@@ -109,6 +111,7 @@ export async function handler(
request: requestId,
client: ocClient,
user_agent: userAgent,
"model.variant": variant,
})
const zenData = ZenData.list(opts.modelList)
const modelInfo = validateModel(zenData, model)

View File

@@ -7,6 +7,7 @@ export function POST(input: APIEvent) {
modelList: "full",
parseApiKey: (headers: Headers) => headers.get("authorization")?.split(" ")[1],
parseModel: (url: string, body: any) => body.model,
parseVariant: (url: string, body: any) => body.reasoningEffort ?? body.reasoning_effort,
parseIsStream: (url: string, body: any) => !!body.stream,
})
}

View File

@@ -7,6 +7,7 @@ export function POST(input: APIEvent) {
modelList: "full",
parseApiKey: (headers: Headers) => headers.get("x-api-key") ?? undefined,
parseModel: (url: string, body: any) => body.model,
parseVariant: (url: string, body: any) => body.effort,
parseIsStream: (url: string, body: any) => !!body.stream,
})
}

View File

@@ -7,6 +7,7 @@ export function POST(input: APIEvent) {
modelList: "full",
parseApiKey: (headers: Headers) => headers.get("x-goog-api-key") ?? undefined,
parseModel: (url: string, _body: any) => url.split("/").pop()?.split(":")?.[0] ?? "",
parseVariant: (url: string, body: any) => body.thinkingLevel,
parseIsStream: (url: string, _body: any) =>
// ie. url: https://opencode.ai/zen/v1/models/gemini-3-pro:streamGenerateContent?alt=sse'
url.split("/").pop()?.split(":")?.[1]?.startsWith("streamGenerateContent") ?? false,

View File

@@ -7,6 +7,7 @@ export function POST(input: APIEvent) {
modelList: "full",
parseApiKey: (headers: Headers) => headers.get("authorization")?.split(" ")[1],
parseModel: (url: string, body: any) => body.model,
parseVariant: (url: string, body: any) => body.reasoning?.effort,
parseIsStream: (url: string, body: any) => !!body.stream,
})
}

View File

@@ -19,7 +19,7 @@ export default {
url.pathname !== "/zen/go/v1/responses" &&
!url.pathname.startsWith("/zen/go/v1/models/")
)
return
continue
let data = {
"cf.continent": event.event.request.cf?.continent,