add alibaba token-plan provider extension
4cf67f5f +1102
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758# prime-alibaba
Prime Agent extension that registers Alibaba Model Studio **token plan** models(`https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1`) as the`alibaba` provider over the OpenAI-compatible API.
## Install
Installed as an auto-discovered global extension:
```~/.prime/agent/extensions/prime-alibaba -> /Users/dawn/proj/prime-alibaba```
Edits here are picked up by `/reload` in a running session; new sessions load it at startup.For a one-off run without installing: `prime-agent -e /Users/dawn/proj/prime-alibaba`.
## Auth
Key resolution order:
1. key stored by `/login` -> pick **Alibaba Model Studio (token plan)**, paste the key2. `ALIBABA_API_KEY`3. `~/.alibaba.key`
`ALIBABA_BASE_URL` overrides the endpoint (other region or gateway).
## Model list
At startup the extension asks the endpoint for `/models` (entitlement) and models.devfor metadata (context window, output limit, reasoning, image support). Only models theaccount can actually call are registered. Metadata borrowed from another models.devprovider never claims image input. `models.json` is the offline snapshot used whenmodels.dev is unreachable; refresh it from `models.dev/api.json` (`alibaba-token-plan`).The entitlement list is cached in `~/.prime/agent/alibaba-entitlement.json`, so a slow orfailed `/models` call reuses the last known list instead of offering unusable models.
Thinking is mapped per family: `qwen` -> top-level `enable_thinking`, `deepseek` ->`thinking` + `reasoning_effort`, `glm` -> Z.ai format.
## Prompt caching
Model Studio has two modes, and they are mutually exclusive per request:
- implicit: always on, no markers, 1024-token minimum, hit not guaranteed- explicit: `cache_control: {"type": "ephemeral"}` markers, 5 minute TTL that resets on each hit, deterministic, 1024-token minimum
Qwen honours the markers here (usage comes back with `cache_type: ephemeral` and`cache_creation_input_tokens`), so qwen models get `cacheControlFormat: "anthropic"` andPrime marks the system prompt, the last tool definition, and the last conversationmessage. GLM and DeepSeek on this gateway ignore the markers and cache implicitly, sothey are left unmarked.
Measured in-session: turn 2 of a session reported `cacheRead: 15042` of ~15.1K prompttokens. Separate `--print` runs never share a cache because the system prompt embeds theper-session conversation log path about 2.6K characters in, which is under the 1024-tokenminimum for the shared prefix.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156/** * Alibaba Model Studio "token plan" provider for Prime Agent. * * `/login alibaba` stores a pasted API key in ~/.prime/agent/auth.json. * Fallbacks, in order: stored key, ALIBABA_API_KEY, ~/.alibaba.key. * ALIBABA_BASE_URL overrides the endpoint (e.g. another region). */
import type { Api } from "@earendil-works/pi-ai";import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";import { readFileSync, writeFileSync } from "node:fs";import { homedir } from "node:os";import { join } from "node:path";import { fileURLToPath } from "node:url";
const PROVIDER = "alibaba";const DEFAULT_BASE_URL = "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1";const CATALOG_URL = "https://models.dev/api.json";const CATALOG_PROVIDER = "alibaba-token-plan";const FETCH_TIMEOUT_MS = 10000;const KEY_FILE = join(homedir(), ".alibaba.key");const AUTH_FILE = join(homedir(), ".prime", "agent", "auth.json");const ENTITLEMENT_CACHE = join(homedir(), ".prime", "agent", "alibaba-entitlement.json");const SNAPSHOT = join(fileURLToPath(new URL(".", import.meta.url)), "models.json");
interface CatalogModel { name: string; reasoning: boolean; tool_call: boolean; attachment: boolean; modalities: { input: string[]; output: string[] }; limit: { context: number; output: number };}
type Catalog = Record<string, CatalogModel>;
const thinkingFormat = (id: string): "qwen" | "deepseek" | "zai" | undefined => id.startsWith("qwen") ? "qwen" : id.startsWith("deepseek") ? "deepseek" : id.startsWith("glm") ? "zai" : undefined;
const isChatModel = (m: CatalogModel): boolean => m.tool_call && m.modalities.output.includes("text");
const readKeyFile = (): string | undefined => { try { return readFileSync(KEY_FILE, "utf-8").trim() || undefined; } catch { return undefined; }};
/** Key saved by `/login alibaba`, used only to list the account's entitled models. */const readStoredKey = (): string | undefined => { try { const entry = (JSON.parse(readFileSync(AUTH_FILE, "utf-8")) as Record<string, { key?: string }>)[PROVIDER]; return entry?.key; } catch { return undefined; }};
/** Token-plan models from models.dev, plus every other model it knows, as a fallback pool. */async function loadCatalog(): Promise<{ own: Catalog; pool: Catalog }> { try { const response = await fetch(CATALOG_URL, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) }); if (!response.ok) throw new Error(`models.dev ${response.status}`); const payload = (await response.json()) as Record<string, { models?: Catalog }>; const own = payload[CATALOG_PROVIDER]?.models; if (!own || Object.keys(own).length === 0) throw new Error(`models.dev has no ${CATALOG_PROVIDER} models`); const pool: Catalog = {}; for (const provider of Object.values(payload)) { for (const [id, model] of Object.entries(provider.models ?? {})) { if (!(id in pool)) pool[id] = model; } } return { own, pool: { ...pool, ...own } }; } catch { const own = (JSON.parse(readFileSync(SNAPSHOT, "utf-8")) as { models: Catalog }).models; return { own, pool: own }; }}
/** * Model ids the account is entitled to. A slow or failed lookup falls back to the last * known list, so a transient hiccup never silently offers models the key cannot call. */async function accountModelIds(baseUrl: string, apiKey: string | undefined): Promise<Set<string> | undefined> { const cached = (): Set<string> | undefined => { try { const ids = JSON.parse(readFileSync(ENTITLEMENT_CACHE, "utf-8")) as string[]; return ids.length > 0 ? new Set(ids) : undefined; } catch { return undefined; } };
if (!apiKey) return cached(); try { const response = await fetch(`${baseUrl}/models`, { headers: { Authorization: `Bearer ${apiKey}` }, signal: AbortSignal.timeout(FETCH_TIMEOUT_MS), }); if (!response.ok) return cached(); const payload = (await response.json()) as { data?: Array<{ id: string }> }; const ids = (payload.data ?? []).map((m) => m.id); if (ids.length === 0) return cached(); writeFileSync(ENTITLEMENT_CACHE, `${JSON.stringify(ids.sort(), null, "\t")}\n`); return new Set(ids); } catch { return cached(); }}
export default async function (pi: ExtensionAPI) { const baseUrl = (process.env.ALIBABA_BASE_URL || DEFAULT_BASE_URL).replace(/\/+$/, ""); const keyFileValue = readKeyFile(); const [{ own, pool }, entitled] = await Promise.all([ loadCatalog(), accountModelIds(baseUrl, readStoredKey() ?? process.env.ALIBABA_API_KEY ?? keyFileValue), ]); // The live endpoint is authoritative about entitlement; models.dev only supplies metadata. const catalog = entitled ? Object.fromEntries([...entitled].flatMap((id) => (pool[id] ? [[id, pool[id]] as const] : []))) : own;
const models = Object.entries(catalog) .filter(([, m]) => isChatModel(m)) .map(([id, m]) => ({ id, name: m.name, reasoning: m.reasoning, input: (m.attachment && m.modalities.input.includes("image") ? ["text", "image"] : ["text"]) as ("text" | "image")[], // The token plan bills a flat subscription, so per-token cost is zero. cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: m.limit.context, maxTokens: m.limit.output, compat: { supportsDeveloperRole: false, maxTokensField: "max_tokens" as const, ...(m.reasoning ? { thinkingFormat: thinkingFormat(id) } : {}), // Only Qwen honours cache_control here; the other families cache implicitly // and report hits through prompt_tokens_details.cached_tokens. ...(id.startsWith("qwen") ? { cacheControlFormat: "anthropic" as const } : {}), }, })) .sort((a, b) => a.id.localeCompare(b.id));
pi.registerProvider(PROVIDER, { name: "Alibaba Model Studio (token plan)", baseUrl, apiKey: process.env.ALIBABA_API_KEY ? "ALIBABA_API_KEY" : (keyFileValue ?? "ALIBABA_API_KEY"), api: "openai-completions" as Api, models, });}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877{ "api": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1", "id": "alibaba-token-plan", "models": { "MiniMax-M2.5": { "attachment": false, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Prior MiniMax coding model for agent workflows, office edits, and automation", "family": "minimax", "id": "MiniMax-M2.5", "interleaved": { "field": "reasoning_content" }, "last_updated": "2026-02-12", "limit": { "context": 196608, "input": 196601, "output": 32768 }, "modalities": { "input": [ "text" ], "output": [ "text" ] }, "name": "MiniMax-M2.5", "open_weights": true, "reasoning": true, "reasoning_options": [], "release_date": "2026-02-12", "temperature": true, "tool_call": true }, "deepseek-v3.2": { "attachment": false, "cost": { "input": 0, "output": 0 }, "description": "DeepSeek chat model for instruction following, coding, and analysis", "family": "deepseek", "id": "deepseek-v3.2", "knowledge": "2025-01", "last_updated": "2025-12-05", "limit": { "context": 131072, "output": 65536 }, "modalities": { "input": [ "text" ], "output": [ "text" ] }, "name": "DeepSeek V3.2", "open_weights": true, "reasoning": true, "reasoning_options": [ { "type": "toggle" } ], "release_date": "2025-12-03", "structured_output": true, "temperature": true, "tool_call": true }, "deepseek-v4-flash": { "attachment": false, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Fast DeepSeek V4 lane for economical reasoning, coding, and long-context work", "family": "deepseek-flash", "id": "deepseek-v4-flash", "interleaved": { "field": "reasoning_content" }, "knowledge": "2025-05", "last_updated": "2026-04-24", "limit": { "context": 1000000, "output": 384000 }, "modalities": { "input": [ "text" ], "output": [ "text" ] }, "name": "DeepSeek V4 Flash", "open_weights": true, "reasoning": true, "reasoning_options": [ { "type": "toggle" }, { "type": "effort", "values": [ "high", "max" ] } ], "release_date": "2026-04-24", "structured_output": true, "temperature": true, "tool_call": true }, "deepseek-v4-flash-0731": { "attachment": false, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Official DeepSeek V4 Flash release with enhanced agentic capabilities and integrated DSpark speculative decoding", "family": "deepseek-flash", "id": "deepseek-v4-flash-0731", "interleaved": { "field": "reasoning_content" }, "knowledge": "2025-05", "last_updated": "2026-07-31", "limit": { "context": 1000000, "output": 384000 }, "modalities": { "input": [ "text" ], "output": [ "text" ] }, "name": "DeepSeek V4 Flash 0731", "open_weights": true, "reasoning": true, "reasoning_options": [ { "type": "toggle" }, { "type": "effort", "values": [ "high", "max" ] } ], "release_date": "2026-07-31", "structured_output": true, "temperature": true, "tool_call": true }, "deepseek-v4-pro": { "attachment": false, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Open MoE flagship with million-token context for coding and long agent runs", "family": "deepseek-thinking", "id": "deepseek-v4-pro", "interleaved": { "field": "reasoning_content" }, "knowledge": "2025-05", "last_updated": "2026-04-24", "limit": { "context": 1000000, "output": 384000 }, "modalities": { "input": [ "text" ], "output": [ "text" ] }, "name": "DeepSeek V4 Pro", "open_weights": true, "reasoning": true, "reasoning_options": [ { "type": "toggle" }, { "type": "effort", "values": [ "high", "max" ] } ], "release_date": "2026-04-24", "structured_output": true, "temperature": true, "tool_call": true }, "deepseek-v4-pro-0813": { "attachment": false, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "DeepSeek V4 Pro snapshot with million-token context and support for thinking and non-thinking modes", "family": "deepseek-thinking", "id": "deepseek-v4-pro-0813", "interleaved": { "field": "reasoning_content" }, "last_updated": "2026-08-22", "limit": { "context": 1000000, "output": 384000 }, "modalities": { "input": [ "text" ], "output": [ "text" ] }, "name": "DeepSeek V4 Pro 0813", "open_weights": true, "reasoning": true, "reasoning_options": [ { "type": "toggle" }, { "type": "effort", "values": [ "high", "max" ] } ], "release_date": "2026-08-12", "structured_output": true, "temperature": true, "tool_call": true }, "glm-5": { "attachment": false, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "General GLM flagship for coding, analysis, and tool-heavy engineering workflows", "family": "glm", "id": "glm-5", "interleaved": { "field": "reasoning_content" }, "last_updated": "2026-02-12", "limit": { "context": 202752, "output": 16384 }, "modalities": { "input": [ "text" ], "output": [ "text" ] }, "name": "GLM-5", "open_weights": false, "reasoning": true, "reasoning_options": [ { "type": "toggle" } ], "release_date": "2026-02-12", "structured_output": true, "temperature": true, "tool_call": true }, "glm-5.1": { "attachment": false, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Strong GLM coding model for agentic engineering, terminals, and repository generation", "family": "glm", "id": "glm-5.1", "interleaved": { "field": "reasoning_content" }, "last_updated": "2026-04-07", "limit": { "context": 202752, "output": 128000 }, "modalities": { "input": [ "text" ], "output": [ "text" ] }, "name": "GLM-5.1", "open_weights": true, "reasoning": true, "reasoning_options": [ { "type": "toggle" } ], "release_date": "2026-04-07", "structured_output": true, "temperature": true, "tool_call": true }, "glm-5.2": { "attachment": false, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Open flagship GLM for long-horizon coding agents and million-token context work", "family": "glm", "id": "glm-5.2", "interleaved": { "field": "reasoning_content" }, "last_updated": "2026-06-13", "limit": { "context": 1000000, "output": 131072 }, "modalities": { "input": [ "text" ], "output": [ "text" ] }, "name": "GLM-5.2", "open_weights": true, "reasoning": true, "reasoning_options": [ { "type": "effort", "values": [ "high", "max" ] } ], "release_date": "2026-06-13", "structured_output": true, "temperature": true, "tool_call": true }, "kimi-k2.5": { "attachment": true, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Earlier Kimi frontier model for long-context agents, coding, and multimodal work", "family": "kimi-k2", "id": "kimi-k2.5", "interleaved": { "field": "reasoning_content" }, "knowledge": "2025-01", "last_updated": "2026-01", "limit": { "context": 262144, "output": 98304 }, "modalities": { "input": [ "text", "image", "video" ], "output": [ "text" ] }, "name": "Kimi K2.5", "open_weights": true, "reasoning": true, "reasoning_options": [ { "type": "toggle" }, { "type": "budget_tokens" } ], "release_date": "2026-01", "structured_output": true, "temperature": true, "tool_call": true }, "kimi-k2.6": { "attachment": true, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Multimodal Kimi workhorse for agent loops, coding tasks, and visual context", "family": "kimi-k2", "id": "kimi-k2.6", "interleaved": { "field": "reasoning_content" }, "knowledge": "2025-01", "last_updated": "2026-04-21", "limit": { "context": 262144, "output": 262144 }, "modalities": { "input": [ "text", "image", "video" ], "output": [ "text" ] }, "name": "Kimi K2.6", "open_weights": true, "reasoning": true, "reasoning_options": [ { "type": "toggle" }, { "type": "budget_tokens" } ], "release_date": "2026-04-21", "structured_output": true, "temperature": true, "tool_call": true }, "kimi-k2.7-code": { "attachment": true, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Coding-focused Kimi model, stronger on long-horizon repo work with less overthinking", "family": "kimi-k2", "id": "kimi-k2.7-code", "interleaved": { "field": "reasoning_content" }, "knowledge": "2025-01", "last_updated": "2026-06-12", "limit": { "context": 262144, "output": 262144 }, "modalities": { "input": [ "text", "image", "video" ], "output": [ "text" ] }, "name": "Kimi K2.7 Code", "open_weights": true, "reasoning": true, "reasoning_options": [ { "type": "toggle" }, { "type": "budget_tokens" } ], "release_date": "2026-06-12", "structured_output": true, "temperature": false, "tool_call": true }, "qwen3.6-flash": { "attachment": true, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Qwen vision-language model for visual reasoning, documents, and agent tasks", "family": "qwen3.6", "id": "qwen3.6-flash", "interleaved": { "field": "reasoning_content" }, "last_updated": "2026-04-27", "limit": { "context": 1000000, "output": 65536 }, "modalities": { "input": [ "text", "image", "video" ], "output": [ "text" ] }, "name": "Qwen3.6 Flash", "open_weights": false, "reasoning": true, "reasoning_options": [ { "type": "toggle" }, { "max": 131072, "type": "budget_tokens" } ], "release_date": "2026-04-27", "structured_output": true, "temperature": true, "tool_call": true }, "qwen3.6-plus": { "attachment": true, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Earlier Qwen multimodal workhorse for million-token agent and document tasks", "family": "qwen", "id": "qwen3.6-plus", "interleaved": { "field": "reasoning_content" }, "knowledge": "2025-04", "last_updated": "2026-04-02", "limit": { "context": 1000000, "output": 65536 }, "modalities": { "input": [ "text", "image", "video" ], "output": [ "text" ] }, "name": "Qwen3.6 Plus", "open_weights": false, "reasoning": true, "reasoning_options": [ { "type": "toggle" }, { "max": 131072, "type": "budget_tokens" } ], "release_date": "2026-04-02", "structured_output": true, "temperature": true, "tool_call": true }, "qwen3.7-max": { "attachment": false, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Qwen frontier model tuned for agent frameworks, coding assistants, and long tasks", "family": "qwen", "id": "qwen3.7-max", "interleaved": { "field": "reasoning_content" }, "last_updated": "2026-05-21", "limit": { "context": 1000000, "output": 131072 }, "modalities": { "input": [ "text" ], "output": [ "text" ] }, "name": "Qwen3.7 Max", "open_weights": false, "reasoning": true, "reasoning_options": [ { "type": "toggle" }, { "max": 262144, "type": "budget_tokens" } ], "release_date": "2026-05-21", "structured_output": true, "temperature": true, "tool_call": true }, "qwen3.7-plus": { "attachment": true, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Multimodal Qwen workhorse for long-context agents, visual inputs, and coding", "family": "qwen", "id": "qwen3.7-plus", "interleaved": { "field": "reasoning_content" }, "knowledge": "2025-04", "last_updated": "2026-06-02", "limit": { "context": 1000000, "output": 65536 }, "modalities": { "input": [ "text", "image", "video" ], "output": [ "text" ] }, "name": "Qwen3.7 Plus", "open_weights": false, "reasoning": true, "reasoning_options": [ { "type": "toggle" }, { "max": 262144, "type": "budget_tokens" } ], "release_date": "2026-06-02", "structured_output": true, "temperature": true, "tool_call": true }, "qwen3.8-flash": { "attachment": true, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Qwen vision-language model for visual reasoning, documents, and agent tasks", "family": "qwen", "id": "qwen3.8-flash", "interleaved": { "field": "reasoning_content" }, "last_updated": "2026-08-26", "limit": { "context": 1000000, "output": 131072 }, "modalities": { "input": [ "text", "image", "video" ], "output": [ "text" ] }, "name": "Qwen3.8 Flash", "open_weights": false, "reasoning": true, "reasoning_options": [ { "type": "toggle" }, { "type": "effort", "values": [ "low", "medium", "xhigh" ] }, { "max": 262144, "type": "budget_tokens" } ], "release_date": "2026-08-26", "structured_output": true, "tool_call": true }, "qwen3.8-max": { "attachment": true, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "2.4-trillion-parameter MoE flagship for coding, professional work, multimodal understanding, and long-horizon agentic workflows", "family": "qwen", "id": "qwen3.8-max", "interleaved": { "field": "reasoning_content" }, "last_updated": "2026-08-03", "limit": { "context": 1000000, "output": 131072 }, "modalities": { "input": [ "text", "image", "video", "pdf" ], "output": [ "text" ] }, "name": "Qwen3.8 Max", "open_weights": false, "reasoning": true, "reasoning_options": [ { "type": "toggle" }, { "type": "effort", "values": [ "low", "medium", "xhigh" ] }, { "max": 262144, "min": 0, "type": "budget_tokens" } ], "release_date": "2026-08-03", "structured_output": true, "temperature": true, "tool_call": true }, "qwen3.8-max-preview": { "attachment": true, "cost": { "cache_read": 0, "cache_write": 0, "input": 0, "output": 0 }, "description": "Preview Qwen flagship for million-token multimodal reasoning and long-horizon agentic workflows", "family": "qwen", "id": "qwen3.8-max-preview", "interleaved": { "field": "reasoning_content" }, "last_updated": "2026-07-19", "limit": { "context": 1000000, "output": 131072 }, "modalities": { "input": [ "text", "image", "video" ], "output": [ "text" ] }, "name": "Qwen3.8 Max Preview", "open_weights": false, "reasoning": true, "reasoning_options": [ { "type": "effort", "values": [ "low", "medium", "xhigh" ] }, { "max": 262144, "min": 0, "type": "budget_tokens" } ], "release_date": "2026-07-19", "status": "deprecated", "structured_output": true, "temperature": true, "tool_call": true } }}1234567891011{ "name": "prime-alibaba", "private": true, "version": "0.1.0", "type": "module", "pi": { "extensions": [ "./index.ts" ] }}