wip: zen
This commit is contained in:
@@ -6,6 +6,20 @@ import { centsToMicroCents } from "@opencode/cloud-core/util/price.js"
|
|||||||
import { Identifier } from "@opencode/cloud-core/identifier.js"
|
import { Identifier } from "@opencode/cloud-core/identifier.js"
|
||||||
import { Resource } from "@opencode/cloud-resource"
|
import { Resource } from "@opencode/cloud-resource"
|
||||||
|
|
||||||
|
export async function handler(
|
||||||
|
input: APIEvent,
|
||||||
|
opts: {
|
||||||
|
transformBody?: (body: any) => any
|
||||||
|
parseUsageChunk: (chunk: string) => string | undefined
|
||||||
|
buildUsage: (body: any) => {
|
||||||
|
inputTokens: number
|
||||||
|
outputTokens: number
|
||||||
|
reasoningTokens: number
|
||||||
|
cacheReadTokens: number
|
||||||
|
cacheWriteTokens: number
|
||||||
|
}
|
||||||
|
},
|
||||||
|
) {
|
||||||
class AuthError extends Error {}
|
class AuthError extends Error {}
|
||||||
class CreditsError extends Error {}
|
class CreditsError extends Error {}
|
||||||
class ModelError extends Error {}
|
class ModelError extends Error {}
|
||||||
@@ -110,20 +124,6 @@ const FREE_WORKSPACES = [
|
|||||||
"wrk_01K46JDFR0E75SG2Q8K172KF3Y", // frank
|
"wrk_01K46JDFR0E75SG2Q8K172KF3Y", // frank
|
||||||
]
|
]
|
||||||
|
|
||||||
export async function handler(
|
|
||||||
input: APIEvent,
|
|
||||||
opts: {
|
|
||||||
transformBody?: (body: any) => any
|
|
||||||
parseUsageChunk: (chunk: string) => string | undefined
|
|
||||||
buildUsage: (body: any) => {
|
|
||||||
inputTokens: number
|
|
||||||
outputTokens: number
|
|
||||||
reasoningTokens: number
|
|
||||||
cacheReadTokens: number
|
|
||||||
cacheWriteTokens: number
|
|
||||||
}
|
|
||||||
},
|
|
||||||
) {
|
|
||||||
const logger = {
|
const logger = {
|
||||||
metric: (values: Record<string, any>) => {
|
metric: (values: Record<string, any>) => {
|
||||||
console.log(`_metric:${JSON.stringify(values)}`)
|
console.log(`_metric:${JSON.stringify(values)}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user