wip: zen
This commit is contained in:
@@ -6,11 +6,25 @@ 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"
|
||||||
|
|
||||||
class AuthError extends Error {}
|
export async function handler(
|
||||||
class CreditsError extends Error {}
|
input: APIEvent,
|
||||||
class ModelError extends Error {}
|
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 CreditsError extends Error {}
|
||||||
|
class ModelError extends Error {}
|
||||||
|
|
||||||
const MODELS = {
|
const MODELS = {
|
||||||
// "anthropic/claude-sonnet-4": {
|
// "anthropic/claude-sonnet-4": {
|
||||||
// auth: true,
|
// auth: true,
|
||||||
// api: "https://api.anthropic.com",
|
// api: "https://api.anthropic.com",
|
||||||
@@ -104,26 +118,12 @@ const MODELS = {
|
|||||||
},
|
},
|
||||||
headerMappings: {},
|
headerMappings: {},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
|
|
||||||
const FREE_WORKSPACES = [
|
|
||||||
"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 FREE_WORKSPACES = [
|
||||||
|
"wrk_01K46JDFR0E75SG2Q8K172KF3Y", // frank
|
||||||
|
]
|
||||||
|
|
||||||
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