Skip to content

Commit c3cae39

Browse files
authored
feat: add Poe as an AI provider (#12015)
1 parent 137d3f4 commit c3cae39

42 files changed

Lines changed: 1116 additions & 54 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/types/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"clean": "rimraf dist .turbo"
2424
},
2525
"dependencies": {
26+
"ai-sdk-provider-poe": "2.0.18",
2627
"zod": "3.25.76"
2728
},
2829
"devDependencies": {

packages/types/src/provider-settings.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ export const DEFAULT_CONSECUTIVE_MISTAKE_LIMIT = 3
3434
* Dynamic provider requires external API calls in order to get the model list.
3535
*/
3636

37-
export const dynamicProviders = ["openrouter", "vercel-ai-gateway", "litellm", "requesty", "roo", "unbound"] as const
37+
export const dynamicProviders = [
38+
"openrouter",
39+
"vercel-ai-gateway",
40+
"litellm",
41+
"requesty",
42+
"roo",
43+
"unbound",
44+
"poe",
45+
] as const
3846

3947
export type DynamicProvider = (typeof dynamicProviders)[number]
4048

@@ -306,6 +314,11 @@ const deepSeekSchema = apiModelIdProviderModelSchema.extend({
306314
deepSeekApiKey: z.string().optional(),
307315
})
308316

317+
const poeSchema = apiModelIdProviderModelSchema.extend({
318+
poeApiKey: z.string().optional(),
319+
poeBaseUrl: z.string().optional(),
320+
})
321+
309322
const moonshotSchema = apiModelIdProviderModelSchema.extend({
310323
moonshotBaseUrl: z
311324
.union([z.literal("https://api.moonshot.ai/v1"), z.literal("https://api.moonshot.cn/v1")])
@@ -400,6 +413,7 @@ export const providerSettingsSchemaDiscriminated = z.discriminatedUnion("apiProv
400413
openAiNativeSchema.merge(z.object({ apiProvider: z.literal("openai-native") })),
401414
mistralSchema.merge(z.object({ apiProvider: z.literal("mistral") })),
402415
deepSeekSchema.merge(z.object({ apiProvider: z.literal("deepseek") })),
416+
poeSchema.merge(z.object({ apiProvider: z.literal("poe") })),
403417
moonshotSchema.merge(z.object({ apiProvider: z.literal("moonshot") })),
404418
minimaxSchema.merge(z.object({ apiProvider: z.literal("minimax") })),
405419
requestySchema.merge(z.object({ apiProvider: z.literal("requesty") })),
@@ -433,6 +447,7 @@ export const providerSettingsSchema = z.object({
433447
...openAiNativeSchema.shape,
434448
...mistralSchema.shape,
435449
...deepSeekSchema.shape,
450+
...poeSchema.shape,
436451
...moonshotSchema.shape,
437452
...minimaxSchema.shape,
438453
...requestySchema.shape,
@@ -510,6 +525,7 @@ export const modelIdKeysByProvider: Record<TypicalProvider, ModelIdKey> = {
510525
moonshot: "apiModelId",
511526
minimax: "apiModelId",
512527
deepseek: "apiModelId",
528+
poe: "apiModelId",
513529
"qwen-code": "apiModelId",
514530
requesty: "requestyModelId",
515531
unbound: "unboundModelId",
@@ -632,6 +648,7 @@ export const MODELS_BY_PROVIDER: Record<
632648
baseten: { id: "baseten", label: "Baseten", models: Object.keys(basetenModels) },
633649

634650
// Dynamic providers; models pulled from remote APIs.
651+
poe: { id: "poe", label: "Poe", models: [] },
635652
litellm: { id: "litellm", label: "LiteLLM", models: [] },
636653
openrouter: { id: "openrouter", label: "OpenRouter", models: [] },
637654
requesty: { id: "requesty", label: "Requesty", models: [] },

packages/types/src/providers/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export * from "./openai.js"
1313
export * from "./openai-codex.js"
1414
export * from "./openai-codex-rate-limits.js"
1515
export * from "./openrouter.js"
16+
export * from "./poe.js"
1617
export * from "./qwen-code.js"
1718
export * from "./requesty.js"
1819
export * from "./roo.js"
@@ -36,6 +37,7 @@ import { mistralDefaultModelId } from "./mistral.js"
3637
import { moonshotDefaultModelId } from "./moonshot.js"
3738
import { openAiCodexDefaultModelId } from "./openai-codex.js"
3839
import { openRouterDefaultModelId } from "./openrouter.js"
40+
import { poeDefaultModelId } from "./poe.js"
3941
import { qwenCodeDefaultModelId } from "./qwen-code.js"
4042
import { requestyDefaultModelId } from "./requesty.js"
4143
import { rooDefaultModelId } from "./roo.js"
@@ -107,6 +109,8 @@ export function getProviderDefaultModelId(
107109
return rooDefaultModelId
108110
case "qwen-code":
109111
return qwenCodeDefaultModelId
112+
case "poe":
113+
return poeDefaultModelId
110114
case "unbound":
111115
return unboundDefaultModelId
112116
case "vercel-ai-gateway":
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { poeDefaultModelId, POE_DEFAULT_BASE_URL, getPoeDefaultModelInfo } from "ai-sdk-provider-poe/code"
2+
export type { PoeDefaultModelInfo } from "ai-sdk-provider-poe/code"

0 commit comments

Comments
 (0)