mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-23 22:23:18 -04:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 826d9ad46a |
@@ -293,7 +293,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/alibaba": "1.0.17",
|
||||
"@ai-sdk/amazon-bedrock": "4.0.158",
|
||||
"@ai-sdk/amazon-bedrock": "4.0.112",
|
||||
"@ai-sdk/anthropic": "3.0.82",
|
||||
"@ai-sdk/azure": "3.0.88",
|
||||
"@ai-sdk/cerebras": "2.0.41",
|
||||
@@ -568,7 +568,7 @@
|
||||
"@actions/github": "6.0.1",
|
||||
"@agentclientprotocol/sdk": "0.21.0",
|
||||
"@ai-sdk/alibaba": "1.0.17",
|
||||
"@ai-sdk/amazon-bedrock": "4.0.158",
|
||||
"@ai-sdk/amazon-bedrock": "4.0.112",
|
||||
"@ai-sdk/anthropic": "3.0.82",
|
||||
"@ai-sdk/azure": "3.0.88",
|
||||
"@ai-sdk/cerebras": "2.0.60",
|
||||
@@ -1173,7 +1173,7 @@
|
||||
|
||||
"@ai-sdk/alibaba": ["@ai-sdk/alibaba@1.0.17", "", { "dependencies": { "@ai-sdk/openai-compatible": "2.0.41", "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.23" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-ZbE+U5bWz2JBc5DERLowx5+TKbjGBE93LqKZAWvuEn7HOSQMraxFMZuc0ST335QZJAyfBOzh7m1mPQ+y7EaaoA=="],
|
||||
|
||||
"@ai-sdk/amazon-bedrock": ["@ai-sdk/amazon-bedrock@4.0.158", "", { "dependencies": { "@ai-sdk/anthropic": "3.0.111", "@ai-sdk/openai": "3.0.98", "@ai-sdk/provider": "3.0.15", "@ai-sdk/provider-utils": "4.0.46", "@smithy/eventstream-codec": "^4.0.1", "@smithy/util-utf8": "^4.0.0", "aws4fetch": "^1.0.20" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-yZebHEszUzPLsK+Rq5sVZJkJj7EYDgY+Lz36IGf/RSkSC5LOMDbVKoQ55S8xNzJqVjUDqlWuZiQzg40HQslmCw=="],
|
||||
"@ai-sdk/amazon-bedrock": ["@ai-sdk/amazon-bedrock@4.0.112", "", { "dependencies": { "@ai-sdk/anthropic": "3.0.81", "@ai-sdk/openai": "3.0.67", "@ai-sdk/provider": "3.0.10", "@ai-sdk/provider-utils": "4.0.27", "@smithy/eventstream-codec": "^4.0.1", "@smithy/util-utf8": "^4.0.0", "aws4fetch": "^1.0.20" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-PsSh7a6qW+3kQXPs1kD4wDwuZby0t1PIaB6j/1aMKmPFJ5LxcIcULLMF/bjITLt5o/8lc0t6TXIwG0zlhH7uZw=="],
|
||||
|
||||
"@ai-sdk/anthropic": ["@ai-sdk/anthropic@3.0.82", "", { "dependencies": { "@ai-sdk/provider": "3.0.10", "@ai-sdk/provider-utils": "4.0.27" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-WKKou2wbhGGYV8PSALAPyV2YY4nfCqCPkyBzYtJtDA9yCcIFwsbtkTNgg7bqtLCVzeEsY7wwxRoCWy+EMfrw/A=="],
|
||||
|
||||
@@ -5641,13 +5641,13 @@
|
||||
|
||||
"@ai-sdk/alibaba/@ai-sdk/openai-compatible": ["@ai-sdk/openai-compatible@2.0.41", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.23" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-kNAGINk71AlOXx10Dq/PXw4t/9XjdK8uxfpVElRwtSFMdeSiLVt58p9TPx4/FJD+hxZuVhvxYj9r42osxWq79g=="],
|
||||
|
||||
"@ai-sdk/amazon-bedrock/@ai-sdk/anthropic": ["@ai-sdk/anthropic@3.0.111", "", { "dependencies": { "@ai-sdk/provider": "3.0.15", "@ai-sdk/provider-utils": "4.0.46" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-atgBW8jZPr/KuaKX5FvDIHuXBI8VCol6kVeoD4P0657+VXR73QsLogXQVN/Zt5FHtq9WzpdIZseCJiXPqkgwwA=="],
|
||||
"@ai-sdk/amazon-bedrock/@ai-sdk/anthropic": ["@ai-sdk/anthropic@3.0.81", "", { "dependencies": { "@ai-sdk/provider": "3.0.10", "@ai-sdk/provider-utils": "4.0.27" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-B1JDd9Ugq9R5AgIaW3674lhGCMMYJcPUxnrZh8fzbGojgg4QvHFRv6eZahGQAUsmGHbcf74G9bdSBDLWQGY2GA=="],
|
||||
|
||||
"@ai-sdk/amazon-bedrock/@ai-sdk/openai": ["@ai-sdk/openai@3.0.98", "", { "dependencies": { "@ai-sdk/provider": "3.0.15", "@ai-sdk/provider-utils": "4.0.46" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-nAvp8pVOUJ3znJHRzZs54Y7CJQSikOW1Ty7LTdtQT+/pgtAwqhuKd8oaXbiW2xQaYBdH2i8o9AcEpcUdXIyF+g=="],
|
||||
"@ai-sdk/amazon-bedrock/@ai-sdk/openai": ["@ai-sdk/openai@3.0.67", "", { "dependencies": { "@ai-sdk/provider": "3.0.10", "@ai-sdk/provider-utils": "4.0.27" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-oAiGC9eWG7IgtdsdS74bOCnAAHarAfTJhWN9x5INwnWPekL802AvF+0I5DvLzIF1MIRmNw4N8mPSL/GUVbX9Mw=="],
|
||||
|
||||
"@ai-sdk/amazon-bedrock/@ai-sdk/provider": ["@ai-sdk/provider@3.0.15", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-XeZW1CcDF2GMbH4wejW6xBRI2QCOgnkVYUnxoeDadB1mf85riL2bMUeDoh+6gJ/r4mjNfzUPW8OjLjvwTP0u1Q=="],
|
||||
"@ai-sdk/amazon-bedrock/@ai-sdk/provider": ["@ai-sdk/provider@3.0.10", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-Q3BZ27qfpYqnCYGvE3vt+Qi6LGOF9R5Nmzn+9JoM1lCRsD9mYaIhfJLkSunN48nfGXJ6n+XNV0J/XVpqGQl7Dw=="],
|
||||
|
||||
"@ai-sdk/amazon-bedrock/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.46", "", { "dependencies": { "@ai-sdk/provider": "3.0.15", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.8", "undici": "^6.28.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-tEtld97plCFiYevsJuOkGkeuhQndeMWFBVrJS4AjnbD5AqrNSXRCe0p+BZ3Cju/sxDeeZ9ym3q9YUV8fASA7aQ=="],
|
||||
"@ai-sdk/amazon-bedrock/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.27", "", { "dependencies": { "@ai-sdk/provider": "3.0.10", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.8" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-ubkAJ+xODouwtmN1tYlvTPphH1hPOBfZaEQe8U7skGvFAnIRs9PPpsq57bC2+Ky/MB4yzhd6YOsxTAx9sGpazw=="],
|
||||
|
||||
"@ai-sdk/amazon-bedrock/@smithy/eventstream-codec": ["@smithy/eventstream-codec@4.2.14", "", { "dependencies": { "@aws-crypto/crc32": "5.2.0", "@smithy/types": "^4.14.1", "@smithy/util-hex-encoding": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-erZq0nOIpzfeZdCyzZjdJb4nVSKLUmSkaQUVkRGQTXs30gyUGeKnrYEg+Xe1W5gE3aReS7IgsvANwVPxSzY6Pw=="],
|
||||
|
||||
@@ -6589,8 +6589,6 @@
|
||||
|
||||
"@ai-sdk/amazon-bedrock/@ai-sdk/provider-utils/@standard-schema/spec": ["@standard-schema/spec@1.1.0", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="],
|
||||
|
||||
"@ai-sdk/amazon-bedrock/@ai-sdk/provider-utils/undici": ["undici@6.28.0", "", {}, "sha512-LIY910g9TI13YS95lrMFrs8Rm/u/irgHeTWoKCoteeJ04CUJ92eEfj0rVn+7VKMPBpUPiUoBKfhNyLI23EE/KA=="],
|
||||
|
||||
"@ai-sdk/anthropic/@ai-sdk/provider-utils/@standard-schema/spec": ["@standard-schema/spec@1.1.0", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="],
|
||||
|
||||
"@ai-sdk/azure/@ai-sdk/provider-utils/@standard-schema/spec": ["@standard-schema/spec@1.1.0", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="],
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"nodeModules": {
|
||||
"x86_64-linux": "sha256-Be1I6OG6UitofhcGu2BeNzevmoQXc4Or5r/NPzwtft4=",
|
||||
"aarch64-linux": "sha256-O+d+26CQIjZ08Rn8Qm3IytdDqIMbPdhzaGOZeUKAvIU=",
|
||||
"aarch64-darwin": "sha256-ObS50y/oy6fM9wSGUL/wx6O0+fTWHC04mXJNd7w/2Z0=",
|
||||
"x86_64-darwin": "sha256-eoR7ZSyH62Fq2ZaW2b2QqU2FC97rYxTMeEe+djT0nto="
|
||||
"x86_64-linux": "sha256-yQ8EIxxYkzlEWIMY/UiIR+7lbGBuizsoehMPZzFA65Y=",
|
||||
"aarch64-linux": "sha256-JF9VVgnl5QUZ430fqb5Qu8y0kchYJ00LO3FbYcd0lBM=",
|
||||
"aarch64-darwin": "sha256-f3Tu6eu463NWcHgr7dupfD/zUTh26bJ6N2vVXuEyi6c=",
|
||||
"x86_64-darwin": "sha256-miv9Sv4KdhD0UIi2O5LVS1wQOfq29IV+9S+BvIzAvgo="
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ function ModelSelectorPopoverV2View(props: {
|
||||
<For each={groups()}>
|
||||
{(group) => (
|
||||
<MenuV2.Group>
|
||||
<MenuV2.GroupLabel class="sticky top-0 z-10 gap-2 bg-v2-background-bg-layer-01 px-3">
|
||||
<MenuV2.GroupLabel class="gap-2 px-3">
|
||||
<span class="min-w-0 truncate">{group.items[0].provider.name}</span>
|
||||
</MenuV2.GroupLabel>
|
||||
<MenuV2.RadioGroup value={props.current()}>
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import type { APIEvent } from "@solidjs/start/server"
|
||||
import { Workspace } from "@opencode-ai/console-core/workspace.js"
|
||||
import { safeEqual } from "@opencode-ai/console-core/util/crypto.js"
|
||||
import { Resource } from "@opencode-ai/console-resource"
|
||||
import z from "zod"
|
||||
|
||||
const Body = z.object({ workspaceID: z.string().startsWith("wrk_") })
|
||||
|
||||
export async function POST(event: APIEvent) {
|
||||
if (!safeEqual(event.request.headers.get("authorization") ?? "", `Bearer ${Resource.SUPPORT_API_KEY.value}`)) {
|
||||
return Response.json({ error: "Unauthorized" }, { status: 401 })
|
||||
}
|
||||
|
||||
const body = Body.safeParse(await event.request.json().catch(() => undefined))
|
||||
if (!body.success) {
|
||||
return Response.json({ error: "Invalid request", issues: body.error.issues }, { status: 400 })
|
||||
}
|
||||
return Workspace.unblock(body.data)
|
||||
.then(() => Response.json({ success: true, message: "Workspace unblocked" }))
|
||||
.catch((error) => Response.json({ error: error instanceof Error ? error.message : String(error) }, { status: 400 }))
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { APIEvent } from "@solidjs/start"
|
||||
import { waitUntil } from "@opencode-ai/console-resource"
|
||||
import type { DownloadPlatform } from "../types"
|
||||
|
||||
const prodAssetNames: Record<string, string> = {
|
||||
@@ -31,34 +30,14 @@ export async function GET({ params: { platform, channel } }: APIEvent) {
|
||||
const assetName = channel === "stable" ? prodAssetNames[platform] : betaAssetNames[platform]
|
||||
if (!assetName) return new Response(null, { status: 404 })
|
||||
|
||||
const latest = await fetch(
|
||||
const resp = await fetch(
|
||||
`https://github.com/anomalyco/${channel === "stable" ? "opencode" : "opencode-beta"}/releases/latest/download/${assetName}`,
|
||||
{ redirect: "manual" },
|
||||
)
|
||||
const location = latest.headers.get("location")
|
||||
if (!location) return new Response(null, { status: 502 })
|
||||
|
||||
const key = new Request(location)
|
||||
const cache = (caches as CacheStorage & { default: Cache }).default
|
||||
const cached = await cache.match(key)
|
||||
if (cached) return download(cached, platform, "HIT")
|
||||
|
||||
const resp = await fetch(location)
|
||||
if (!resp.ok) return resp
|
||||
|
||||
const headers = new Headers(resp.headers)
|
||||
headers.set("cache-control", "public, max-age=31536000, immutable")
|
||||
headers.delete("set-cookie")
|
||||
const result = new Response(resp.body, { status: resp.status, statusText: resp.statusText, headers })
|
||||
waitUntil(cache.put(key, result.clone()))
|
||||
return download(result, platform, "MISS")
|
||||
}
|
||||
|
||||
function download(resp: Response, platform: string, cache: "HIT" | "MISS") {
|
||||
const downloadName = downloadNames[platform]
|
||||
|
||||
const headers = new Headers(resp.headers)
|
||||
if (downloadName) headers.set("content-disposition", `attachment; filename="${downloadName}"`)
|
||||
headers.set("x-opencode-cache", cache)
|
||||
|
||||
return new Response(resp.body, { status: resp.status, statusText: resp.statusText, headers })
|
||||
}
|
||||
|
||||
@@ -28,7 +28,13 @@ import {
|
||||
GoUsageLimitError,
|
||||
BlackUsageLimitError,
|
||||
} from "./error"
|
||||
import { buildCostChunk, createStreamPartConverter, createResponseConverter, UsageInfo } from "./provider/provider"
|
||||
import {
|
||||
buildCostChunk,
|
||||
createBodyConverter,
|
||||
createStreamPartConverter,
|
||||
createResponseConverter,
|
||||
UsageInfo,
|
||||
} from "./provider/provider"
|
||||
import { anthropicHelper } from "./provider/anthropic"
|
||||
import { googleHelper } from "./provider/google"
|
||||
import { openaiHelper } from "./provider/openai"
|
||||
@@ -47,10 +53,12 @@ import { createProviderBudgetTracker } from "./providerBudgetTracker"
|
||||
import { accumulateUsage, HOT_WORKSPACES } from "./usageBatcher"
|
||||
import { Workspace } from "@opencode-ai/console-core/workspace.js"
|
||||
import { countryFromRequest, isModelCountryRestricted } from "~/lib/request-country"
|
||||
import { prepareRequestBody } from "./requestBody"
|
||||
|
||||
type ZenData = Awaited<ReturnType<typeof ZenData.list>>
|
||||
type PreparedBody = Awaited<ReturnType<typeof prepareRequestBody>>
|
||||
type RetryOptions = {
|
||||
excludeProviders: string[]
|
||||
retryCount: number
|
||||
}
|
||||
type BillingSource = "anonymous" | "free" | "byok" | "subscription" | "lite" | "balance"
|
||||
|
||||
function resolve(text: string, params?: Record<string, string | number>) {
|
||||
@@ -78,6 +86,8 @@ export async function handler(
|
||||
type ProviderInfo = Awaited<ReturnType<typeof selectProvider>>
|
||||
type CostInfo = ReturnType<typeof calculateCost>
|
||||
|
||||
const MAX_FAILOVER_RETRIES = 3
|
||||
const MAX_RETRYABLE_STATUS_RETRIES = 3
|
||||
const dict = i18n(localeFromRequest(input.request))
|
||||
const t = (key: Key, params?: Record<string, string | number>) => resolve(dict[key], params)
|
||||
const ADMIN_WORKSPACES = [
|
||||
@@ -86,14 +96,12 @@ export async function handler(
|
||||
"wrk_01KKZDKDWCS1VTJF8QTX62DD50", // contributors
|
||||
]
|
||||
|
||||
let requestBody: PreparedBody | undefined
|
||||
try {
|
||||
const url = input.request.url
|
||||
const body = input.request.body
|
||||
if (!body) throw new Error("Missing request body")
|
||||
requestBody = opts.format === "google" ? undefined : await prepareRequestBody(body)
|
||||
const model = opts.format === "google" ? opts.parseModel(url, undefined) : (requestBody?.model ?? "")
|
||||
const googleStream = opts.format === "google" ? opts.parseIsStream(url, undefined) : undefined
|
||||
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
|
||||
const rawZenApiKey = opts.parseApiKey(input.request.headers)
|
||||
@@ -104,10 +112,12 @@ export async function handler(
|
||||
const projectId = input.request.headers.get("x-opencode-project") ?? ""
|
||||
const userAgent = input.request.headers.get("user-agent") ?? ""
|
||||
logger.metric({
|
||||
is_stream: isStream,
|
||||
session: sessionId,
|
||||
request: requestId,
|
||||
client: ocClient,
|
||||
user_agent: userAgent,
|
||||
"model.variant": variant,
|
||||
"model.tier": opts.modelList === "full" ? "zen" : "go",
|
||||
})
|
||||
const zenData = ZenData.list(opts.modelList)
|
||||
@@ -165,7 +175,7 @@ export async function handler(
|
||||
)
|
||||
const providerBudget = await providerBudgetTracker?.check()
|
||||
|
||||
const providerRequest = async () => {
|
||||
const retriableRequest = async (retry: RetryOptions = { excludeProviders: [], retryCount: 0 }) => {
|
||||
const providerInfo = selectProvider(
|
||||
model,
|
||||
zenData,
|
||||
@@ -173,6 +183,7 @@ export async function handler(
|
||||
modelInfo,
|
||||
stickyId,
|
||||
trialProviders,
|
||||
retry,
|
||||
stickyProvider,
|
||||
modelTpmLimits,
|
||||
modelTpsLimits,
|
||||
@@ -188,65 +199,80 @@ export async function handler(
|
||||
})
|
||||
|
||||
const startTimestamp = Date.now()
|
||||
const reqUrl = providerInfo.modifyUrl(providerInfo.api, googleStream ?? false)
|
||||
const specialAnthropic =
|
||||
providerInfo.format === "anthropic" &&
|
||||
(providerInfo.model.startsWith("arn:aws:bedrock:") ||
|
||||
providerInfo.model.startsWith("global.anthropic.") ||
|
||||
providerInfo.model.startsWith("databricks-claude-"))
|
||||
if (providerInfo.format !== opts.format) throw new Error("Zen provider format must match request format")
|
||||
if (specialAnthropic) throw new Error("Anthropic provider body modifiers are incompatible with streaming")
|
||||
const prepared = requestBody
|
||||
|
||||
const reqBody = (() => {
|
||||
if (opts.format === "google") return body
|
||||
if (!prepared) throw new Error("Missing prepared request body")
|
||||
return prepared.stream(providerInfo.model, providerInfo.format === "oa-compat")
|
||||
})()
|
||||
const reqUrl = providerInfo.modifyUrl(providerInfo.api, isStream)
|
||||
const reqBody = JSON.stringify(
|
||||
providerInfo.modifyBody({
|
||||
...createBodyConverter(opts.format, providerInfo.format)(body),
|
||||
model: providerInfo.model,
|
||||
...(() => {
|
||||
const replacer = (obj: Record<string, any>): Record<string, any> =>
|
||||
Object.fromEntries(
|
||||
Object.entries(obj).flatMap(([k, v]) => {
|
||||
if (Array.isArray(v)) return [[k, v]]
|
||||
if (typeof v === "object") return [[k, replacer(v)]]
|
||||
if (typeof v === "string") {
|
||||
if (v === "$workspace") return authInfo?.workspaceID ? [[k, authInfo.workspaceID]] : []
|
||||
if (v === "$org")
|
||||
return authInfo?.workspaceID ? [[k, authInfo.workspaceID.replace("wrk_", "org_")]] : []
|
||||
if (v === "$user") return stickyId ? [[k, stickyId]] : []
|
||||
if (v.startsWith("$header.")) {
|
||||
const headerValue = input.request.headers.get(v.slice(8))
|
||||
return headerValue ? [[k, headerValue]] : []
|
||||
}
|
||||
}
|
||||
return [[k, v]]
|
||||
}),
|
||||
)
|
||||
return replacer(providerInfo.payloadModifier ?? {})
|
||||
})(),
|
||||
}),
|
||||
)
|
||||
logger.debug("REQUEST URL: " + reqUrl)
|
||||
logger.debug("REQUEST: " + (requestBody?.preview ?? "") + "...")
|
||||
logger.debug("REQUEST: " + reqBody.substring(0, 300) + "...")
|
||||
const isNewInference =
|
||||
providerInfo.id.startsWith("console.") ||
|
||||
providerInfo.id.startsWith("console-go.") ||
|
||||
providerInfo.id.startsWith("inf.") ||
|
||||
providerInfo.id.startsWith("inf-go.")
|
||||
const res = await fetch(reqUrl, {
|
||||
method: "POST",
|
||||
headers: (() => {
|
||||
const headers = new Headers(input.request.headers)
|
||||
providerInfo.modifyHeaders(headers, providerInfo.apiKey, stickyId)
|
||||
Object.entries(providerInfo.headerModifier ?? {}).forEach(([k, v]) => {
|
||||
if (v === "$ip") return headers.set(k, ip)
|
||||
if (v === "$caller") return headers.set(k, stickyId)
|
||||
if (v === "$session") return headers.set(k, sessionId)
|
||||
if (v === "$model") return headers.set(k, model)
|
||||
if (v === "$request") return headers.set(k, requestId)
|
||||
if (v === "$project") return headers.set(k, projectId)
|
||||
if (v === "$workspace") {
|
||||
if (authInfo?.workspaceID) headers.set(k, authInfo.workspaceID)
|
||||
return
|
||||
}
|
||||
if (v === "$org") {
|
||||
if (authInfo?.workspaceID) headers.set(k, authInfo.workspaceID.replace("wrk_", "org_"))
|
||||
return
|
||||
}
|
||||
headers.set(k, v)
|
||||
})
|
||||
headers.delete("host")
|
||||
headers.delete("content-length")
|
||||
headers.delete("x-opencode-request")
|
||||
if (!isNewInference) headers.delete("x-opencode-session")
|
||||
headers.delete("x-opencode-project")
|
||||
headers.delete("x-opencode-client")
|
||||
return headers
|
||||
})(),
|
||||
body: reqBody,
|
||||
// Propagate caller disconnects to the upstream provider request so
|
||||
// abandoned Console requests do not leave orphaned inference work open.
|
||||
signal: input.request.signal,
|
||||
})
|
||||
const isStream = res.headers.get("content-type")?.toLowerCase().includes("text/event-stream") ?? false
|
||||
logger.metric({ is_stream: isStream })
|
||||
const res = await fetchWithRetryableStatus(
|
||||
reqUrl,
|
||||
{
|
||||
method: "POST",
|
||||
headers: (() => {
|
||||
const headers = new Headers(input.request.headers)
|
||||
providerInfo.modifyHeaders(headers, providerInfo.apiKey, stickyId)
|
||||
Object.entries(providerInfo.headerModifier ?? {}).forEach(([k, v]) => {
|
||||
if (v === "$ip") return headers.set(k, ip)
|
||||
if (v === "$caller") return headers.set(k, stickyId)
|
||||
if (v === "$session") return headers.set(k, sessionId)
|
||||
if (v === "$model") return headers.set(k, model)
|
||||
if (v === "$request") return headers.set(k, requestId)
|
||||
if (v === "$project") return headers.set(k, projectId)
|
||||
if (v === "$workspace") {
|
||||
if (authInfo?.workspaceID) headers.set(k, authInfo.workspaceID)
|
||||
return
|
||||
}
|
||||
if (v === "$org") {
|
||||
if (authInfo?.workspaceID) headers.set(k, authInfo.workspaceID.replace("wrk_", "org_"))
|
||||
return
|
||||
}
|
||||
headers.set(k, v)
|
||||
})
|
||||
headers.delete("host")
|
||||
headers.delete("content-length")
|
||||
headers.delete("x-opencode-request")
|
||||
if (!isNewInference) headers.delete("x-opencode-session")
|
||||
headers.delete("x-opencode-project")
|
||||
headers.delete("x-opencode-client")
|
||||
return headers
|
||||
})(),
|
||||
body: reqBody,
|
||||
// Propagate caller disconnects to the upstream provider request so
|
||||
// abandoned Console requests do not leave orphaned inference work open.
|
||||
signal: input.request.signal,
|
||||
},
|
||||
{ count: isNewInference ? MAX_RETRYABLE_STATUS_RETRIES : 0 },
|
||||
)
|
||||
|
||||
if (isNewInference) {
|
||||
const resEndpointId = res.headers.get("x-opencode-endpoint-id")
|
||||
@@ -265,10 +291,29 @@ export async function handler(
|
||||
})
|
||||
}
|
||||
|
||||
return { providerInfo, res, startTimestamp, isStream }
|
||||
// Try another provider => stop retrying if using fallback provider
|
||||
if (
|
||||
//!isNewInference &&
|
||||
res.status !== 200 &&
|
||||
// ie. 400 error is usually provider error like malformed request
|
||||
res.status !== 400 &&
|
||||
// ie. openai 404 error: Item with id 'msg_0ead8b004a3b165d0069436a6b6834819896da85b63b196a3f' not found.
|
||||
!(modelInfo.id.startsWith("gpt-") && res.status === 404) &&
|
||||
// ie. cannot change codex model providers mid-session
|
||||
modelInfo.stickyProvider !== "strict" &&
|
||||
modelInfo.fallbackProvider &&
|
||||
providerInfo.id !== modelInfo.fallbackProvider
|
||||
) {
|
||||
return retriableRequest({
|
||||
excludeProviders: [...retry.excludeProviders, providerInfo.id],
|
||||
retryCount: retry.retryCount + 1,
|
||||
})
|
||||
}
|
||||
|
||||
return { providerInfo, reqBody, res, startTimestamp }
|
||||
}
|
||||
|
||||
const { providerInfo, res, startTimestamp, isStream } = await providerRequest()
|
||||
const { providerInfo, reqBody, res, startTimestamp } = await retriableRequest()
|
||||
|
||||
// Store sticky provider
|
||||
if (res.status === 200) await stickyTracker?.set(providerInfo.id)
|
||||
@@ -424,8 +469,6 @@ export async function handler(
|
||||
headers: resHeaders,
|
||||
})
|
||||
} catch (error: any) {
|
||||
if (requestBody) void requestBody.cancel().catch(() => {})
|
||||
else void input.request.body?.cancel().catch(() => {})
|
||||
// The caller disconnected before we finished. Because the outbound provider
|
||||
// request shares input.request.signal, an aborted caller surfaces here as an
|
||||
// AbortError. There is no client left to receive a body, so skip the error
|
||||
@@ -550,6 +593,7 @@ export async function handler(
|
||||
modelInfo: ModelInfo,
|
||||
stickyId: string,
|
||||
trialProviders: string[] | undefined,
|
||||
retry: RetryOptions,
|
||||
stickyProviderId: string | undefined,
|
||||
modelTpmLimits: Record<string, number> | undefined,
|
||||
modelTpsLimits: Record<string, { qualify: number; unqualify: number }> | undefined,
|
||||
@@ -576,11 +620,14 @@ export async function handler(
|
||||
}))
|
||||
}
|
||||
|
||||
// Use fallback provider if max retries reached
|
||||
const fallbackProvider = allProviders.find((provider) => provider.id === modelInfo.fallbackProvider)
|
||||
if (retry.retryCount === MAX_FAILOVER_RETRIES) return fallbackProvider
|
||||
|
||||
let topPriority = Infinity
|
||||
const providers = allProviders
|
||||
.filter((provider) => provider.weight !== 0)
|
||||
.filter((provider) => !retry.excludeProviders.includes(provider.id))
|
||||
.filter((provider) => {
|
||||
if (provider.budgetPriority === undefined) return true
|
||||
if (!providerBudget) return true
|
||||
@@ -988,6 +1035,15 @@ export async function handler(
|
||||
providerInfo.apiKey = authInfo.provider.credentials
|
||||
}
|
||||
|
||||
async function fetchWithRetryableStatus(url: string, options: RequestInit, retry = { count: 0 }) {
|
||||
const res = await fetch(url, options)
|
||||
if ([429, 529].includes(res.status) && retry.count < MAX_RETRYABLE_STATUS_RETRIES) {
|
||||
await new Promise((resolve) => setTimeout(resolve, Math.pow(2, retry.count) * 500))
|
||||
return fetchWithRetryableStatus(url, options, { count: retry.count + 1 })
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
function calculateCost(modelInfo: ModelInfo, usageInfo: UsageInfo) {
|
||||
const { inputTokens, outputTokens, reasoningTokens, cacheReadTokens, cacheWrite5mTokens, cacheWrite1hTokens } =
|
||||
usageInfo
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
const TAIL_LIMIT = 4 * 1024
|
||||
const encoder = new TextEncoder()
|
||||
|
||||
export async function prepareRequestBody(body: ReadableStream<Uint8Array>) {
|
||||
const reader = body.getReader()
|
||||
const chunks: Uint8Array[] = []
|
||||
const decoder = new TextDecoder()
|
||||
let text = ""
|
||||
let done = false
|
||||
let searchFrom = 0
|
||||
let bom = 0
|
||||
let match: RegExpExecArray | null = null
|
||||
const pattern = /("model"\s*:\s*")([^"]+)"/g
|
||||
|
||||
while (!done && !match) {
|
||||
const next = await reader.read()
|
||||
done = next.done
|
||||
if (!next.value) continue
|
||||
if (!chunks.length && next.value[0] === 0xef && next.value[1] === 0xbb && next.value[2] === 0xbf) bom = 3
|
||||
chunks.push(next.value)
|
||||
text += decoder.decode(next.value, { stream: true })
|
||||
pattern.lastIndex = searchFrom
|
||||
match = pattern.exec(text)
|
||||
searchFrom = Math.max(0, text.length - 256)
|
||||
}
|
||||
if (done) {
|
||||
text += decoder.decode()
|
||||
if (!match) {
|
||||
pattern.lastIndex = searchFrom
|
||||
match = pattern.exec(text)
|
||||
}
|
||||
}
|
||||
|
||||
const found = (() => {
|
||||
if (!match) return
|
||||
const start = bom + utf8Length(text, match.index + match[1].length)
|
||||
return { model: match[2], start, end: start + utf8Length(match[2], match[2].length) }
|
||||
})()
|
||||
const preview = text.substring(0, 300)
|
||||
text = ""
|
||||
match = null
|
||||
let used = false
|
||||
|
||||
return {
|
||||
model: found?.model ?? "",
|
||||
preview,
|
||||
cancel: () => reader.cancel(),
|
||||
stream(providerModel: string, includeUsage: boolean) {
|
||||
if (used) throw new Error("Request body stream already consumed")
|
||||
if (!found) throw new Error("Missing model field")
|
||||
used = true
|
||||
|
||||
const initial = replace(chunks, found.start, found.end, providerModel)
|
||||
chunks.length = 0
|
||||
const output = passthrough(initial, reader, done)
|
||||
if (!includeUsage) return output
|
||||
return appendUsage(output)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
function utf8Length(value: string, end: number) {
|
||||
let length = 0
|
||||
for (let i = 0; i < end; i++) {
|
||||
const code = value.charCodeAt(i)
|
||||
if (code <= 0x7f) length++
|
||||
else if (code <= 0x7ff) length += 2
|
||||
else if (code >= 0xd800 && code <= 0xdbff && i + 1 < end && value.charCodeAt(i + 1) >= 0xdc00) {
|
||||
length += 4
|
||||
i++
|
||||
} else length += 3
|
||||
}
|
||||
return length
|
||||
}
|
||||
|
||||
function replace(chunks: Uint8Array[], start: number, end: number, value: string) {
|
||||
let offset = 0
|
||||
let inserted = false
|
||||
return chunks.flatMap((chunk) => {
|
||||
const chunkStart = offset
|
||||
const chunkEnd = offset + chunk.length
|
||||
offset = chunkEnd
|
||||
if (chunkEnd <= start || chunkStart >= end) return [chunk]
|
||||
|
||||
const parts = [chunk.subarray(0, Math.max(0, start - chunkStart))]
|
||||
if (!inserted) {
|
||||
parts.push(encoder.encode(value))
|
||||
inserted = true
|
||||
}
|
||||
parts.push(chunk.subarray(Math.min(chunk.length, end - chunkStart)))
|
||||
return parts.filter((part) => part.length)
|
||||
})
|
||||
}
|
||||
|
||||
function passthrough(
|
||||
initial: Array<Uint8Array | undefined>,
|
||||
reader: ReadableStreamDefaultReader<Uint8Array>,
|
||||
sourceDone: boolean,
|
||||
) {
|
||||
let done = sourceDone
|
||||
let index = 0
|
||||
return new ReadableStream<Uint8Array>({
|
||||
async pull(controller) {
|
||||
const chunk = initial[index]
|
||||
if (chunk) {
|
||||
initial[index++] = undefined
|
||||
controller.enqueue(chunk)
|
||||
return
|
||||
}
|
||||
initial.length = 0
|
||||
if (done) {
|
||||
controller.close()
|
||||
return
|
||||
}
|
||||
const next = await reader.read()
|
||||
done = next.done
|
||||
if (next.value) controller.enqueue(next.value)
|
||||
if (done) controller.close()
|
||||
},
|
||||
cancel(reason) {
|
||||
initial.length = 0
|
||||
return reader.cancel(reason)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function appendUsage(body: ReadableStream<Uint8Array>) {
|
||||
const reader = body.getReader()
|
||||
const decoder = new TextDecoder()
|
||||
let tail = new Uint8Array()
|
||||
let streamText = ""
|
||||
let isStream = false
|
||||
const inspect = (chunk?: Uint8Array) => {
|
||||
streamText += chunk ? decoder.decode(chunk, { stream: true }) : decoder.decode()
|
||||
for (const match of streamText.matchAll(/"stream"\s*:\s*(true|false)/g)) isStream = match[1] === "true"
|
||||
streamText = streamText.slice(-64)
|
||||
}
|
||||
return new ReadableStream<Uint8Array>({
|
||||
async pull(controller) {
|
||||
while (true) {
|
||||
const next = await reader.read()
|
||||
if (next.done) {
|
||||
inspect()
|
||||
if (!isStream) {
|
||||
if (tail.length) controller.enqueue(tail)
|
||||
controller.close()
|
||||
return
|
||||
}
|
||||
const close = tail.lastIndexOf(125)
|
||||
if (close < 0) {
|
||||
controller.error(new Error("Invalid JSON request body"))
|
||||
return
|
||||
}
|
||||
if (close) controller.enqueue(tail.subarray(0, close))
|
||||
controller.enqueue(encoder.encode(',"stream_options":{"include_usage":true}}'))
|
||||
if (close + 1 < tail.length) controller.enqueue(tail.subarray(close + 1))
|
||||
controller.close()
|
||||
return
|
||||
}
|
||||
|
||||
const chunk = next.value
|
||||
inspect(chunk)
|
||||
if (tail.length + chunk.length <= TAIL_LIMIT) {
|
||||
const combined = new Uint8Array(tail.length + chunk.length)
|
||||
combined.set(tail)
|
||||
combined.set(chunk, tail.length)
|
||||
tail = combined
|
||||
continue
|
||||
}
|
||||
|
||||
const emit = tail.length + chunk.length - TAIL_LIMIT
|
||||
if (emit <= tail.length) {
|
||||
controller.enqueue(tail.subarray(0, emit))
|
||||
const combined = new Uint8Array(TAIL_LIMIT)
|
||||
combined.set(tail.subarray(emit))
|
||||
combined.set(chunk, tail.length - emit)
|
||||
tail = combined
|
||||
return
|
||||
}
|
||||
|
||||
if (tail.length) controller.enqueue(tail)
|
||||
controller.enqueue(chunk.subarray(0, emit - tail.length))
|
||||
tail = chunk.slice(emit - tail.length)
|
||||
return
|
||||
}
|
||||
},
|
||||
cancel(reason) {
|
||||
return reader.cancel(reason)
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import { prepareRequestBody } from "../src/routes/zen/util/requestBody"
|
||||
|
||||
describe("Zen request body streaming", () => {
|
||||
test("patches the leading model without buffering the remaining body", async () => {
|
||||
let reads = 0
|
||||
const body = new ReadableStream<Uint8Array>(
|
||||
{
|
||||
pull(controller) {
|
||||
const chunks = [
|
||||
'{"model":"client-model","stream":true,"messages":[',
|
||||
JSON.stringify({ role: "user", content: "large payload" }),
|
||||
"]}",
|
||||
]
|
||||
const chunk = chunks[reads++]
|
||||
if (chunk) controller.enqueue(new TextEncoder().encode(chunk))
|
||||
else controller.close()
|
||||
},
|
||||
},
|
||||
{ highWaterMark: 0 },
|
||||
)
|
||||
|
||||
const request = await prepareRequestBody(body)
|
||||
expect(request.model).toBe("client-model")
|
||||
expect(reads).toBe(1)
|
||||
|
||||
const output = await new Response(request.stream("provider-model", false)).text()
|
||||
expect(JSON.parse(output)).toEqual({
|
||||
model: "provider-model",
|
||||
stream: true,
|
||||
messages: [{ role: "user", content: "large payload" }],
|
||||
})
|
||||
})
|
||||
|
||||
test("appends stream usage options at the end of the request", async () => {
|
||||
const body = new Blob(['{"model":"client-model","stream":true,"messages":[]} ']).stream()
|
||||
const request = await prepareRequestBody(body)
|
||||
const output = await new Response(request.stream("provider-model", true)).text()
|
||||
|
||||
expect(JSON.parse(output)).toEqual({
|
||||
model: "provider-model",
|
||||
stream: true,
|
||||
messages: [],
|
||||
stream_options: { include_usage: true },
|
||||
})
|
||||
expect(output.endsWith(" ")).toBe(true)
|
||||
})
|
||||
|
||||
test("detects streaming after a large message while forwarding", async () => {
|
||||
const content = "x".repeat(128 * 1024)
|
||||
let reads = 0
|
||||
const chunks = [
|
||||
'{"model":"client-model","messages":[',
|
||||
JSON.stringify({ role: "user", content }),
|
||||
'],"stream":true}',
|
||||
]
|
||||
const body = new ReadableStream<Uint8Array>(
|
||||
{
|
||||
pull(controller) {
|
||||
const chunk = chunks[reads++]
|
||||
if (chunk) controller.enqueue(new TextEncoder().encode(chunk))
|
||||
else controller.close()
|
||||
},
|
||||
},
|
||||
{ highWaterMark: 0 },
|
||||
)
|
||||
const request = await prepareRequestBody(body)
|
||||
expect(reads).toBe(1)
|
||||
const output = await new Response(request.stream("provider-model", true)).text()
|
||||
|
||||
expect(JSON.parse(output)).toEqual({
|
||||
model: "provider-model",
|
||||
messages: [{ role: "user", content }],
|
||||
stream: true,
|
||||
stream_options: { include_usage: true },
|
||||
})
|
||||
})
|
||||
|
||||
test("buffers through a late model field and then streams the rest", async () => {
|
||||
const content = "こんにちは".repeat(32 * 1024)
|
||||
let reads = 0
|
||||
const chunks = [
|
||||
'{"messages":[',
|
||||
JSON.stringify({ role: "user", content }),
|
||||
'],"model":"client-model","stream":true,"extra":"after-model"}',
|
||||
]
|
||||
const body = new ReadableStream<Uint8Array>(
|
||||
{
|
||||
pull(controller) {
|
||||
const chunk = chunks[reads++]
|
||||
if (chunk) controller.enqueue(new TextEncoder().encode(chunk))
|
||||
else controller.close()
|
||||
},
|
||||
},
|
||||
{ highWaterMark: 0 },
|
||||
)
|
||||
const request = await prepareRequestBody(body)
|
||||
|
||||
expect(request.model).toBe("client-model")
|
||||
expect(reads).toBe(3)
|
||||
expect(JSON.parse(await new Response(request.stream("provider-model", true)).text())).toEqual({
|
||||
messages: [{ role: "user", content }],
|
||||
model: "provider-model",
|
||||
stream: true,
|
||||
extra: "after-model",
|
||||
stream_options: { include_usage: true },
|
||||
})
|
||||
})
|
||||
|
||||
test("preserves a UTF-8 BOM while patching the model", async () => {
|
||||
const body = new Blob(['\uFEFF{"messages":[],"model":"client-model","stream":false}']).stream()
|
||||
const request = await prepareRequestBody(body)
|
||||
const output = new Uint8Array(await new Response(request.stream("provider-model", false)).arrayBuffer())
|
||||
|
||||
expect([...output.subarray(0, 3)]).toEqual([0xef, 0xbb, 0xbf])
|
||||
expect(JSON.parse(new TextDecoder().decode(output))).toEqual({
|
||||
messages: [],
|
||||
model: "provider-model",
|
||||
stream: false,
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -97,18 +97,6 @@ export namespace Workspace {
|
||||
},
|
||||
)
|
||||
|
||||
export const unblock = fn(
|
||||
z.object({
|
||||
workspaceID: Identifier.schema("workspace"),
|
||||
}),
|
||||
async (input) => {
|
||||
const result = await Database.use((tx) =>
|
||||
tx.update(WorkspaceTable).set({ is_blocked: false }).where(eq(WorkspaceTable.id, input.workspaceID)),
|
||||
)
|
||||
if (result.rowsAffected === 0) throw new Error("Workspace not found")
|
||||
},
|
||||
)
|
||||
|
||||
export const remove = fn(z.void(), async () => {
|
||||
await Database.use((tx) =>
|
||||
tx
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/alibaba": "1.0.17",
|
||||
"@ai-sdk/amazon-bedrock": "4.0.158",
|
||||
"@ai-sdk/amazon-bedrock": "4.0.112",
|
||||
"@ai-sdk/anthropic": "3.0.82",
|
||||
"@ai-sdk/azure": "3.0.88",
|
||||
"@ai-sdk/cerebras": "2.0.41",
|
||||
|
||||
@@ -45,18 +45,9 @@ function oauth(http: HttpClient.HttpClient) {
|
||||
authorize: () =>
|
||||
Effect.gen(function* () {
|
||||
const device = yield* post(http, `${defaultServer}/auth/device/code`, { client_id: clientID }, Device)
|
||||
const verification = yield* Effect.try({
|
||||
try: () => {
|
||||
const url = new URL(device.verification_uri_complete, `${defaultServer}/`)
|
||||
if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error("expected HTTP(S)")
|
||||
return url
|
||||
},
|
||||
catch: (cause) =>
|
||||
new Error(`Invalid device verification URL: ${cause instanceof Error ? cause.message : String(cause)}`),
|
||||
})
|
||||
return {
|
||||
mode: "auto" as const,
|
||||
url: verification.href,
|
||||
url: `${defaultServer}${device.verification_uri_complete}`,
|
||||
instructions: `Enter code: ${device.user_code}`,
|
||||
callback: poll(http, defaultServer, device.device_code, Duration.seconds(device.interval)),
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { describe, expect } from "bun:test"
|
||||
import { Effect } from "effect"
|
||||
import { HttpClient, HttpClientResponse } from "effect/unstable/http"
|
||||
import { Catalog } from "@opencode-ai/core/catalog"
|
||||
import { Credential } from "@opencode-ai/core/credential"
|
||||
import { EventV2 } from "@opencode-ai/core/event"
|
||||
@@ -15,16 +14,14 @@ import { PluginTestLayer } from "./fixture"
|
||||
|
||||
const it = testEffect(PluginTestLayer)
|
||||
|
||||
const addPlugin = Effect.fn(function* (http?: HttpClient.HttpClient) {
|
||||
const addPlugin = Effect.fn(function* () {
|
||||
const plugin = yield* PluginV2.Service
|
||||
const host = yield* PluginHost.make(plugin)
|
||||
const events = yield* EventV2.Service
|
||||
const integration = yield* Integration.Service
|
||||
const client = yield* HttpClient.HttpClient
|
||||
yield* OpencodePlugin.effect(host).pipe(
|
||||
Effect.provideService(EventV2.Service, events),
|
||||
Effect.provideService(Integration.Service, integration),
|
||||
Effect.provideService(HttpClient.HttpClient, http ?? client),
|
||||
)
|
||||
})
|
||||
|
||||
@@ -85,63 +82,6 @@ describe("OpencodePlugin", () => {
|
||||
}),
|
||||
)
|
||||
|
||||
it.effect("resolves origin-rooted device verification URLs", () =>
|
||||
Effect.gen(function* () {
|
||||
const http = HttpClient.make((request) =>
|
||||
Effect.succeed(
|
||||
HttpClientResponse.fromWeb(
|
||||
request,
|
||||
Response.json({
|
||||
device_code: "device",
|
||||
user_code: "user",
|
||||
verification_uri_complete: "/console/device?user_code=user&client_id=opencode-cli",
|
||||
expires_in: 60,
|
||||
interval: 60,
|
||||
}),
|
||||
),
|
||||
),
|
||||
)
|
||||
yield* addPlugin(http)
|
||||
const integration = yield* Integration.Service
|
||||
const attempt = yield* integration.connection.oauth({
|
||||
integrationID: Integration.ID.make("opencode"),
|
||||
methodID: Integration.MethodID.make("device"),
|
||||
inputs: {},
|
||||
})
|
||||
expect(attempt.url).toBe("https://opencode.ai/console/device?user_code=user&client_id=opencode-cli")
|
||||
}),
|
||||
)
|
||||
|
||||
it.effect("rejects malformed device verification URLs", () =>
|
||||
Effect.gen(function* () {
|
||||
const http = HttpClient.make((request) =>
|
||||
Effect.succeed(
|
||||
HttpClientResponse.fromWeb(
|
||||
request,
|
||||
Response.json({
|
||||
device_code: "device",
|
||||
user_code: "user",
|
||||
verification_uri_complete: "http://[::1",
|
||||
expires_in: 60,
|
||||
interval: 60,
|
||||
}),
|
||||
),
|
||||
),
|
||||
)
|
||||
yield* addPlugin(http)
|
||||
const integration = yield* Integration.Service
|
||||
const error = yield* integration.connection
|
||||
.oauth({
|
||||
integrationID: Integration.ID.make("opencode"),
|
||||
methodID: Integration.MethodID.make("device"),
|
||||
inputs: {},
|
||||
})
|
||||
.pipe(Effect.flip)
|
||||
expect(error).toBeInstanceOf(Integration.AuthorizationError)
|
||||
expect(String(error.cause)).toContain("Invalid device verification URL")
|
||||
}),
|
||||
)
|
||||
|
||||
it.live("loads providers and models from the connected OpenCode server", () =>
|
||||
Effect.acquireUseRelease(
|
||||
Effect.sync(() => {
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
"@actions/github": "6.0.1",
|
||||
"@agentclientprotocol/sdk": "0.21.0",
|
||||
"@ai-sdk/alibaba": "1.0.17",
|
||||
"@ai-sdk/amazon-bedrock": "4.0.158",
|
||||
"@ai-sdk/amazon-bedrock": "4.0.112",
|
||||
"@ai-sdk/anthropic": "3.0.82",
|
||||
"@ai-sdk/azure": "3.0.88",
|
||||
"@ai-sdk/cerebras": "2.0.60",
|
||||
|
||||
@@ -396,18 +396,10 @@ const layer: Layer.Layer<Service, never, AccountRepo.Service | HttpClient.HttpCl
|
||||
const parsed = yield* HttpClientResponse.schemaBodyJson(DeviceAuth)(response).pipe(
|
||||
mapAccountServiceError("Failed to decode response"),
|
||||
)
|
||||
const verification = yield* Effect.try({
|
||||
try: () => {
|
||||
const url = new URL(parsed.verification_uri_complete, `${normalizedServer}/`)
|
||||
if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error("expected HTTP(S)")
|
||||
return url.href
|
||||
},
|
||||
catch: (cause) => new AccountServiceError({ message: "Invalid device verification URL", cause }),
|
||||
})
|
||||
return new Login({
|
||||
code: parsed.device_code,
|
||||
user: parsed.user_code,
|
||||
url: verification,
|
||||
url: `${normalizedServer}${parsed.verification_uri_complete}`,
|
||||
server: normalizedServer,
|
||||
expiry: parsed.expires_in,
|
||||
interval: parsed.interval,
|
||||
|
||||
@@ -1303,13 +1303,13 @@ export function options(input: {
|
||||
}
|
||||
}
|
||||
|
||||
// Generic OpenAI-compatible APIs do not necessarily support OpenAI's verbosity parameter.
|
||||
// Only enable the default for integrations known to implement it.
|
||||
// Only set textVerbosity for non-chat gpt-5.x models
|
||||
// Chat models (e.g. gpt-5.2-chat-latest) only support "medium" verbosity
|
||||
if (
|
||||
input.model.api.id.includes("gpt-5.") &&
|
||||
!input.model.api.id.includes("codex") &&
|
||||
!input.model.api.id.includes("-chat") &&
|
||||
(input.model.api.npm === "@ai-sdk/openai" || input.model.api.npm === "@ai-sdk/amazon-bedrock/mantle")
|
||||
input.model.providerID !== "azure"
|
||||
) {
|
||||
result["textVerbosity"] = "low"
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import { Account } from "../../src/account/account"
|
||||
import {
|
||||
AccessToken,
|
||||
AccountID,
|
||||
AccountServiceError,
|
||||
AccountTransportError,
|
||||
DeviceCode,
|
||||
Login,
|
||||
@@ -72,18 +71,18 @@ const deviceTokenClient = (body: unknown, status = 400) =>
|
||||
const poll = (body: unknown, status = 400) =>
|
||||
Account.Service.use((s) => s.poll(login())).pipe(Effect.provide(live(deviceTokenClient(body, status))))
|
||||
|
||||
it.live("login resolves origin-rooted verification URLs from servers with base paths", () =>
|
||||
it.live("login normalizes trailing slashes in the provided server URL", () =>
|
||||
Effect.gen(function* () {
|
||||
const seen: Array<string> = []
|
||||
const client = HttpClient.make((req) =>
|
||||
Effect.gen(function* () {
|
||||
seen.push(`${req.method} ${req.url}`)
|
||||
|
||||
if (req.url === "https://one.example.com/console/auth/device/code") {
|
||||
if (req.url === "https://one.example.com/auth/device/code") {
|
||||
return json(req, {
|
||||
device_code: "device-code",
|
||||
user_code: "user-code",
|
||||
verification_uri_complete: "/console/device?user_code=user-code",
|
||||
verification_uri_complete: "/device?user_code=user-code",
|
||||
expires_in: 600,
|
||||
interval: 5,
|
||||
})
|
||||
@@ -93,31 +92,11 @@ it.live("login resolves origin-rooted verification URLs from servers with base p
|
||||
}),
|
||||
)
|
||||
|
||||
const result = yield* Account.use.login("https://one.example.com/console/").pipe(Effect.provide(live(client)))
|
||||
const result = yield* Account.use.login("https://one.example.com/").pipe(Effect.provide(live(client)))
|
||||
|
||||
expect(seen).toEqual(["POST https://one.example.com/console/auth/device/code"])
|
||||
expect(result.server).toBe("https://one.example.com/console")
|
||||
expect(result.url).toBe("https://one.example.com/console/device?user_code=user-code")
|
||||
}),
|
||||
)
|
||||
|
||||
it.live("login rejects malformed device verification URLs", () =>
|
||||
Effect.gen(function* () {
|
||||
const client = HttpClient.make((req) =>
|
||||
Effect.succeed(
|
||||
json(req, {
|
||||
device_code: "device-code",
|
||||
user_code: "user-code",
|
||||
verification_uri_complete: "http://[::1",
|
||||
expires_in: 600,
|
||||
interval: 5,
|
||||
}),
|
||||
),
|
||||
)
|
||||
|
||||
const error = yield* Effect.flip(Account.use.login("https://one.example.com").pipe(Effect.provide(live(client))))
|
||||
expect(error).toBeInstanceOf(AccountServiceError)
|
||||
if (error instanceof AccountServiceError) expect(error.message).toBe("Invalid device verification URL")
|
||||
expect(seen).toEqual(["POST https://one.example.com/auth/device/code"])
|
||||
expect(result.server).toBe("https://one.example.com")
|
||||
expect(result.url).toBe("https://one.example.com/device?user_code=user-code")
|
||||
}),
|
||||
)
|
||||
|
||||
|
||||
@@ -82,10 +82,10 @@ describe("opencode run (non-interactive subprocess)", () => {
|
||||
)
|
||||
|
||||
// The test provider's SSE error item is interpreted by the SDK as an unknown
|
||||
// finish, not a fatal provider/session error. Unknown finishes should continue
|
||||
// the prompt loop so a subsequent response can complete the run.
|
||||
// finish, not a fatal provider/session error. Lock that distinction in so it
|
||||
// is not accidentally used as the failure compatibility oracle.
|
||||
cliIt.concurrent(
|
||||
"unknown stream finish preserves partial output and continues",
|
||||
"unknown stream finish preserves partial output and exits 0",
|
||||
({ llm, opencode }) =>
|
||||
Effect.gen(function* () {
|
||||
yield* llm.push(
|
||||
@@ -95,10 +95,9 @@ describe("opencode run (non-interactive subprocess)", () => {
|
||||
}),
|
||||
)
|
||||
yield* llm.fail("upstream provider exploded mid-stream")
|
||||
yield* llm.text("recovered")
|
||||
const result = yield* opencode.run("trigger midstream error", { timeoutMs: 30_000 })
|
||||
expect(result.exitCode).toBe(0)
|
||||
expect(result.stdout).toBe("partial response\nrecovered\n")
|
||||
expect(result.stdout).toBe("partial response\n")
|
||||
expect(result.stderr).not.toContain("upstream provider exploded mid-stream")
|
||||
}),
|
||||
60_000,
|
||||
@@ -214,7 +213,7 @@ describe("opencode run (non-interactive subprocess)", () => {
|
||||
)
|
||||
|
||||
cliIt.concurrent(
|
||||
"--format json records an unknown stream finish and continuation",
|
||||
"--format json records partial output for an unknown stream finish",
|
||||
({ llm, opencode }) =>
|
||||
Effect.gen(function* () {
|
||||
yield* llm.push(
|
||||
@@ -224,7 +223,6 @@ describe("opencode run (non-interactive subprocess)", () => {
|
||||
}),
|
||||
)
|
||||
yield* llm.fail("provider failed")
|
||||
yield* llm.text("recovered")
|
||||
const result = yield* opencode.run("fail after output", { format: "json" })
|
||||
|
||||
const events = opencode.parseJsonEvents(result.stdout)
|
||||
@@ -236,14 +234,9 @@ describe("opencode run (non-interactive subprocess)", () => {
|
||||
"step_finish",
|
||||
"step_start",
|
||||
"step_finish",
|
||||
"step_start",
|
||||
"text",
|
||||
"step_finish",
|
||||
])
|
||||
expect(events[1]?.part).toEqual(expect.objectContaining({ type: "text", text: "partial json" }))
|
||||
expect(events[5]?.part).toEqual(expect.objectContaining({ type: "step-finish", reason: "unknown" }))
|
||||
expect(events[7]?.part).toEqual(expect.objectContaining({ type: "text", text: "recovered" }))
|
||||
expect(events.at(-1)?.part).toEqual(expect.objectContaining({ type: "step-finish", reason: "stop" }))
|
||||
expect(events.at(-1)?.part).toEqual(expect.objectContaining({ type: "step-finish", reason: "unknown" }))
|
||||
}),
|
||||
60_000,
|
||||
)
|
||||
|
||||
@@ -523,7 +523,6 @@ describe("ProviderTransform.options - gpt-5 textVerbosity", () => {
|
||||
expect(result.reasoningEffort).toBe("medium")
|
||||
expect(result.reasoningSummary).toBeUndefined()
|
||||
expect(result.include).toBeUndefined()
|
||||
expect(result.textVerbosity).toBeUndefined()
|
||||
})
|
||||
|
||||
test("azure chat completions omit Responses-only reasoning options after variants merge", async () => {
|
||||
|
||||
@@ -812,8 +812,7 @@ function ModelTrendSection(props: {
|
||||
<div data-slot="tooltip-divider" />
|
||||
<p>
|
||||
<span data-slot="tooltip-label">
|
||||
<i data-kind={props.lineTone === "active" ? "users" : "tokens"} />
|
||||
<span data-slot="tooltip-name">{props.rowLabel}</span>
|
||||
<i data-kind={props.lineTone === "active" ? "users" : "tokens"} /> {props.rowLabel}
|
||||
</span>
|
||||
<b>{props.formatValue(props.value(active.point))}</b>
|
||||
</p>
|
||||
|
||||
@@ -473,15 +473,13 @@ function LabUsageSection(props: { lab: ModelCatalogLab; data: StatsLabData | nul
|
||||
<div data-slot="tooltip-divider" />
|
||||
<p>
|
||||
<span data-slot="tooltip-label">
|
||||
<i data-kind="tokens" />
|
||||
<span data-slot="tooltip-name">{i18n.t("lab.dailyTokens")}</span>
|
||||
<i data-kind="tokens" /> {i18n.t("lab.dailyTokens")}
|
||||
</span>
|
||||
<b>{formatTokens(active.point.tokens)}</b>
|
||||
</p>
|
||||
<p>
|
||||
<span data-slot="tooltip-label">
|
||||
<i data-kind="users" />
|
||||
<span data-slot="tooltip-name">{i18n.t("model.uniqueUsers")}</span>
|
||||
<i data-kind="users" /> {i18n.t("model.uniqueUsers")}
|
||||
</span>
|
||||
<b>{formatUsers(active.point.users)}</b>
|
||||
</p>
|
||||
|
||||
@@ -1590,13 +1590,6 @@ body {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
[data-page="stats"] [data-component="chart-tooltip"] [data-slot="tooltip-name"] {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
[data-page="stats"] [data-component="chart-tooltip"] [data-slot="tooltip-divider"] {
|
||||
height: 1px;
|
||||
margin: 4px -16px 2px;
|
||||
@@ -1684,7 +1677,7 @@ body {
|
||||
|
||||
[data-page="stats"] :is([data-section="top-models"], [data-section="unique-users"]) [data-component="chart-tooltip"] p {
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: 1ch;
|
||||
gap: 4px;
|
||||
height: 16px;
|
||||
margin: 4px 0 0;
|
||||
padding: 0 8px;
|
||||
@@ -4730,7 +4723,7 @@ body {
|
||||
|
||||
[data-page="stats"] [data-component="model-usage-chart"] [data-component="chart-tooltip"] p {
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: 1ch;
|
||||
gap: 4px;
|
||||
height: 20px;
|
||||
margin: 8px 0;
|
||||
padding: 0 8px;
|
||||
|
||||
@@ -568,8 +568,8 @@ function TopModelsChart(props: {
|
||||
style={{
|
||||
background: getRankColor(item.segment.model, item.index, segmentOrder(), usageColors),
|
||||
}}
|
||||
/>
|
||||
<span data-slot="tooltip-name">{item.segment.model}</span>
|
||||
/>{" "}
|
||||
{item.segment.model}
|
||||
</span>
|
||||
<b>{formatUsageChartValue(item.segment.value, metric())}</b>
|
||||
</p>
|
||||
|
||||
@@ -4,7 +4,6 @@ import { modelAuthor, normalizeInferenceModel, statModel, statProvider } from ".
|
||||
|
||||
describe("inference stat normalization", () => {
|
||||
test("normalizes model suffixes used by router/provider variants", () => {
|
||||
expect(normalizeInferenceModel("GPT-5-Free")).toBe("gpt-5")
|
||||
expect(normalizeInferenceModel("deepseek-v4-flash-free")).toBe("deepseek-v4-flash")
|
||||
expect(normalizeInferenceModel("deepseek-v4-flash:global")).toBe("deepseek-v4-flash")
|
||||
expect(normalizeInferenceModel("mimo-v2.5-free")).toBe("mimo-v2.5")
|
||||
|
||||
@@ -23,7 +23,7 @@ export const RETIRED_STAT_MODELS = ["big-pickle", ...Object.keys(MODEL_NAME_ALIA
|
||||
export const RETIRED_STAT_PROVIDERS = ["opencode"]
|
||||
|
||||
export function normalizeInferenceModel(value: string | undefined) {
|
||||
return (value || "unknown").toLowerCase().replace(/(-free|:free|:global)+$/, "") || "unknown"
|
||||
return (value || "unknown").replace(/(-free|:free|:global)+$/, "") || "unknown"
|
||||
}
|
||||
|
||||
export function modelAuthor(value: string | undefined) {
|
||||
|
||||
@@ -188,8 +188,8 @@ https://opencode.ai/zen/v1/models
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -214,8 +214,6 @@ https://opencode.ai/zen/v1/models
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** تشمل الأسعار المعروضة خصمًا بنسبة 50% حتى 18 سبتمبر 2026.
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** ساعات Peak هي 01:00-04:00 و06:00-10:00 UTC؛ وجميع الساعات الأخرى Off-Peak. [اعرف المزيد](https://api-docs.deepseek.com/quick_start/pricing/).
|
||||
|
||||
قد تلاحظ [نماذج منخفضة التكلفة](/docs/config/#models)، مثل Haiku أو Nano أو Flash، في سجل الاستخدام. يستخدم OpenCode هذه النماذج لإنشاء عناوين الجلسات.
|
||||
|
||||
@@ -195,8 +195,8 @@ Podržavamo pay-as-you-go model. Ispod su cijene **po 1M tokena**.
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -221,8 +221,6 @@ Podržavamo pay-as-you-go model. Ispod su cijene **po 1M tokena**.
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** Prikazane cijene uključuju popust od 50% do 18. septembra 2026.
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Peak sati su 01:00-04:00 i 06:00-10:00 UTC; svi ostali sati su Off-Peak. [Saznajte više](https://api-docs.deepseek.com/quick_start/pricing/).
|
||||
|
||||
U historiji korištenja možete primijetiti [jeftinije modele](/docs/config/#models), kao što su Haiku, Nano ili Flash. OpenCode koristi ove modele za generisanje naslova sesija.
|
||||
|
||||
@@ -195,8 +195,8 @@ Vi understøtter en pay-as-you-go-model. Nedenfor er priserne **pr. 1M tokens**.
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -221,8 +221,6 @@ Vi understøtter en pay-as-you-go-model. Nedenfor er priserne **pr. 1M tokens**.
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** De viste priser inkluderer 50 % rabat til og med den 18. september 2026.
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Peak-tiderne er 01:00-04:00 og 06:00-10:00 UTC; alle andre tider er Off-Peak. [Læs mere](https://api-docs.deepseek.com/quick_start/pricing/).
|
||||
|
||||
Du vil måske bemærke [lavprismodeller](/docs/config/#models), såsom Haiku, Nano eller Flash, i din brugshistorik. OpenCode bruger disse modeller til at generere sessionstitler.
|
||||
|
||||
@@ -184,8 +184,8 @@ Wir unterstützen ein Pay-as-you-go-Modell. Unten findest du die Preise **pro 1M
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -210,8 +210,6 @@ Wir unterstützen ein Pay-as-you-go-Modell. Unten findest du die Preise **pro 1M
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** Die angezeigten Preise enthalten bis zum 18. September 2026 einen Rabatt von 50 %.
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Die Peak-Zeiten sind 01:00-04:00 und 06:00-10:00 UTC; alle anderen Zeiten sind Off-Peak. [Mehr erfahren](https://api-docs.deepseek.com/quick_start/pricing/).
|
||||
|
||||
Möglicherweise siehst du [kostengünstige Modelle](/docs/config/#models) wie Haiku, Nano oder Flash in deinem Nutzungsverlauf. OpenCode verwendet diese Modelle, um Session-Titel zu generieren.
|
||||
|
||||
@@ -195,8 +195,8 @@ Admitimos un modelo de pago por uso. A continuación se muestran los precios **p
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -221,8 +221,6 @@ Admitimos un modelo de pago por uso. A continuación se muestran los precios **p
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** Los precios mostrados incluyen un 50 % de descuento hasta el 18 de septiembre de 2026.
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Las horas Peak son 01:00-04:00 y 06:00-10:00 UTC; todas las demás horas son Off-Peak. [Más información](https://api-docs.deepseek.com/quick_start/pricing/).
|
||||
|
||||
Puede que notes [modelos de bajo costo](/docs/config/#models), como Haiku, Nano o Flash, en tu historial de uso. OpenCode usa estos modelos para generar títulos de sesiones.
|
||||
|
||||
@@ -184,8 +184,8 @@ Nous prenons en charge un modèle de paiement à l'utilisation. Vous trouverez c
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -210,8 +210,6 @@ Nous prenons en charge un modèle de paiement à l'utilisation. Vous trouverez c
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** Les prix affichés incluent une réduction de 50 % jusqu’au 18 septembre 2026.
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Les heures Peak sont 01:00-04:00 et 06:00-10:00 UTC ; toutes les autres heures sont Off-Peak. [En savoir plus](https://api-docs.deepseek.com/quick_start/pricing/).
|
||||
|
||||
Vous remarquerez peut-être des [modèles à faible coût](/docs/config/#models), tels que Haiku, Nano ou Flash, dans votre historique d'utilisation. OpenCode utilise ces modèles pour générer les titres des sessions.
|
||||
|
||||
@@ -195,8 +195,8 @@ Supportiamo un modello pay-as-you-go. Qui sotto trovi i prezzi **per 1M token**.
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -221,8 +221,6 @@ Supportiamo un modello pay-as-you-go. Qui sotto trovi i prezzi **per 1M token**.
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** I prezzi mostrati includono uno sconto del 50% fino al 18 septembre 2026.
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Gli orari Peak sono 01:00-04:00 e 06:00-10:00 UTC; tutti gli altri orari sono Off-Peak. [Scopri di più](https://api-docs.deepseek.com/quick_start/pricing/).
|
||||
|
||||
Potresti notare [modelli a basso costo](/docs/config/#models), come Haiku, Nano o Flash, nella cronologia di utilizzo. OpenCode usa questi modelli per generare i titoli delle sessioni.
|
||||
|
||||
@@ -184,8 +184,8 @@ https://opencode.ai/zen/v1/models
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -210,8 +210,6 @@ https://opencode.ai/zen/v1/models
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** 表示価格には、2026年9月18日まで50%の割引が適用されています。
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Peak時間は01:00-04:00と06:00-10:00 UTCで、それ以外の時間はすべてOff-Peakです。[詳しく見る](https://api-docs.deepseek.com/quick_start/pricing/)。
|
||||
|
||||
使用履歴に Haiku、Nano、Flash などの[低コストモデル](/docs/config/#models)が表示されることがあります。OpenCode はこれらのモデルをセッションタイトルの生成に使用します。
|
||||
|
||||
@@ -184,8 +184,8 @@ https://opencode.ai/zen/v1/models
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -210,8 +210,6 @@ https://opencode.ai/zen/v1/models
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** 표시된 가격에는 2026년 9월 18일까지 50% 할인이 적용됩니다.
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Peak 시간은 01:00-04:00 및 06:00-10:00 UTC이며, 그 외 모든 시간은 Off-Peak입니다. [자세히 알아보기](https://api-docs.deepseek.com/quick_start/pricing/).
|
||||
|
||||
사용 기록에서 Haiku, Nano 또는 Flash와 같은 [저비용 모델](/docs/config/#models)을 볼 수 있습니다. OpenCode는 이러한 모델을 사용해 세션 제목을 생성합니다.
|
||||
|
||||
@@ -195,8 +195,8 @@ Vi støtter en pay-as-you-go-modell. Nedenfor er prisene **per 1M tokens**.
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -221,8 +221,6 @@ Vi støtter en pay-as-you-go-modell. Nedenfor er prisene **per 1M tokens**.
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** Prisene som vises inkluderer 50 % rabatt til og med 18. september 2026.
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Peak-tidene er 01:00-04:00 og 06:00-10:00 UTC; alle andre tider er Off-Peak. [Les mer](https://api-docs.deepseek.com/quick_start/pricing/).
|
||||
|
||||
Du vil kanskje legge merke til [lavprismodeller](/docs/config/#models), som Haiku, Nano eller Flash, i brukshistorikken din. OpenCode bruker disse modellene til å generere økttitler.
|
||||
|
||||
@@ -195,8 +195,8 @@ Obsługujemy model pay-as-you-go. Poniżej znajdują się ceny **za 1M tokenów*
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -221,8 +221,6 @@ Obsługujemy model pay-as-you-go. Poniżej znajdują się ceny **za 1M tokenów*
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** Podane ceny obejmują 50% zniżki do 18 września 2026 r.
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Godziny Peak to 01:00-04:00 i 06:00-10:00 UTC; wszystkie pozostałe godziny to Off-Peak. [Dowiedz się więcej](https://api-docs.deepseek.com/quick_start/pricing/).
|
||||
|
||||
W historii użycia możesz zauważyć [niedrogie modele](/docs/config/#models), takie jak Haiku, Nano lub Flash. OpenCode używa tych modeli do generowania tytułów sesji.
|
||||
|
||||
@@ -184,8 +184,8 @@ Oferecemos um modelo pay-as-you-go. Abaixo estão os preços **por 1M tokens**.
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -210,8 +210,6 @@ Oferecemos um modelo pay-as-you-go. Abaixo estão os preços **por 1M tokens**.
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** Os preços exibidos incluem 50% de desconto até 18 de setembro de 2026.
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Os horários Peak são 01:00-04:00 e 06:00-10:00 UTC; todos os demais horários são Off-Peak. [Saiba mais](https://api-docs.deepseek.com/quick_start/pricing/).
|
||||
|
||||
Você pode notar [modelos de baixo custo](/docs/config/#models), como Haiku, Nano ou Flash, no seu histórico de uso. O OpenCode usa esses modelos para gerar títulos de sessões.
|
||||
|
||||
@@ -195,8 +195,8 @@ https://opencode.ai/zen/v1/models
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -221,8 +221,6 @@ https://opencode.ai/zen/v1/models
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** Указанные цены включают скидку 50% до 18 сентября 2026 года.
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Часы Peak: 01:00-04:00 и 06:00-10:00 UTC; все остальные часы относятся к Off-Peak. [Подробнее](https://api-docs.deepseek.com/quick_start/pricing/).
|
||||
|
||||
В истории использования могут появляться [недорогие модели](/docs/config/#models), такие как Haiku, Nano или Flash. OpenCode использует эти модели для создания заголовков сессий.
|
||||
|
||||
@@ -186,8 +186,8 @@ https://opencode.ai/zen/v1/models
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -212,8 +212,6 @@ https://opencode.ai/zen/v1/models
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** ราคาที่แสดงรวมส่วนลด 50% จนถึงวันที่ 18 กันยายน 2026
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** ช่วงเวลา Peak คือ 01:00-04:00 และ 06:00-10:00 UTC ส่วนเวลาอื่นทั้งหมดเป็น Off-Peak [ดูข้อมูลเพิ่มเติม](https://api-docs.deepseek.com/quick_start/pricing/)
|
||||
|
||||
คุณอาจสังเกตเห็น[โมเดลต้นทุนต่ำ](/docs/config/#models) เช่น Haiku, Nano หรือ Flash ในประวัติการใช้งานของคุณ OpenCode ใช้โมเดลเหล่านี้เพื่อสร้างชื่อเซสชัน
|
||||
|
||||
@@ -184,8 +184,8 @@ Kullandıkça öde modelini destekliyoruz. Aşağıda **1M token başına** fiya
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -210,8 +210,6 @@ Kullandıkça öde modelini destekliyoruz. Aşağıda **1M token başına** fiya
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** Gösterilen fiyatlara 18 Eylül 2026 tarihine kadar %50 indirim dahildir.
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Peak saatleri 01:00-04:00 ve 06:00-10:00 UTC'dir; diğer tüm saatler Off-Peak'tir. [Daha fazla bilgi](https://api-docs.deepseek.com/quick_start/pricing/).
|
||||
|
||||
Kullanım geçmişinizde Haiku, Nano veya Flash gibi [düşük maliyetli modeller](/docs/config/#models) görebilirsiniz. OpenCode, oturum başlıklarını oluşturmak için bu modelleri kullanır.
|
||||
|
||||
@@ -195,8 +195,8 @@ We support a pay-as-you-go model. Below are the prices **per 1M tokens**.
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -221,8 +221,6 @@ We support a pay-as-you-go model. Below are the prices **per 1M tokens**.
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** Prices shown include a 50% discount through September 18, 2026.
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Peak hours are 01:00-04:00 and 06:00-10:00 UTC; all other hours are Off-Peak. [Learn more](https://api-docs.deepseek.com/quick_start/pricing/).
|
||||
|
||||
You may notice [low-cost models](/docs/config/#models), such as Haiku, Nano, or Flash, in your usage history. OpenCode uses these models to generate session titles.
|
||||
|
||||
@@ -184,8 +184,8 @@ https://opencode.ai/zen/v1/models
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -210,8 +210,6 @@ https://opencode.ai/zen/v1/models
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** 所示价格已包含 50% 折扣,有效期至 2026 年 9 月 18 日。
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Peak 时段为 01:00-04:00 和 06:00-10:00 UTC;其他所有时段均为 Off-Peak。[了解更多](https://api-docs.deepseek.com/quick_start/pricing/)。
|
||||
|
||||
你可能会在使用记录中看到 Haiku、Nano 或 Flash 等[低成本模型](/docs/config/#models)。OpenCode 使用这些模型生成会话标题。
|
||||
|
||||
@@ -189,8 +189,8 @@ https://opencode.ai/zen/v1/models
|
||||
| Grok 4.5 (> 200K tokens) | $4.00 | $12.00 | $0.60 | - |
|
||||
| Grok Build 0.1 | $1.00 | $2.00 | $0.20 | - |
|
||||
| Muse Spark 1.2 | $1.25 | $4.25 | $0.15 | - |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $2.00 | $10.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $4.00 | $15.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Sol (≤ 272K tokens) | $5.00 | $30.00 | $0.50 | $6.25 |
|
||||
| GPT 5.6 Sol (> 272K tokens) | $10.00 | $45.00 | $1.00 | $12.50 |
|
||||
| GPT 5.6 Terra (≤ 272K tokens) | $2.00 | $12.00 | $0.20 | $2.50 |
|
||||
| GPT 5.6 Terra (> 272K tokens) | $4.00 | $18.00 | $0.40 | $5.00 |
|
||||
| GPT 5.6 Luna (≤ 272K tokens) | $0.20 | $1.20 | $0.02 | $0.25 |
|
||||
@@ -215,8 +215,6 @@ https://opencode.ai/zen/v1/models
|
||||
| GPT 5 Codex | $1.07 | $8.50 | $0.107 | - |
|
||||
| GPT 5 Nano | $0.05 | $0.40 | $0.005 | - |
|
||||
|
||||
**GPT 5.6 Sol:** 顯示價格已包含 50% 折扣,有效期至 2026 年 9 月 18 日。
|
||||
|
||||
**DeepSeek V4 Flash / Pro:** Peak 時段為 01:00-04:00 和 06:00-10:00 UTC;其他所有時段均為 Off-Peak。[了解更多](https://api-docs.deepseek.com/quick_start/pricing/)。
|
||||
|
||||
你可能會在使用紀錄中看到 Haiku、Nano 或 Flash 等[低成本模型](/docs/config/#models)。OpenCode 使用這些模型產生工作階段標題。
|
||||
|
||||
Reference in New Issue
Block a user