Files
magpie/internal/provider/volcengine_test.go
T
yetone 4150dfc079 provider: Volcengine Ark (火山方舟) is a preset, its Coding Plan, Agent Plan and pay-as-you-go (tcdw: 提供一个选项能够取消自动给 LLM 提供商地址补全 /v1/ 的默认行为) — volcengine, a first-party vendor with a Plan picker: Coding Plan (default) at https://ark.cn-beijing.volces.com/api/coding/v3 for chat completions and Responses and /api/coding for messages (套餐概览 docs/82379/1925114, 快速开始 1928261; its Codex page 2556056 sets wire_api "responses"); Agent Plan, which tcdw is on, at /api/plan/v3 (chat completions and Responses, its Hermes Agent page 2373743) and /api/plan (其他工具 2373746, Claude Code 2373740), with a key of its own; pay-as-you-go at /api/v3 (兼容 OpenAI SDK 1330626, 创建 Response 1569618), which both plans' pages warn bills apart from the plan — no Anthropic endpoint is documented for it. Its models (ark-code-latest, whichever the console picked, then doubao-seed-evolving, doubao-seed-2.1-pro/-lite, doubao-seed-2.0-mini, minimax-m3, glm-5.3, glm-5.3-flash, deepseek-v4.1-flash, deepseek-v4-flash, deepseek-v4-pro, kimi-k2.7-code, kimi-k2.8-preview, kimi-k3, lowercase as the quick-start page gives them) are shown until a list is fetched; no models.dev catalog is tied to it, as its volcengine one has pay-as-you-go's dated ids and volcengine-coding-plan misses the Agent Plan's. Key from ark.volcengine.com/region:cn-beijing/apikey. Their versioned paths go out as written (previous commit). Icon is lobehub's volcengine-color, as the others are; the import page offers its three plans
2026-09-29 01:19:06 +08:00

38 lines
1.5 KiB
Go

package provider
import (
"strings"
"testing"
)
func TestVolcengineArkPlans(t *testing.T) {
p, err := FromPreset("volcengine")
if err != nil {
t.Fatal(err)
}
// a Coding Plan's own endpoints by default: its quota isn't spent at
// Ark's pay-as-you-go /api/v3
if p.Chat != "https://ark.cn-beijing.volces.com/api/coding/v3" || p.Responses != p.Chat || p.Anthropic != "https://ark.cn-beijing.volces.com/api/coding" {
t.Fatalf("endpoints: %q %q %q", p.Chat, p.Responses, p.Anthropic)
}
pr := Preset("volcengine")
if len(pr.Regions) != 3 || pr.Regions[0].Chat != pr.Chat || pr.Regions[0].Anthropic != pr.Anthropic ||
pr.Regions[1].ID != "agent" || pr.Regions[1].Chat != "https://ark.cn-beijing.volces.com/api/plan/v3" || pr.Regions[1].Anthropic != "https://ark.cn-beijing.volces.com/api/plan" ||
pr.Regions[2].Chat != "https://ark.cn-beijing.volces.com/api/v3" || pr.Regions[2].Anthropic != "" {
t.Fatalf("plans: %+v", pr.Regions)
}
for _, id := range pr.Models {
if id != strings.ToLower(id) {
t.Fatalf("model ids are lowercase, as the quick-start page has them: %q", id)
}
}
if got := p.planModels(nil); len(got) != len(pr.Models) || got[0].ID != "ark-code-latest" {
t.Fatalf("plan's: %+v", got)
}
// an entry imported from another app at an Ark endpoint is known as Ark
im, _ := imported("Ark", "k", endpoints{chat: "https://ark.cn-beijing.volces.com/api/plan/v3"}, nil)
if im.Icon != "volcengine-color" || im.Chat != "https://ark.cn-beijing.volces.com/api/plan/v3" {
t.Fatalf("imported: %+v", im)
}
}