一把 key 通图像 / 视频 / 音频 / embedding
ByteSpike 的多模态端点跟文本模型共用同一把 Anthropic 风格 key —— 图像、视频、embedding、rerank。这里讲我们自己在用的 3 个模式,以及让试错很便宜的失败不计费语义。
只路由文本的网关是 2024 设计。2026 任何有意思的工作流都得混模态 —— 给图像加 caption、按相关性给文档打分、生成 5 秒产品片段、embed 整个语料并 rerank top-K。ByteSpike 在做的时候就把多模态当一等公民,跟文本模型共享同一把 key + 同一份账单。
一段话讲完多模态 surface
- 图像 —— Seedream v4 / v5lite、Nano Banana / Pro / v2、GPT-Image-2(Anthropic shim + OpenAI 官方双路由)、GPT-4o-image。
- 视频 —— Sora-2 + Sora-2-Pro、Veo-3.1 标准 + fast、Seedance 1.5-Pro / 2.0 / 2.0-Pro / 2.0-Pro-fast。
- Embedding + rerank —— 走 utility 端点;同一 auth header,同一份每请求 credit 记账。
- 异步任务 —— 长耗时生成(多数视频模型)返 task ID 不走流式。Poll / cancel / query —— 三个 Anthropic 风格端点统一暴露。
模式 1:文本 + 图像同走一条 Anthropic Messages
给图像加 caption 再让 LLM 总结,单趟 round-trip 完成。Image 生成是 opt-in 的 tool_use;ByteSpike 把 OpenAI Image API shim 进 Anthropic 的 tool_use block —— 你只维护一个 client 一个 auth header。
模式 2:embed-then-rerank(廉价召回,聪明排序)
Embedding 按 token 极便宜,rerank 按 pair 贵。我们自己 docs 站搜索 + 内部飞书知识库都跑这个 shape:先一次性 embed 全量,余弦召回 top 50,再把 top 50 + query 喂 rerank model 保 top 5。两步都走 ByteSpike 同一把 key。
# Step 1 — embed the corpus (one-shot, cache on your side)
curl https://llm.bytespike.ai/v1/embeddings \
-H "Authorization: Bearer sk-byts-..." \
-H "Content-Type: application/json" \
-d '{
"model": "bge-large-zh-v1.5",
"input": ["doc 1 text...", "doc 2 text..."]
}'
# Step 2 — at query time, rerank the top-K candidates
curl https://llm.bytespike.ai/v1/rerank \
-H "Authorization: Bearer sk-byts-..." \
-H "Content-Type: application/json" \
-d '{
"model": "bge-reranker-v2-m3",
"query": "user question",
"documents": ["candidate 1...", "candidate 2...", "..."]
}'模式 3:异步视频生成 + task ID
Sora 和 Seedance 单条片子常规 30 秒到 2 分钟。ByteSpike 把等待统一到 3 个 Anthropic 风格端点:/tasks/submit 返 ID;/tasks/query poll;/tasks/cancel 杀任务 + 回滚预扣 credit。同一把 key、同一 content-type、不用每家 SDK。
失败不计费 —— 多模态语境下的具体含义
多模态生成的失败方式比文本多:NSFW 过滤拒、watermark 检测命中、上游模型过载、上传文件损坏。ByteSpike 只在生成成功并产出资源时收费。NSFW 拒零费用。Watermark 命中零费用。上游 502 零费用。credit 账户只在有东西可下载时才扣。
“为失败计费就是劝退探索。前沿多模态网关存在的意义,就是让试验便宜到你真的会去跑。”
公开 per-model 费率挂在 /pricing 表格(同一份 lib/endpoints.ts join live channel export 数据)。表里每个端点说同一套 Anthropic-style auth —— 换模型就是改 model 名,不是再做一次集成。