diff --git a/README.md b/README.md index 82b0cc769..83c7925d8 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ The cost: the model sees `{{API_KEY_…}}`, not the key, so a task about the val Pick a preset, paste a key. Model lists come from the vendor, with names and reasoning levels filled in from [models.dev](https://models.dev), so a model released this morning is in your picker on the next refresh. -> **Presets include** Anthropic · OpenAI · Google Gemini · Google Vertex AI · Amazon Bedrock (runtime and Mantle) · DeepSeek · Kimi · Zhipu GLM · MiniMax · StepFun · LongCat · Qwen · Baidu Qianfan · Tencent Cloud · Huawei Cloud MaaS · Volcengine Ark · Mistral · Groq · Nous Portal · xAI · OpenRouter · Together · Fireworks · SiliconFlow · NVIDIA NIM · ModelScope · Ollama · LM Studio … and any OpenAI- or Anthropic-compatible URL. +> **Presets include** Anthropic · OpenAI · Google Gemini · Google Vertex AI · Amazon Bedrock (runtime and Mantle) · DeepSeek · Kimi · Zhipu GLM · MiniMax · StepFun · LongCat · Qwen · Baidu Qianfan · Tencent Cloud · Huawei Cloud MaaS · Volcengine Ark · Mistral · Voyage AI · Groq · Nous Portal · xAI · OpenRouter · Together · Fireworks · SiliconFlow · NVIDIA NIM · ModelScope · Ollama · LM Studio … and any OpenAI- or Anthropic-compatible URL. **Import** brings in the providers from CC Switch, Claude Code, Codex and Alma. **[Add to magpie](https://usemagpie.ai/docs/import)** links let a provider's website hand its config to magpie in one click. Each key and each account can go through a proxy of its own. diff --git a/README.zh-CN.md b/README.zh-CN.md index 4a1d1c6f0..f006a7642 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -150,7 +150,7 @@ Agent 会把读到的东西放进提示词:一个 `.env`、一份配置、一 选一个预设,粘贴 key。模型列表直接来自厂商,名称和推理档位从 [models.dev](https://models.dev) 补全,今天早上刚发布的模型,下次刷新就出现在你的选择器里。 -> **预设包括** Anthropic · OpenAI · Google Gemini · Amazon Bedrock(runtime 与 Mantle)· DeepSeek · Kimi · 智谱 GLM · MiniMax · 阶跃星辰 · LongCat · 通义千问 · 百度千帆 · 腾讯云 · 华为云 MaaS · 火山方舟 · Mistral · Groq · Nous Portal · xAI · OpenRouter · Together · Fireworks · 硅基流动 · NVIDIA NIM · 魔搭 · Ollama · LM Studio …… 以及任何兼容 OpenAI 或 Anthropic 的地址。 +> **预设包括** Anthropic · OpenAI · Google Gemini · Amazon Bedrock(runtime 与 Mantle)· DeepSeek · Kimi · 智谱 GLM · MiniMax · 阶跃星辰 · LongCat · 通义千问 · 百度千帆 · 腾讯云 · 华为云 MaaS · 火山方舟 · Mistral · Voyage AI · Groq · Nous Portal · xAI · OpenRouter · Together · Fireworks · 硅基流动 · NVIDIA NIM · 魔搭 · Ollama · LM Studio …… 以及任何兼容 OpenAI 或 Anthropic 的地址。 **导入**能读取你在 CC Switch、Claude Code、Codex 和 Alma 里配置的 provider。[**「添加到 magpie」链接**](https://usemagpie.ai/docs/zh/import)让 provider 网站一键把配置交给 magpie。每个 key 和每个账号都可以走自己的代理。 diff --git a/docs/reference.md b/docs/reference.md index 5bd45a3d6..ec229d6ba 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -947,6 +947,48 @@ default, `us-east-1`, `eu-central-1`, `ap-northeast-1`, `cn-hongkong` and Completions at `/compatible-mode/v1` and Anthropic Messages at `/apps/anthropic`. +### Embeddings and rerank + +The gateway serves two retrieval APIs beside chat, at `/v1/embeddings` and +`/v1/rerank` (also without `/v1`). Both take the gateway's key, as chat does, +and the model is named as `/v1/models` names one, `provider/model` or the +bare id. + +- `/v1/embeddings` takes OpenAI's body: `model`, `input` (a string or a + list), and whatever else the vendor takes (`dimensions`, + `encoding_format`; Voyage's `input_type`, `output_dimension`, + `output_dtype`, `truncation`). +- `/v1/rerank` takes the body Cohere, Jina and Voyage share: `model`, + `query`, `documents` (a list of strings), and `top_n` (Cohere, Jina) or + `top_k` (Voyage), `return_documents`. The answer is the vendor's, its + results in `results` (Cohere, Jina) or `data` (Voyage), each an `index` + into `documents` with its `relevance_score`. + +The body goes to the provider's `/embeddings` or `/rerank` as +sent, with only `model` changed to the vendor's name for it, and the answer +comes back as the vendor gave it, a refusal with its status and words. The +tokens counted are its `usage.total_tokens`. A model is asked only on its own +API's route: an embedding model named on `/v1/rerank`, or a reranker on +`/v1/embeddings`, is a 404, and neither is in the models agents are offered. +A model several providers serve under one id is a routing group of its kind +made per request (see Routing groups). + +Voyage AI (`voyage`, heatonz on Discord) is a preset of only these: an +API key from dashboard.voyageai.com, at `https://api.voyageai.com/v1`. It has +no list of models to fetch, so the preset names them: the embedding models +`voyage-4-large`, `voyage-4`, `voyage-4-lite`, `voyage-code-4`, +`voyage-finance-2`, `voyage-law-2`, `voyage-3-large`, `voyage-3.5`, +`voyage-3.5-lite`, `voyage-code-3` and `voyage-code-2`, and the rerankers +`rerank-3`, `rerank-3-lite`, `rerank-2.5` and `rerank-2.5-lite`. Its Test asks +`voyage-4-large` for one embedding. Its contextualized +(`/v1/contextualizedembeddings`) and multimodal (`/v1/multimodalembeddings`) +embeddings have no route here. + +```sh +curl localhost:3425/v1/rerank -H "Authorization: Bearer $MAGPIE_KEY" \ + -d '{"model":"voyage/rerank-3","query":"what eats seeds","documents":["a magpie","a stone"],"top_k":1}' +``` + ### Google Vertex AI Google Vertex AI (`google-vertex`), which Google's documentation now calls diff --git a/docs/subsystems/providers-accounts.md b/docs/subsystems/providers-accounts.md index 3df04d643..d67433e40 100644 --- a/docs/subsystems/providers-accounts.md +++ b/docs/subsystems/providers-accounts.md @@ -331,7 +331,7 @@ and `TestHistoricalWindowHoldsUsesEachWindowsOwnReading`. - The scheduled warm-up warms each window a Claude account is expected to have (`withExpected`), the 5-hour and the week, also one its reading left out: Anthropic leaves a window out until the request that starts it. A window left out while a shorter one is running is one the account doesn't have, since any use starts every window it has (a Claude Enterprise account with only the 5-hour, koohoko5924 on Discord, whose week was warmed over and over and its state read Idle): the warmer marks it `Absent` in `codex-warmup.json` and sends it nothing, and `usageRead` doesn't count it as due (`windowAbsent`, `shorterRunning` in [`codex_warmup.go`](../../internal/provider/codex_warmup.go)). A week once seen running, or left out of a reading that is only part of the plan's, is still warmed; one never read before is not. `TestClaudeWarmLeavesAWeekTheAccountHasnt`, `TestClaudeWarmStartsAWeekThatReset`, `TestUsageReadLeavesAWeekTheAccountHasnt`. - An Antigravity subscription offers the union of its On accounts' models (`antigravityPoolModels` in [`antigravity_pool.go`](../../internal/provider/antigravity_pool.go)), each account's own list kept beside it (`accountModels`, read by `Account.Lists` for routing). The lists are fetched at the first listing, a probe, a sync or a Refetch, and also at each account's quota reading, which asks `fetchAvailableModels` anyway: a reading whose models differ from the account's saved list saves it and merges the pooled list again from every On account's own (`noteAntigravityList`), so a model Google gives one account of several later (01huadalang on Discord: Gemini 4) is offered, routed to and given its bar without that account made preferred or probed. A switched-off account's reading changes nothing. `TestAntigravityQuotaReadingListsNewModels`. Each `fetchAvailableModels` names the account's paid and current tier first (`entitlement.userTier`, `askTiers`), then none; a tier Google answers 400 (a Google AI Pro account's g1-pro-tier, #1553) is left out of that account's lists and quota readings for `tierRefusedFor` (a day), and the refused request is no row of the request log. - A provider removed or switched off takes its models out of the catalog. [Agent wiring](agent-wiring.md)'s `Reseat` moves agents off them. -- A preset marked `NoList` uses its preset model list instead of requesting `/models`, and ignores previously fetched lists, including their protocol and key restrictions, unless the user sets `ModelsURL` or chooses a region marked `Lists`. Each region can carry a different list. Volcengine Ark's Coding Plan and Agent Plan use separate preset lists. Both plans include their embedding model separately from agents' chat-model lists; Agent Plan additionally exposes its image- and video-generation models to Settings → Images; Ark itself refuses video generation on Small and Medium Agent Plans, which include it only in the Large and Max tiers. Models magpie does not yet serve (Agent Plan's speech models) are not advertised. Ark's pay-as-you-go region still fetches its own list. Coding's `/api/coding/v3/models` returns a general Ark catalog instead of the plan's model ids, while Agent's `/api/plan/v3/models` returns 404. [`presets.go`](../../internal/provider/presets.go) defines these choices; `List`, `fetch`, `live`, `planModels`, `PlanEmbeddings`, `PlanDrawers` and `PlanVideos` in [`models.go`](../../internal/provider/models.go) apply them when adding, refreshing and reading cached models. `TestVolcengineModelLists` checks that the plans make no list requests, ignore old cached lists and return their own preset models; pay-as-you-go and an explicit list URL still make requests. +- A preset marked `NoList` uses its preset model list instead of requesting `/models`, and ignores previously fetched lists, including their protocol and key restrictions, unless the user sets `ModelsURL` or chooses a region marked `Lists`. Each region can carry a different list. Volcengine Ark's Coding Plan and Agent Plan use separate preset lists. Both plans include their embedding model separately from agents' chat-model lists; Agent Plan additionally exposes its image- and video-generation models to Settings → Images; Ark itself refuses video generation on Small and Medium Agent Plans, which include it only in the Large and Max tiers. Models magpie does not yet serve (Agent Plan's speech models) are not advertised. Ark's pay-as-you-go region still fetches its own list. Coding's `/api/coding/v3/models` returns a general Ark catalog instead of the plan's model ids, while Agent's `/api/plan/v3/models` returns 404. A preset with no regions may name its embedding and rerank models itself (`PresetDef.Embeddings`, `Rerankers`): Voyage AI (`voyage`, heatonz on Discord) has no `/models` and serves only those, so they are its whole list, each marked with what it serves (`catalog.Model.Serves`), kept out of chat lists, and found on `/v1/embeddings` or `/v1/rerank` alone by `PlanRetrieval(kind)` (`TestVoyagePreset`, `TestVoyageModelsStayOnTheirRoutes`). [`presets.go`](../../internal/provider/presets.go) defines these choices; `List`, `fetch`, `live`, `planModels`, `PlanEmbeddings`, `PlanRerankers`, `PlanRetrieval`, `PlanDrawers` and `PlanVideos` in [`models.go`](../../internal/provider/models.go) apply them when adding, refreshing and reading cached models. `TestVolcengineModelLists` checks that the plans make no list requests, ignore old cached lists and return their own preset models; pay-as-you-go and an explicit list URL still make requests. - A gateway key held to some accounts (#905) is held to those of the providers its list names: a provider it names no account of, the key uses as its models allow. A key that lists accounts and no model may use only those accounts' providers' models (`access.HeldModels`, applied where `access.Authenticate` makes the request's `Identity`, so every route's model check holds it; Linka on Discord: ticking only an account let the key list and use every other provider's models; `TestGatewayKeyAccountsOnlyHoldTheModels`). The key's menu says so on each account of such a provider ("Used: no … account is picked" when its models reach the provider, "Not used: no … model or account is picked" when they don't), and its badge's tooltip that a key is kept off a provider by its models (#2077: unticking every Codex account left Codex's models served), or, with no model picked, that only the picked accounts' providers' models are the key's. The list keeps an account by its stable id — `logins.json`'s `id`, set once written and kept through renames; the agents that keep no logins (and plugins) are known by a hash of the account's name, so an account renamed there drops out of a key's list, holding it closer, never wider. Storing an id for every agent is a larger change, not this one's. - A routing group may be held to some accounts the same way (`Group.Accounts`, duanckham on X): a request through it uses only those of a provider it names, and with a gateway key only those both allow. Entries are resolved and checked when the group is saved (`cleanGroupAccounts`, `ResolveAccount`), and dropped from a shared or imported group. See [gateway-routing](gateway-routing.md#a-route-group-held-to-chosen-accounts). - A sub2api key's windows are fixed: each starts at the key's first request after it was empty, aligned to the relay's day, and a window not started yet says `used 0` with no `reset_at`, so it is taken to renew a span from now. They count this key's spend only, not the relay's accounts behind it. `ForgetBalances` (a key or Balance URL changed) has every key's windows read again at its next ask, a read begun before dropped; until then the last reading stands, fresher than the card's, which routing's reads never write. A key changed is another key (`keyID`), with windows of its own. diff --git a/internal/catalog/catalog.go b/internal/catalog/catalog.go index 8e1cee70b..5d407b9b3 100644 --- a/internal/catalog/catalog.go +++ b/internal/catalog/catalog.go @@ -1946,7 +1946,8 @@ const ( // images or video: "" for any other model. Read from the id alone, as // vendors' OpenAI-style lists say no more (text-embedding-3-small, // bge-reranker-v2-m3, tts-1, gpt-4o-mini-tts, whisper-1, -// gpt-4o-transcribe). +// gpt-4o-transcribe). Voyage AI makes embedding models alone, and names +// them voyage-* (voyage-4, voyage-code-3), with no "embed" in the id. func ServesOf(id string) string { id = strings.ToLower(id) if i := strings.LastIndex(id, "/"); i >= 0 { @@ -1955,7 +1956,7 @@ func ServesOf(id string) string { switch { case strings.Contains(id, "rerank"): return ServesRerank - case strings.Contains(id, "embed") || strings.HasPrefix(id, "bge-"): + case strings.Contains(id, "embed") || strings.HasPrefix(id, "bge-") || strings.HasPrefix(id, "voyage-"): return ServesEmbedding case strings.Contains(id, "whisper") || strings.Contains(id, "transcribe"): return ServesTranscription diff --git a/internal/catalog/serves_test.go b/internal/catalog/serves_test.go index b4fcc0455..75f61fa46 100644 --- a/internal/catalog/serves_test.go +++ b/internal/catalog/serves_test.go @@ -78,6 +78,9 @@ func TestServesOf(t *testing.T) { "tts-1-hd": ServesSpeech, "gpt-4o-mini-tts": ServesSpeech, "whisper-1": ServesTranscription, "gpt-4o-transcribe": ServesTranscription, "gpt-5.5": "", "claude-sonnet-5": "", "embedder-chat": ServesEmbedding, + // Voyage AI's, which name no "embed" (heatonz on Discord) + "voyage-4-large": ServesEmbedding, "voyage-code-3": ServesEmbedding, "voyage/voyage-3.5-lite": ServesEmbedding, + "rerank-3": ServesRerank, "rerank-2.5-lite": ServesRerank, } { if got := ServesOf(id); got != want { t.Errorf("ServesOf(%q) = %q, want %q", id, got, want) diff --git a/internal/gateway/embeddings.go b/internal/gateway/embeddings.go index 965ae4402..6a40fc7d9 100644 --- a/internal/gateway/embeddings.go +++ b/internal/gateway/embeddings.go @@ -320,9 +320,10 @@ func (s *Server) serveRetrieval(w http.ResponseWriter, r *http.Request, path, op } } -// resolveRetrievalModel also finds a preset plan's embedding model by its -// bare id. Such models stay out of agents' chat-model lists, so the general -// resolver does not otherwise see them there. +// resolveRetrievalModel also finds a preset plan's embedding or rerank +// model, of kind's, by its bare id. Such models stay out of agents' +// chat-model lists, so the general resolver does not otherwise see them +// there. func resolveRetrievalModel(id, kind string) (provider.Provider, string, bool) { if p, model, ok := mediaGroupFirst(id, kind); ok { return p, model, true @@ -337,7 +338,7 @@ func resolveRetrievalModel(id, kind string) (provider.Provider, string, bool) { if !p.On() || p.DecideOnly() { continue } - for _, m := range p.PlanEmbeddings() { + for _, m := range p.PlanRetrieval(kind) { if m.ID == id { return p, id, true } diff --git a/internal/gateway/media_group.go b/internal/gateway/media_group.go index 87d503a10..8807c2867 100644 --- a/internal/gateway/media_group.go +++ b/internal/gateway/media_group.go @@ -57,8 +57,8 @@ func bareRef(ref string) bool { // servesKind says whether a provider serves a model of kind's under that // id: its fetched list says so (catalog.LiveServing; Videomakers for // videos), its chat list has an id that says so (another magpie's list, -// which keeps them as it lists them), or, for embeddings, its plan names -// it (PlanEmbeddings). +// which keeps them as it lists them), or, for embeddings and rerank, its +// preset names it (PlanRetrieval). func servesKind(kind string) func(p provider.Provider, model string) bool { is := func(m catalog.Model, model string) bool { return m.ID == model } if kind == provider.KindVideo { @@ -73,7 +73,7 @@ func servesKind(kind string) func(p provider.Provider, model string) bool { if catalog.ServesOf(model) == kind && slices.ContainsFunc(provider.KeptListing(p).Available, func(m catalog.Model) bool { return is(m, model) }) { return true } - return kind == catalog.ServesEmbedding && slices.ContainsFunc(p.PlanEmbeddings(), func(m catalog.Model) bool { return is(m, model) }) + return slices.ContainsFunc(p.PlanRetrieval(kind), func(m catalog.Model) bool { return is(m, model) }) } } diff --git a/internal/gateway/voyage_test.go b/internal/gateway/voyage_test.go new file mode 100644 index 000000000..d5bcfd72b --- /dev/null +++ b/internal/gateway/voyage_test.go @@ -0,0 +1,165 @@ +package gateway + +import ( + "io" + "net/http" + "net/http/httptest" + "strings" + "sync" + "testing" + "time" + + "github.com/yetone/magpie/internal/catalog" + "github.com/yetone/magpie/internal/provider" + "github.com/yetone/magpie/internal/usage" +) + +// fakeVoyage answers as api.voyageai.com does, in the shapes its API +// reference gives (docs.voyageai.com/reference/embeddings-api and +// reranker-api, read 11-06): a Bearer key, embeddings in OpenAI's list +// shape and rerank results in data, both counted in usage.total_tokens, +// a refusal as {"detail": …}. It has no /models. +type fakeVoyage struct { + mu sync.Mutex + sent map[string][]string +} + +func (f *fakeVoyage) ServeHTTP(w http.ResponseWriter, r *http.Request) { + body, _ := io.ReadAll(r.Body) + f.mu.Lock() + if f.sent == nil { + f.sent = map[string][]string{} + } + f.sent[r.Method+" "+r.URL.Path] = append(f.sent[r.Method+" "+r.URL.Path], string(body)) + f.mu.Unlock() + w.Header().Set("Content-Type", "application/json") + if r.Header.Get("Authorization") != "Bearer pa-voyage" { + w.WriteHeader(401) + io.WriteString(w, `{"detail":"Provided API key is invalid."}`) + return + } + switch r.Method + " " + r.URL.Path { + case "POST /v1/embeddings": + if strings.Contains(string(body), `"model":"rerank-`) { + w.WriteHeader(400) + io.WriteString(w, `{"detail":"Model rerank-3 is not supported."}`) + return + } + io.WriteString(w, `{"object":"list","data":[{"object":"embedding","embedding":[-0.016709786,0.026996311],"index":0},{"object":"embedding","embedding":[0.003613521,0.026428301],"index":1}],"model":"voyage-4-large","usage":{"total_tokens":8}}`) + case "POST /v1/rerank": + io.WriteString(w, `{"object":"list","data":[{"relevance_score":0.455078125,"index":1,"document":"a magpie"},{"relevance_score":0.439453125,"index":0,"document":"a crow"}],"model":"rerank-3","usage":{"total_tokens":11}}`) + default: + w.WriteHeader(404) + io.WriteString(w, `{"detail":"Not Found"}`) + } +} + +func (f *fakeVoyage) got(route string) []string { + f.mu.Lock() + defer f.mu.Unlock() + return append([]string(nil), f.sent[route]...) +} + +// voyaged is a gateway with the Voyage AI preset added, its URL the fake's. +func voyaged(t *testing.T) (*Server, *fakeVoyage) { + t.Helper() + fresh(t) + f := &fakeVoyage{} + up := httptest.NewServer(f) + t.Cleanup(up.Close) + p, err := provider.FromPreset("voyage") + if err != nil { + t.Fatal(err) + } + if p.Chat != "https://api.voyageai.com/v1" { + t.Fatalf("preset's base %q", p.Chat) + } + p.Chat, p.Key = up.URL+"/v1", "pa-voyage" + if err := provider.Save(p); err != nil { + t.Fatal(err) + } + return New(), f +} + +// heatonz on Discord: Voyage AI's embeddings and rerank, by the model's +// bare id or the provider's, go to its /v1/embeddings and /v1/rerank as +// sent, and the vendor's answer and token count come back. +func TestVoyageEmbeddingsAndRerank(t *testing.T) { + s, f := voyaged(t) + code, raw := postRetrieval(t, s, "/v1/embeddings", `{"model":"voyage-4-large","input":["hello","world"],"input_type":"document","output_dimension":1024}`) + if code != 200 || !strings.Contains(raw, `"embedding":[-0.016709786,0.026996311]`) || !strings.Contains(raw, `"total_tokens":8`) { + t.Fatalf("embeddings: %d %s", code, raw) + } + sent := f.got("POST /v1/embeddings") + if len(sent) != 1 || !strings.Contains(sent[0], `"model":"voyage-4-large"`) || !strings.Contains(sent[0], `"input_type":"document"`) || !strings.Contains(sent[0], `"output_dimension":1024`) { + t.Fatalf("Voyage was sent %v", sent) + } + if code, raw := postRetrieval(t, s, "/v1/embeddings", `{"model":"voyage/voyage-code-3","input":"func main() {}"}`); code != 200 { + t.Fatalf("by the provider's id: %d %s", code, raw) + } + code, raw = postRetrieval(t, s, "/v1/rerank", `{"model":"rerank-3","query":"magpie","documents":["a crow","a magpie"],"top_k":1,"return_documents":true}`) + if code != 200 || !strings.Contains(raw, `"relevance_score":0.455078125`) || !strings.Contains(raw, `"document":"a magpie"`) { + t.Fatalf("rerank: %d %s", code, raw) + } + sent = f.got("POST /v1/rerank") + if len(sent) != 1 || !strings.Contains(sent[0], `"model":"rerank-3"`) || !strings.Contains(sent[0], `"top_k":1`) || !strings.Contains(sent[0], `"return_documents":true`) { + t.Fatalf("Voyage was sent %v", sent) + } + var recs []usage.Record + for i := 0; i < 100; i++ { + if recs = usage.Load(time.Time{}); len(recs) >= 3 { + break + } + time.Sleep(20 * time.Millisecond) + } + ops := map[string]usage.Record{} + for _, r := range recs { + ops[r.Operation+" "+r.Model] = r + } + if r := ops["embeddings voyage-4-large"]; r.Provider != "voyage" || r.Input != 8 || r.Status != 200 { + t.Fatalf("embeddings' usage %+v (all %+v)", r, recs) + } + if r := ops["rerank rerank-3"]; r.Provider != "voyage" || r.Input != 11 || r.Status != 200 { + t.Fatalf("rerank's usage %+v (all %+v)", r, recs) + } +} + +// A Voyage model is asked only on its own API's route: a reranker is no +// model of the embeddings route, nor an embedding model of rerank's; and +// neither is offered to agents to chat with. +func TestVoyageModelsStayOnTheirRoutes(t *testing.T) { + s, f := voyaged(t) + if code, raw := postRetrieval(t, s, "/v1/embeddings", `{"model":"rerank-3","input":"hi"}`); code != 404 { + t.Fatalf("a reranker on embeddings: %d %s", code, raw) + } + if code, raw := postRetrieval(t, s, "/v1/rerank", `{"model":"voyage-4","query":"hi","documents":["hi"]}`); code != 404 { + t.Fatalf("an embedding model on rerank: %d %s", code, raw) + } + if n := len(f.got("POST /v1/embeddings")) + len(f.got("POST /v1/rerank")); n != 0 { + t.Fatalf("Voyage was asked %d times", n) + } + p, err := provider.Find("voyage") + if err != nil { + t.Fatal(err) + } + if ms := p.Exposed(); len(ms) != 0 { + t.Fatalf("offered to agents: %+v", ms) + } + if _, model, ok := resolveRetrievalModel("rerank-3-lite", catalog.ServesRerank); !ok || model != "rerank-3-lite" { + t.Fatalf("rerank-3-lite resolved %q %v", model, ok) + } +} + +// What Voyage refuses comes back with its code and its words. +func TestVoyageRefusalSaysWhy(t *testing.T) { + s, _ := voyaged(t) + p, _ := provider.Find("voyage") + p.Key = "pa-wrong" + if err := provider.Save(*p); err != nil { + t.Fatal(err) + } + code, raw := postRetrieval(t, s, "/v1/embeddings", `{"model":"voyage-4","input":"hi"}`) + if code != 401 || !strings.Contains(raw, "Provided API key is invalid.") { + t.Fatalf("%d %s", code, raw) + } +} diff --git a/internal/gui/providers.go b/internal/gui/providers.go index 8ea2e37c4..70b431049 100644 --- a/internal/gui/providers.go +++ b/internal/gui/providers.go @@ -1034,7 +1034,7 @@ func providerInfoWith(p provider.Provider, ls provider.Listing, agents []agentUs out.Exposed = len(exposed) if len(out.Models) == 0 { // a vendor of embedding and rerank models alone (heatonz) - for _, m := range catalog.LiveServing(p.ID, "") { + for _, m := range append(catalog.LiveServing(p.ID, ""), p.PlanRetrieval("")...) { if m.Serves == catalog.ServesEmbedding || m.Serves == catalog.ServesRerank { out.Retrieval++ } diff --git a/internal/provider/key_plans.go b/internal/provider/key_plans.go index a5acf0a1d..fcde4d378 100644 --- a/internal/provider/key_plans.go +++ b/internal/provider/key_plans.go @@ -147,7 +147,7 @@ func (p Provider) planList() []string { case pr.NoList && !r.Lists: out = append(out, pr.Models...) } - for _, l := range [][]string{r.Embeddings, r.Drawers, r.Videos} { + for _, l := range [][]string{r.Embeddings, r.Rerankers, r.Drawers, r.Videos} { out = append(out, l...) } return out diff --git a/internal/provider/models.go b/internal/provider/models.go index 692e0b100..962af457c 100644 --- a/internal/provider/models.go +++ b/internal/provider/models.go @@ -513,7 +513,8 @@ func (p Provider) List(ctx context.Context) ([]catalog.Model, error) { func (p Provider) ListAll(ctx context.Context) ([]catalog.Model, error) { ctx = p.ownRequests(p.Via(ctx), probelog.KindList) if pr := Preset(p.Preset); pr != nil && pr.NoList && strings.TrimSpace(p.ModelsURL) == "" && !p.listRegion(pr) { - return p.planModels(nil), nil + // with its embedding and rerank models, marked so (Voyage AI's) + return append(p.planModels(nil), p.PlanRetrieval("")...), nil } if p.IsCline() && strings.TrimSpace(p.ModelsURL) == "" { if ms, _, err := p.clineFeed(ctx); err == nil { @@ -1241,26 +1242,48 @@ func (p Provider) planModels(ms []catalog.Model) []catalog.Model { // region's plan. They are resolved by the embeddings API but kept out of // agents' chat-model lists. func (p Provider) PlanEmbeddings() []catalog.Model { - return p.planMedia(func(r *Region) []string { return r.Embeddings }, false, false) + return p.planMedia(func(r *Region) []string { return r.Embeddings }, false, false, catalog.ServesEmbedding) +} + +// PlanRerankers are the rerank models the preset names, as PlanEmbeddings +// are its embedding models. +func (p Provider) PlanRerankers() []catalog.Model { + return p.planMedia(func(r *Region) []string { return r.Rerankers }, false, false, catalog.ServesRerank) +} + +// PlanRetrieval are the preset's models of kind's (catalog.ServesEmbedding +// or ServesRerank), or both for "". +func (p Provider) PlanRetrieval(kind string) []catalog.Model { + switch kind { + case catalog.ServesEmbedding: + return p.PlanEmbeddings() + case catalog.ServesRerank: + return p.PlanRerankers() + case "": + return append(p.PlanEmbeddings(), p.PlanRerankers()...) + } + return nil } // PlanDrawers are the image-generation models explicitly included in the // preset region's plan. They are separate from its chat models. func (p Provider) PlanDrawers() []catalog.Model { - return p.planMedia(func(r *Region) []string { return r.Drawers }, true, false) + return p.planMedia(func(r *Region) []string { return r.Drawers }, true, false, "") } // PlanVideos are the video-generation models explicitly included in the // preset region's plan. func (p Provider) PlanVideos() []catalog.Model { - return p.planMedia(func(r *Region) []string { return r.Videos }, false, true) + return p.planMedia(func(r *Region) []string { return r.Videos }, false, true, "") } -func (p Provider) planMedia(ids func(*Region) []string, draws, films bool) []catalog.Model { +func (p Provider) planMedia(ids func(*Region) []string, draws, films bool, serves string) []catalog.Model { pr := Preset(p.Preset) if pr == nil { return nil } + // a preset with no regions names its own (Voyage AI's) + own := &Region{Embeddings: pr.Embeddings, Rerankers: pr.Rerankers} // keys on plans of their own (KeyAccount.Plan): each plan's, once views := []Provider{p} if p.plansMixed() { @@ -1271,12 +1294,12 @@ func (p Provider) planMedia(ids func(*Region) []string, draws, films bool) []cat for _, v := range views { r := v.regionOf(pr) if r == nil { - continue + r = own } for _, id := range ids(r) { if !seen[id] { seen[id] = true - out = append(out, catalog.Model{ID: id, Name: id, Provider: p.ID, Draws: draws, Films: films}) + out = append(out, catalog.Model{ID: id, Name: id, Provider: p.ID, Draws: draws, Films: films, Serves: serves}) } } } diff --git a/internal/provider/presets.go b/internal/provider/presets.go index df66b55a5..999ed2298 100644 --- a/internal/provider/presets.go +++ b/internal/provider/presets.go @@ -74,6 +74,12 @@ type PresetDef struct { // Hosts: a vendor serving other makers' models as well as its own // (Groq, Ollama Cloud, Azure), whose list is no maker's word on theirs Hosts bool `json:"-"` + // Embeddings and Rerankers are the models of a vendor of retrieval + // models alone (Voyage AI), which has no list to ask: served on + // /v1/embeddings and /v1/rerank, kept out of agents' model pickers. + // A Region's own lists stand over them. + Embeddings []string `json:"embeddings,omitempty"` + Rerankers []string `json:"rerankers,omitempty"` } // Region is one base-URL option of a preset that offers several. The first @@ -100,10 +106,11 @@ type Region struct { Catalog string `json:"catalog,omitempty"` // Models are a plan's text models, for a region that is one beside // another plan or pay as you go (PresetDef.Models, for the region alone). - // Embeddings, Drawers and Videos are its non-chat models, kept apart from + // Embeddings, Rerankers, Drawers and Videos are its non-chat models, kept apart from // agents' model pickers. Models []string `json:"models,omitempty"` Embeddings []string `json:"embeddings,omitempty"` + Rerankers []string `json:"rerankers,omitempty"` Drawers []string `json:"drawers,omitempty"` Videos []string `json:"videos,omitempty"` // Images says which of Models take images, as the vendor's own list @@ -445,6 +452,20 @@ var presets = []PresetDef{ {ID: "mistral", Name: "Mistral", Icon: "mistral-color", Kind: KindVendor, Catalog: "mistral", Chat: "https://api.mistral.ai/v1", Website: "https://console.mistral.ai", KeysURL: "https://console.mistral.ai/api-keys"}, + // Voyage AI makes embedding and rerank models alone, at + // api.voyageai.com/v1/embeddings and /v1/rerank with a Bearer key + // (docs.voyageai.com/reference/embeddings-api, reranker-api, read + // 11-06). It has no /models, so its models are the docs' (pricing, + // embeddings, reranker): the current ones first, then the older ones + // it still serves. Its contextualized and multimodal embeddings are on + // APIs of their own, which magpie doesn't serve. heatonz on Discord. + {ID: "voyage", Name: "Voyage AI", Icon: "voyage-color", Kind: KindVendor, + Chat: "https://api.voyageai.com/v1", + Website: "https://docs.voyageai.com", KeysURL: "https://dashboard.voyageai.com/organization/api-keys", + NoList: true, + Embeddings: []string{"voyage-4-large", "voyage-4", "voyage-4-lite", "voyage-code-4", "voyage-finance-2", "voyage-law-2", + "voyage-3-large", "voyage-3.5", "voyage-3.5-lite", "voyage-code-3", "voyage-code-2"}, + Rerankers: []string{"rerank-3", "rerank-3-lite", "rerank-2.5", "rerank-2.5-lite"}}, {ID: "groq", Name: "Groq", Icon: "groq", Kind: KindVendor, Catalog: "groq", Hosts: true, Chat: "https://api.groq.com/openai/v1", Responses: "https://api.groq.com/openai/v1", Website: "https://console.groq.com", KeysURL: "https://console.groq.com/keys"}, diff --git a/internal/provider/test.go b/internal/provider/test.go index 9065db2dd..23b2f0bb6 100644 --- a/internal/provider/test.go +++ b/internal/provider/test.go @@ -618,7 +618,8 @@ func (p Provider) testModel(q Provider, proto Protocol) string { // none to chat with: an embedding or rerank model its list // keeps apart (catalog.LiveServing), asked where the gateway // sends it (heatonz on Discord: a provider serving only those) - for _, m := range catalog.LiveServing(p.ID, "") { + // or one its preset names (Voyage AI, which lists none) + for _, m := range append(catalog.LiveServing(p.ID, ""), p.PlanRetrieval("")...) { if retrievalOf(m.ID) != "" && !off(p.ID, m.ID) && (k.Key == "" || p.Serves(k, m.ID)) { return m.ID } diff --git a/internal/provider/voyage_test.go b/internal/provider/voyage_test.go new file mode 100644 index 000000000..012f95d80 --- /dev/null +++ b/internal/provider/voyage_test.go @@ -0,0 +1,109 @@ +package provider + +import ( + "context" + "io" + "net/http" + "net/http/httptest" + "slices" + "sync" + "testing" + + "github.com/yetone/magpie/internal/catalog" +) + +// Voyage AI's preset (heatonz on Discord): api.voyageai.com/v1 with a +// key, no list to ask, its embedding and rerank models named by the +// preset and marked so, none of them a chat model. +func TestVoyagePreset(t *testing.T) { + detectHome(t) + p, err := FromPreset("voyage") + if err != nil { + t.Fatal(err) + } + if p.Chat != "https://api.voyageai.com/v1" || p.Responses != "" || p.Anthropic != "" || p.Icon != "voyage-color" || p.KeysURL != "https://dashboard.voyageai.com/organization/api-keys" { + t.Fatalf("preset %+v", p) + } + if pr := Preset("voyage"); pr.Kind != KindVendor || pr.NoKey || !pr.NoList || len(pr.Models) != 0 { + t.Fatalf("preset def %+v", pr) + } + embed, rerank := p.PlanEmbeddings(), p.PlanRerankers() + if len(embed) == 0 || embed[0].ID != "voyage-4-large" || len(rerank) == 0 || rerank[0].ID != "rerank-3" { + t.Fatalf("embeddings %v, rerankers %v", embed, rerank) + } + for _, m := range embed { + if m.Serves != catalog.ServesEmbedding || catalog.ServesOf(m.ID) != catalog.ServesEmbedding { + t.Errorf("%s: Serves %q, ServesOf %q", m.ID, m.Serves, catalog.ServesOf(m.ID)) + } + } + for _, m := range rerank { + if m.Serves != catalog.ServesRerank || catalog.ServesOf(m.ID) != catalog.ServesRerank { + t.Errorf("%s: Serves %q, ServesOf %q", m.ID, m.Serves, catalog.ServesOf(m.ID)) + } + } + all, err := p.ListAll(context.Background()) + if err != nil { + t.Fatal(err) + } + if len(all) != len(embed)+len(rerank) || len(catalog.Chat(all)) != 0 { + t.Fatalf("ListAll %v", all) + } + // another preset's retrieval models are untouched: none at the preset + // level, Volcengine's plans' own + if o, _ := FromPreset("openai"); len(o.PlanRetrieval("")) != 0 { + t.Fatalf("openai's %v", o.PlanRetrieval("")) + } +} + +// A saved Voyage provider's Test asks an embedding model at its +// /embeddings, as the gateway does, and a reranker's at /rerank, never +// /chat/completions or /models. +func TestVoyageTestAsksItsRetrievalAPIs(t *testing.T) { + detectHome(t) + var mu sync.Mutex + var asked []string + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + io.Copy(io.Discard, r.Body) + mu.Lock() + asked = append(asked, r.Method+" "+r.URL.Path) + mu.Unlock() + w.Header().Set("Content-Type", "application/json") + if r.Header.Get("Authorization") != "Bearer pa-voyage" { + w.WriteHeader(401) + io.WriteString(w, `{"detail":"Provided API key is invalid."}`) + return + } + switch r.URL.Path { + case "/v1/embeddings": + io.WriteString(w, `{"object":"list","data":[{"object":"embedding","embedding":[0.1,0.2],"index":0}],"model":"voyage-4-large","usage":{"total_tokens":1}}`) + case "/v1/rerank": + io.WriteString(w, `{"object":"list","data":[{"relevance_score":0.5,"index":0}],"model":"rerank-3","usage":{"total_tokens":2}}`) + default: + w.WriteHeader(404) + io.WriteString(w, `{"detail":"Not Found"}`) + } + })) + defer srv.Close() + p, _ := FromPreset("voyage") + p.Chat, p.Key = srv.URL+"/v1", "pa-voyage" + if err := Save(p); err != nil { + t.Fatal(err) + } + saved, err := Find("voyage") + if err != nil { + t.Fatal(err) + } + p = *saved + if rs := p.Test(context.Background()); len(rs) != 1 || !rs[0].OK || rs[0].Model != "voyage-4-large" { + t.Fatalf("Test: %+v", rs) + } + if rs := p.TestModels(context.Background(), []string{"rerank-3", "voyage-code-3"}); len(rs) != 2 || !rs[0].OK || !rs[1].OK { + t.Fatalf("TestModels: %+v", rs) + } + mu.Lock() + defer mu.Unlock() + slices.Sort(asked) + if !slices.Equal(asked, []string{"POST /v1/embeddings", "POST /v1/embeddings", "POST /v1/rerank"}) { + t.Fatalf("asked %v", asked) + } +} diff --git a/site/public/docs/import.html b/site/public/docs/import.html index 29273f93f..c4dabf3e3 100644 --- a/site/public/docs/import.html +++ b/site/public/docs/import.html @@ -146,7 +146,7 @@

Presets

Vendors magpie already knows. magpie presets prints the current list.

- anthropicopenaigoogledeepseekxaimoonshotKimimoonshot-cnkimi-codekimi-code-cnzhipuGLM · api · codingzaiapi · codingminimaxminimax-cnstepfunplan · apistepfun-cnplan · apixiaomiMiMolongcatbaidu-qianfan千帆 · personal · team · apitencent-cloudplan · cn · intl · enterprise · enterprise-intlhuaweicloudplan · apivolcengine火山方舟 · coding · agent · apiqwenqwen-cnqwen-token-planbailian-token-planqwencloudap-southeast-1 · us-east-1 · eu-central-1 · ap-northeast-1 · cn-hongkong · cn-beijingqwencloud-token-planmistralgroqbedrockollama-cloudopenrouteropencode-goclinepassopencode-zenkilocommandcodetogetherfireworkssiliconflowcn · intlnvidiamodelscope魔搭aihubmixpipellm302aicherryinyylxauto · global · cnollamalmstudio + anthropicopenaigoogledeepseekxaimoonshotKimimoonshot-cnkimi-codekimi-code-cnzhipuGLM · api · codingzaiapi · codingminimaxminimax-cnstepfunplan · apistepfun-cnplan · apixiaomiMiMolongcatbaidu-qianfan千帆 · personal · team · apitencent-cloudplan · cn · intl · enterprise · enterprise-intlhuaweicloudplan · apivolcengine火山方舟 · coding · agent · apiqwenqwen-cnqwen-token-planbailian-token-planqwencloudap-southeast-1 · us-east-1 · eu-central-1 · ap-northeast-1 · cn-hongkong · cn-beijingqwencloud-token-planmistralvoyagegroqbedrockollama-cloudopenrouteropencode-goclinepassopencode-zenkilocommandcodetogetherfireworkssiliconflowcn · intlnvidiamodelscope魔搭aihubmixpipellm302aicherryinyylxauto · global · cnollamalmstudio

A vendor with a preset only needs to add the key: magpie://import?preset=deepseek&key=sk-…. Want yours on the list? Open an issue.

@@ -304,7 +304,7 @@ href = "https://usemagpie.ai/import#" + urlencode({ ["zai", "Z.ai"], ["minimax", "MiniMax"], ["minimax-cn", "MiniMax (China)"], ["stepfun", "StepFun"], ["stepfun-cn", "StepFun (China)"], ["xiaomi", "Xiaomi MiMo"], ["longcat", "LongCat"], ["baidu-qianfan", "Baidu Qianfan"], ["tencent-cloud", "Tencent Cloud"], ["huaweicloud", "Huawei Cloud MaaS"], ["volcengine", "Volcengine Ark"], ["qwen", "Qwen"], ["qwen-cn", "Qwen (China)"], ["qwen-token-plan", "Qwen Token Plan"], ["bailian-token-plan", "Bailian Token Plan"], ["qwencloud", "Qwen Cloud"], ["qwencloud-token-plan", "Qwen Cloud Token Plan"], - ["mistral", "Mistral"], ["groq", "Groq"], ["bedrock", "Amazon Bedrock"], ["ollama-cloud", "Ollama Cloud"], ["nous", "Nous Portal"], ["openrouter", "OpenRouter"], + ["mistral", "Mistral"], ["voyage", "Voyage AI"], ["groq", "Groq"], ["bedrock", "Amazon Bedrock"], ["ollama-cloud", "Ollama Cloud"], ["nous", "Nous Portal"], ["openrouter", "OpenRouter"], ["opencode-go", "OpenCode Go"], ["clinepass", "ClinePass"], ["opencode-zen", "OpenCode Zen"], ["kilo", "Kilo Gateway"], ["commandcode", "Command Code"], ["together", "Together AI"], ["fireworks", "Fireworks"], ["siliconflow", "SiliconFlow"], ["nvidia", "NVIDIA NIM"], ["modelscope", "ModelScope"], ["aihubmix", "AiHubMix"], ["pipellm", "PipeLLM"], ["302ai", "302.AI"], ["cherryin", "CherryIN"], ["yylx", "鱼鱼连线"], diff --git a/site/public/docs/ja/import.html b/site/public/docs/ja/import.html index 53cd11460..4229ee055 100644 --- a/site/public/docs/ja/import.html +++ b/site/public/docs/ja/import.html @@ -146,7 +146,7 @@

プリセット

magpie が組み込みで知っているベンダーです。magpie presets で最新の一覧を表示できます。

- anthropicopenaigoogledeepseekxaimoonshotKimimoonshot-cnkimi-codekimi-code-cnzhipuGLM · api · codingzaiapi · codingminimaxminimax-cnstepfunplan · apistepfun-cnplan · apixiaomiMiMolongcatbaidu-qianfan千帆 · personal · team · apitencent-cloudplan · cn · intl · enterprise · enterprise-intlhuaweicloudplan · apivolcengine火山方舟 · coding · agent · apiqwenqwen-cnqwen-token-planbailian-token-planqwencloudap-southeast-1 · us-east-1 · eu-central-1 · ap-northeast-1 · cn-hongkong · cn-beijingqwencloud-token-planmistralgroqbedrockollama-cloudopenrouteropencode-goclinepassopencode-zenkilocommandcodetogetherfireworkssiliconflowcn · intlnvidiamodelscope魔搭aihubmixpipellm302aicherryinyylxauto · global · cnollamalmstudio + anthropicopenaigoogledeepseekxaimoonshotKimimoonshot-cnkimi-codekimi-code-cnzhipuGLM · api · codingzaiapi · codingminimaxminimax-cnstepfunplan · apistepfun-cnplan · apixiaomiMiMolongcatbaidu-qianfan千帆 · personal · team · apitencent-cloudplan · cn · intl · enterprise · enterprise-intlhuaweicloudplan · apivolcengine火山方舟 · coding · agent · apiqwenqwen-cnqwen-token-planbailian-token-planqwencloudap-southeast-1 · us-east-1 · eu-central-1 · ap-northeast-1 · cn-hongkong · cn-beijingqwencloud-token-planmistralvoyagegroqbedrockollama-cloudopenrouteropencode-goclinepassopencode-zenkilocommandcodetogetherfireworkssiliconflowcn · intlnvidiamodelscope魔搭aihubmixpipellm302aicherryinyylxauto · global · cnollamalmstudio

プリセットのあるベンダーなら、キーを付けるだけです:magpie://import?preset=deepseek&key=sk-…。一覧に追加したい場合は issue を作成してください。

@@ -304,7 +304,7 @@ href = "https://usemagpie.ai/import#" + urlencode({ ["zai", "Z.ai"], ["minimax", "MiniMax"], ["minimax-cn", "MiniMax(中国)"], ["stepfun", "StepFun"], ["stepfun-cn", "StepFun(中国)"], ["xiaomi", "Xiaomi MiMo"], ["longcat", "LongCat"], ["baidu-qianfan", "Baidu Qianfan"], ["tencent-cloud", "Tencent Cloud"], ["huaweicloud", "Huawei Cloud MaaS"], ["volcengine", "Volcengine Ark"], ["qwen", "Qwen"], ["qwen-cn", "Qwen(中国)"], ["qwen-token-plan", "Qwen Token Plan"], ["bailian-token-plan", "Alibaba Cloud Bailian Token Plan"], ["qwencloud", "Qwen Cloud"], ["qwencloud-token-plan", "Qwen Cloud Token Plan"], - ["mistral", "Mistral"], ["groq", "Groq"], ["bedrock", "Amazon Bedrock"], ["ollama-cloud", "Ollama Cloud"], ["nous", "Nous Portal"], ["openrouter", "OpenRouter"], + ["mistral", "Mistral"], ["voyage", "Voyage AI"], ["groq", "Groq"], ["bedrock", "Amazon Bedrock"], ["ollama-cloud", "Ollama Cloud"], ["nous", "Nous Portal"], ["openrouter", "OpenRouter"], ["opencode-go", "OpenCode Go"], ["clinepass", "ClinePass"], ["opencode-zen", "OpenCode Zen"], ["kilo", "Kilo Gateway"], ["commandcode", "Command Code"], ["together", "Together AI"], ["fireworks", "Fireworks"], ["siliconflow", "SiliconFlow"], ["nvidia", "NVIDIA NIM"], ["modelscope", "ModelScope"], ["aihubmix", "AiHubMix"], ["pipellm", "PipeLLM"], ["302ai", "302.AI"], ["cherryin", "CherryIN"], ["yylx", "鱼鱼连线"], diff --git a/site/public/docs/zh/import.html b/site/public/docs/zh/import.html index 6f4475e97..592de0b45 100644 --- a/site/public/docs/zh/import.html +++ b/site/public/docs/zh/import.html @@ -146,7 +146,7 @@

预设

magpie 已经内置的厂商。magpie presets 会打印当前的列表。

- anthropicopenaigoogledeepseekxaimoonshotKimimoonshot-cnkimi-codekimi-code-cnzhipuGLM · api · codingzaiapi · codingminimaxminimax-cnstepfunplan · apistepfun-cnplan · apixiaomiMiMolongcatbaidu-qianfan千帆 · personal · team · apitencent-cloudplan · cn · intl · enterprise · enterprise-intlhuaweicloudplan · apivolcengine火山方舟 · coding · agent · apiqwenqwen-cnqwen-token-planbailian-token-planqwencloudap-southeast-1 · us-east-1 · eu-central-1 · ap-northeast-1 · cn-hongkong · cn-beijingqwencloud-token-planmistralgroqbedrockollama-cloudopenrouteropencode-goclinepassopencode-zenkilocommandcodetogetherfireworkssiliconflowcn · intlnvidiamodelscope魔搭aihubmixpipellm302aicherryinyylxauto · global · cnollamalmstudio + anthropicopenaigoogledeepseekxaimoonshotKimimoonshot-cnkimi-codekimi-code-cnzhipuGLM · api · codingzaiapi · codingminimaxminimax-cnstepfunplan · apistepfun-cnplan · apixiaomiMiMolongcatbaidu-qianfan千帆 · personal · team · apitencent-cloudplan · cn · intl · enterprise · enterprise-intlhuaweicloudplan · apivolcengine火山方舟 · coding · agent · apiqwenqwen-cnqwen-token-planbailian-token-planqwencloudap-southeast-1 · us-east-1 · eu-central-1 · ap-northeast-1 · cn-hongkong · cn-beijingqwencloud-token-planmistralvoyagegroqbedrockollama-cloudopenrouteropencode-goclinepassopencode-zenkilocommandcodetogetherfireworkssiliconflowcn · intlnvidiamodelscope魔搭aihubmixpipellm302aicherryinyylxauto · global · cnollamalmstudio

有预设的厂商只需带上密钥:magpie://import?preset=deepseek&key=sk-…。想加入列表?提个 issue。

@@ -304,7 +304,7 @@ href = "https://usemagpie.ai/import#" + urlencode({ ["zai", "Z.ai"], ["minimax", "MiniMax"], ["minimax-cn", "MiniMax(中国)"], ["stepfun", "阶跃星辰"], ["stepfun-cn", "阶跃星辰(中国)"], ["xiaomi", "小米 MiMo"], ["longcat", "LongCat"], ["baidu-qianfan", "百度千帆"], ["tencent-cloud", "腾讯云"], ["huaweicloud", "华为云 MaaS"], ["volcengine", "火山方舟"], ["qwen", "通义千问"], ["qwen-cn", "通义千问(中国)"], ["qwen-token-plan", "通义千问 Token Plan"], ["bailian-token-plan", "阿里云百炼 Token Plan"], ["qwencloud", "Qwen Cloud"], ["qwencloud-token-plan", "Qwen Cloud Token Plan"], - ["mistral", "Mistral"], ["groq", "Groq"], ["bedrock", "Amazon Bedrock"], ["ollama-cloud", "Ollama Cloud"], ["nous", "Nous Portal"], ["openrouter", "OpenRouter"], + ["mistral", "Mistral"], ["voyage", "Voyage AI"], ["groq", "Groq"], ["bedrock", "Amazon Bedrock"], ["ollama-cloud", "Ollama Cloud"], ["nous", "Nous Portal"], ["openrouter", "OpenRouter"], ["opencode-go", "OpenCode Go"], ["clinepass", "ClinePass"], ["opencode-zen", "OpenCode Zen"], ["kilo", "Kilo Gateway"], ["commandcode", "Command Code"], ["together", "Together AI"], ["fireworks", "Fireworks"], ["siliconflow", "硅基流动"], ["nvidia", "NVIDIA NIM"], ["modelscope", "魔搭 ModelScope"], ["aihubmix", "AiHubMix"], ["pipellm", "PipeLLM"], ["302ai", "302.AI"], ["cherryin", "CherryIN"], ["yylx", "鱼鱼连线"],