@mastra/core 0.18.1-alpha.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +93 -0
- package/dist/agent/agent.d.ts +19 -9
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/index.cjs +11 -11
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +2 -2
- package/dist/agent/input-processor/index.cjs +6 -6
- package/dist/agent/input-processor/index.js +1 -1
- package/dist/agent/types.d.ts +13 -8
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/ai-tracing/exporters/default.d.ts +2 -2
- package/dist/ai-tracing/exporters/default.d.ts.map +1 -1
- package/dist/ai-tracing/index.cjs +32 -32
- package/dist/ai-tracing/index.js +1 -1
- package/dist/ai-tracing/types.d.ts +2 -2
- package/dist/ai-tracing/types.d.ts.map +1 -1
- package/dist/{chunk-ITD7IHN5.js → chunk-2DGWSOVQ.js} +23 -5
- package/dist/chunk-2DGWSOVQ.js.map +1 -0
- package/dist/{chunk-4PK4GBYZ.cjs → chunk-2GHLV754.cjs} +5 -4
- package/dist/chunk-2GHLV754.cjs.map +1 -0
- package/dist/{chunk-LL2X7QT7.js → chunk-3WFH6YRI.js} +4 -4
- package/dist/{chunk-LL2X7QT7.js.map → chunk-3WFH6YRI.js.map} +1 -1
- package/dist/chunk-45CV4JYJ.cjs +4 -0
- package/dist/{chunk-VBPPPQO3.cjs.map → chunk-45CV4JYJ.cjs.map} +1 -1
- package/dist/{chunk-SEZBEL3U.js → chunk-4BEHJSL6.js} +4 -4
- package/dist/{chunk-SEZBEL3U.js.map → chunk-4BEHJSL6.js.map} +1 -1
- package/dist/chunk-4LSFAAZW.js +3 -0
- package/dist/{chunk-CE73R5W7.js.map → chunk-4LSFAAZW.js.map} +1 -1
- package/dist/{chunk-XUAWHRUO.cjs → chunk-4R2TBRS7.cjs} +37 -112
- package/dist/chunk-4R2TBRS7.cjs.map +1 -0
- package/dist/{chunk-ITBUHG4U.cjs → chunk-4VNAMG7K.cjs} +6 -6
- package/dist/{chunk-ITBUHG4U.cjs.map → chunk-4VNAMG7K.cjs.map} +1 -1
- package/dist/{chunk-B4REUTZB.js → chunk-5BQOHHCI.js} +5 -5
- package/dist/{chunk-B4REUTZB.js.map → chunk-5BQOHHCI.js.map} +1 -1
- package/dist/{chunk-FXLZYRV7.js → chunk-5HCVPQTD.js} +3 -3
- package/dist/{chunk-FXLZYRV7.js.map → chunk-5HCVPQTD.js.map} +1 -1
- package/dist/chunk-5M6ZTQJN.js +1374 -0
- package/dist/chunk-5M6ZTQJN.js.map +1 -0
- package/dist/{chunk-SW7WPHZ2.cjs → chunk-7E4ESNZS.cjs} +5 -5
- package/dist/{chunk-SW7WPHZ2.cjs.map → chunk-7E4ESNZS.cjs.map} +1 -1
- package/dist/{chunk-NTS6B2I2.cjs → chunk-A4RAEU6X.cjs} +2 -2
- package/dist/{chunk-NTS6B2I2.cjs.map → chunk-A4RAEU6X.cjs.map} +1 -1
- package/dist/{chunk-QUB6MWXZ.cjs → chunk-BCWRUNMS.cjs} +38 -37
- package/dist/chunk-BCWRUNMS.cjs.map +1 -0
- package/dist/{chunk-245ANI3P.js → chunk-BUY5X7DT.js} +4 -4
- package/dist/{chunk-245ANI3P.js.map → chunk-BUY5X7DT.js.map} +1 -1
- package/dist/{chunk-6ZVNL435.js → chunk-COC64XPP.js} +9 -8
- package/dist/chunk-COC64XPP.js.map +1 -0
- package/dist/{chunk-6X4FZVGT.cjs → chunk-CQ73JM2N.cjs} +10 -10
- package/dist/{chunk-6X4FZVGT.cjs.map → chunk-CQ73JM2N.cjs.map} +1 -1
- package/dist/{chunk-7UEBC5KM.cjs → chunk-DRVSEV5Y.cjs} +25 -65
- package/dist/chunk-DRVSEV5Y.cjs.map +1 -0
- package/dist/{chunk-2TQHRYRK.cjs → chunk-EPMJYNEK.cjs} +4 -4
- package/dist/{chunk-2TQHRYRK.cjs.map → chunk-EPMJYNEK.cjs.map} +1 -1
- package/dist/{chunk-TKFLL33F.cjs → chunk-F6EJEELE.cjs} +9 -9
- package/dist/{chunk-TKFLL33F.cjs.map → chunk-F6EJEELE.cjs.map} +1 -1
- package/dist/{chunk-4DNSY645.js → chunk-FV3SA5TI.js} +3 -3
- package/dist/{chunk-4DNSY645.js.map → chunk-FV3SA5TI.js.map} +1 -1
- package/dist/{chunk-EJ2FU45N.js → chunk-FV4QVXO4.js} +2 -2
- package/dist/{chunk-EJ2FU45N.js.map → chunk-FV4QVXO4.js.map} +1 -1
- package/dist/{chunk-CKZK2EPZ.cjs → chunk-HNBU4PI7.cjs} +4 -4
- package/dist/{chunk-CKZK2EPZ.cjs.map → chunk-HNBU4PI7.cjs.map} +1 -1
- package/dist/{chunk-O6PQYYT6.cjs → chunk-HQPFM22N.cjs} +63 -45
- package/dist/chunk-HQPFM22N.cjs.map +1 -0
- package/dist/{chunk-36DRWGP4.js → chunk-IAXAPVOP.js} +4 -4
- package/dist/{chunk-36DRWGP4.js.map → chunk-IAXAPVOP.js.map} +1 -1
- package/dist/{chunk-5ZMC3NEO.js → chunk-JKLLXBOY.js} +46 -39
- package/dist/chunk-JKLLXBOY.js.map +1 -0
- package/dist/{chunk-WVRSMHE5.cjs → chunk-K4AYIXVH.cjs} +4 -4
- package/dist/{chunk-WVRSMHE5.cjs.map → chunk-K4AYIXVH.cjs.map} +1 -1
- package/dist/{chunk-SALFMUAY.cjs → chunk-LZBVDMVQ.cjs} +19 -19
- package/dist/{chunk-SALFMUAY.cjs.map → chunk-LZBVDMVQ.cjs.map} +1 -1
- package/dist/{chunk-RPFJBB5X.js → chunk-N4PK4MOG.js} +4 -4
- package/dist/{chunk-RPFJBB5X.js.map → chunk-N4PK4MOG.js.map} +1 -1
- package/dist/{chunk-QBTRGHUF.cjs → chunk-NHJVMZIL.cjs} +19 -19
- package/dist/{chunk-QBTRGHUF.cjs.map → chunk-NHJVMZIL.cjs.map} +1 -1
- package/dist/{chunk-BJZWMVNW.js → chunk-OBIF7QD5.js} +3 -3
- package/dist/{chunk-BJZWMVNW.js.map → chunk-OBIF7QD5.js.map} +1 -1
- package/dist/{chunk-VZLNVGYM.cjs → chunk-PG6ZNDSR.cjs} +21 -21
- package/dist/{chunk-VZLNVGYM.cjs.map → chunk-PG6ZNDSR.cjs.map} +1 -1
- package/dist/{chunk-XWJWU5OM.js → chunk-PJ6HF3KW.js} +16 -56
- package/dist/chunk-PJ6HF3KW.js.map +1 -0
- package/dist/{chunk-NG2XDPDY.js → chunk-RAXBZZKS.js} +4 -3
- package/dist/chunk-RAXBZZKS.js.map +1 -0
- package/dist/chunk-RFGQ3EQV.js +3 -0
- package/dist/chunk-RFGQ3EQV.js.map +1 -0
- package/dist/{chunk-73S2WYSD.cjs → chunk-RNIY63FP.cjs} +85 -78
- package/dist/chunk-RNIY63FP.cjs.map +1 -0
- package/dist/{chunk-ROU7YJLG.js → chunk-RYFQKXXS.js} +3 -3
- package/dist/{chunk-ROU7YJLG.js.map → chunk-RYFQKXXS.js.map} +1 -1
- package/dist/{chunk-C73WLCY3.cjs → chunk-S7UXT3V4.cjs} +21 -3
- package/dist/chunk-S7UXT3V4.cjs.map +1 -0
- package/dist/{chunk-R5GESRGB.js → chunk-SJMKDSRF.js} +37 -112
- package/dist/chunk-SJMKDSRF.js.map +1 -0
- package/dist/{chunk-YWXSGDDO.cjs → chunk-SQQMX4VC.cjs} +6 -6
- package/dist/{chunk-YWXSGDDO.cjs.map → chunk-SQQMX4VC.cjs.map} +1 -1
- package/dist/chunk-TCHOIK53.cjs +4 -0
- package/dist/chunk-TCHOIK53.cjs.map +1 -0
- package/dist/chunk-TIBULEK6.cjs +1379 -0
- package/dist/chunk-TIBULEK6.cjs.map +1 -0
- package/dist/{chunk-WECJNCGT.cjs → chunk-UTEH2LCJ.cjs} +19 -19
- package/dist/{chunk-WECJNCGT.cjs.map → chunk-UTEH2LCJ.cjs.map} +1 -1
- package/dist/{chunk-VGU5ZYYG.js → chunk-VWO3JJXC.js} +4 -4
- package/dist/{chunk-VGU5ZYYG.js.map → chunk-VWO3JJXC.js.map} +1 -1
- package/dist/{chunk-MCOVMKIS.js → chunk-WHFNGECY.js} +21 -4
- package/dist/chunk-WHFNGECY.js.map +1 -0
- package/dist/{chunk-NTXNE4YR.js → chunk-XG3SFWOH.js} +3 -3
- package/dist/{chunk-NTXNE4YR.js.map → chunk-XG3SFWOH.js.map} +1 -1
- package/dist/error/index.cjs +5 -5
- package/dist/error/index.d.ts.map +1 -1
- package/dist/error/index.js +1 -1
- package/dist/error/utils.d.ts +8 -0
- package/dist/error/utils.d.ts.map +1 -0
- package/dist/eval/index.cjs +3 -3
- package/dist/eval/index.js +1 -1
- package/dist/index.cjs +84 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -17
- package/dist/index.js.map +1 -1
- package/dist/integration/index.cjs +3 -3
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.cjs +20 -0
- package/dist/llm/index.d.ts +3 -1
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +1 -1
- package/dist/llm/model/gateways/base.d.ts +42 -0
- package/dist/llm/model/gateways/base.d.ts.map +1 -0
- package/dist/llm/model/gateways/index.d.ts +3 -0
- package/dist/llm/model/gateways/index.d.ts.map +1 -0
- package/dist/llm/model/gateways/models-dev.d.ts +11 -0
- package/dist/llm/model/gateways/models-dev.d.ts.map +1 -0
- package/dist/llm/model/index.d.ts +2 -0
- package/dist/llm/model/index.d.ts.map +1 -1
- package/dist/llm/model/model.loop.d.ts.map +1 -1
- package/dist/llm/model/openai-compatible.d.ts +32 -0
- package/dist/llm/model/openai-compatible.d.ts.map +1 -0
- package/dist/llm/model/provider-registry.generated.d.ts +462 -0
- package/dist/llm/model/provider-registry.generated.d.ts.map +1 -0
- package/dist/llm/model/shared.types.d.ts +8 -0
- package/dist/llm/model/shared.types.d.ts.map +1 -1
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +1 -1
- package/dist/loop/network/index.d.ts.map +1 -1
- package/dist/loop/test-utils/fullStream.d.ts.map +1 -1
- package/dist/loop/test-utils/generateText.d.ts.map +1 -1
- package/dist/loop/test-utils/options.d.ts.map +1 -1
- package/dist/loop/test-utils/resultObject.d.ts.map +1 -1
- package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
- package/dist/loop/test-utils/toUIMessageStream.d.ts.map +1 -1
- package/dist/loop/test-utils/tools.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/index.d.ts +99 -0
- package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +66 -0
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +33 -0
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-loop/index.d.ts +99 -0
- package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
- package/dist/loop/workflows/run-state.d.ts +5 -0
- package/dist/loop/workflows/run-state.d.ts.map +1 -1
- package/dist/loop/workflows/schema.d.ts +38 -0
- package/dist/loop/workflows/schema.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.js +1 -1
- package/dist/network/vNext/index.cjs +30 -30
- package/dist/network/vNext/index.cjs.map +1 -1
- package/dist/network/vNext/index.js +3 -3
- package/dist/network/vNext/index.js.map +1 -1
- package/dist/processors/index.cjs +10 -10
- package/dist/processors/index.js +1 -1
- package/dist/processors/processors/language-detector.d.ts.map +1 -1
- package/dist/processors/processors/moderation.d.ts.map +1 -1
- package/dist/processors/processors/pii-detector.d.ts.map +1 -1
- package/dist/processors/processors/prompt-injection-detector.d.ts.map +1 -1
- package/dist/processors/processors/structured-output.d.ts.map +1 -1
- package/dist/processors/processors/system-prompt-scrubber.d.ts.map +1 -1
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.js +1 -1
- package/dist/scores/index.cjs +9 -9
- package/dist/scores/index.js +2 -2
- package/dist/scores/scoreTraces/index.cjs +57 -68
- package/dist/scores/scoreTraces/index.cjs.map +1 -1
- package/dist/scores/scoreTraces/index.js +48 -59
- package/dist/scores/scoreTraces/index.js.map +1 -1
- package/dist/scores/scoreTraces/scoreTracesWorkflow.d.ts.map +1 -1
- package/dist/scores/scoreTraces/utils.d.ts +4 -8
- package/dist/scores/scoreTraces/utils.d.ts.map +1 -1
- package/dist/scores/types.d.ts +8 -4
- package/dist/scores/types.d.ts.map +1 -1
- package/dist/server/index.cjs +7 -7
- package/dist/server/index.js +2 -2
- package/dist/storage/base.d.ts +14 -5
- package/dist/storage/base.d.ts.map +1 -1
- package/dist/storage/constants.d.ts.map +1 -1
- package/dist/storage/domains/observability/base.d.ts +5 -5
- package/dist/storage/domains/observability/base.d.ts.map +1 -1
- package/dist/storage/domains/observability/inmemory.d.ts +7 -7
- package/dist/storage/domains/observability/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/scores/base.d.ts +8 -0
- package/dist/storage/domains/scores/base.d.ts.map +1 -1
- package/dist/storage/domains/scores/inmemory.d.ts +8 -0
- package/dist/storage/domains/scores/inmemory.d.ts.map +1 -1
- package/dist/storage/index.cjs +94 -64
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.js +59 -29
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/mock.d.ts +9 -0
- package/dist/storage/mock.d.ts.map +1 -1
- package/dist/storage/types.d.ts +2 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/stream/MastraWorkflowStream.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/input.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/output.d.ts +7 -0
- package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
- package/dist/stream/base/output.d.ts.map +1 -1
- package/dist/stream/index.cjs +4 -4
- package/dist/stream/index.js +1 -1
- package/dist/stream/types.d.ts +12 -12
- package/dist/stream/types.d.ts.map +1 -1
- package/dist/telemetry/index.cjs +7 -7
- package/dist/telemetry/index.js +1 -1
- package/dist/test-utils/llm-mock.cjs +2 -2
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tools/index.cjs +4 -4
- package/dist/tools/index.js +1 -1
- package/dist/tools/is-vercel-tool.cjs +2 -2
- package/dist/tools/is-vercel-tool.js +1 -1
- package/dist/tools/tool.d.ts +2 -4
- package/dist/tools/tool.d.ts.map +1 -1
- package/dist/tools/types.d.ts +1 -1
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.js +1 -1
- package/dist/{types.d.ts → types/dynamic-argument.d.ts} +3 -3
- package/dist/types/dynamic-argument.d.ts.map +1 -0
- package/dist/types/index.cjs +4 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils.cjs +17 -17
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +4 -4
- package/dist/vector/index.js +1 -1
- package/dist/voice/index.cjs +4 -4
- package/dist/voice/index.js +1 -1
- package/dist/workflows/default.d.ts.map +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +12 -12
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/legacy/index.cjs +22 -22
- package/dist/workflows/legacy/index.js +1 -1
- package/dist/workflows/types.d.ts +11 -1
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/workflow.d.ts +6 -3
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/package.json +4 -4
- package/types.d.ts +1 -0
- package/dist/chunk-4PK4GBYZ.cjs.map +0 -1
- package/dist/chunk-5ZMC3NEO.js.map +0 -1
- package/dist/chunk-6ZVNL435.js.map +0 -1
- package/dist/chunk-73S2WYSD.cjs.map +0 -1
- package/dist/chunk-7UEBC5KM.cjs.map +0 -1
- package/dist/chunk-C73WLCY3.cjs.map +0 -1
- package/dist/chunk-CE73R5W7.js +0 -3
- package/dist/chunk-ITD7IHN5.js.map +0 -1
- package/dist/chunk-MCOVMKIS.js.map +0 -1
- package/dist/chunk-NG2XDPDY.js.map +0 -1
- package/dist/chunk-O6PQYYT6.cjs.map +0 -1
- package/dist/chunk-QUB6MWXZ.cjs.map +0 -1
- package/dist/chunk-R5GESRGB.js.map +0 -1
- package/dist/chunk-VBPPPQO3.cjs +0 -4
- package/dist/chunk-XUAWHRUO.cjs.map +0 -1
- package/dist/chunk-XWJWU5OM.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
|
@@ -0,0 +1,1379 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/llm/model/provider-registry.generated.ts
|
|
4
|
+
var PROVIDER_REGISTRY = {
|
|
5
|
+
"moonshotai-cn": {
|
|
6
|
+
url: "https://api.moonshot.cn/v1/chat/completions",
|
|
7
|
+
apiKeyEnvVar: "MOONSHOT_API_KEY",
|
|
8
|
+
apiKeyHeader: "Authorization",
|
|
9
|
+
name: "Moonshot AI (China)",
|
|
10
|
+
models: ["kimi-k2-0711-preview", "kimi-k2-0905-preview", "kimi-k2-turbo-preview"],
|
|
11
|
+
docUrl: "https://platform.moonshot.cn/docs/api/chat"
|
|
12
|
+
},
|
|
13
|
+
lucidquery: {
|
|
14
|
+
url: "https://lucidquery.com/api/v1/chat/completions",
|
|
15
|
+
apiKeyEnvVar: "LUCIDQUERY_API_KEY",
|
|
16
|
+
apiKeyHeader: "Authorization",
|
|
17
|
+
name: "LucidQuery AI",
|
|
18
|
+
models: ["lucidnova-rf1-100b", "lucidquery-nexus-coder"],
|
|
19
|
+
docUrl: "https://lucidquery.com/api/docs"
|
|
20
|
+
},
|
|
21
|
+
moonshotai: {
|
|
22
|
+
url: "https://api.moonshot.ai/v1/chat/completions",
|
|
23
|
+
apiKeyEnvVar: "MOONSHOT_API_KEY",
|
|
24
|
+
apiKeyHeader: "Authorization",
|
|
25
|
+
name: "Moonshot AI",
|
|
26
|
+
models: ["kimi-k2-0711-preview", "kimi-k2-0905-preview", "kimi-k2-turbo-preview"],
|
|
27
|
+
docUrl: "https://platform.moonshot.ai/docs/api/chat"
|
|
28
|
+
},
|
|
29
|
+
"zai-coding-plan": {
|
|
30
|
+
url: "https://api.z.ai/api/coding/paas/v4/chat/completions",
|
|
31
|
+
apiKeyEnvVar: "ZHIPU_API_KEY",
|
|
32
|
+
apiKeyHeader: "Authorization",
|
|
33
|
+
name: "Z.AI Coding Plan",
|
|
34
|
+
models: ["glm-4.5", "glm-4.5-air", "glm-4.5-flash", "glm-4.5v", "glm-4.6"],
|
|
35
|
+
docUrl: "https://docs.z.ai/devpack/overview"
|
|
36
|
+
},
|
|
37
|
+
alibaba: {
|
|
38
|
+
url: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions",
|
|
39
|
+
apiKeyEnvVar: "DASHSCOPE_API_KEY",
|
|
40
|
+
apiKeyHeader: "Authorization",
|
|
41
|
+
name: "Alibaba",
|
|
42
|
+
models: ["qwen3-coder-plus"],
|
|
43
|
+
docUrl: "https://www.alibabacloud.com/help/en/model-studio/models"
|
|
44
|
+
},
|
|
45
|
+
xai: {
|
|
46
|
+
url: "https://api.x.ai/v1/chat/completions",
|
|
47
|
+
apiKeyEnvVar: "XAI_API_KEY",
|
|
48
|
+
apiKeyHeader: "Authorization",
|
|
49
|
+
name: "xAI",
|
|
50
|
+
models: [
|
|
51
|
+
"grok-2",
|
|
52
|
+
"grok-2-1212",
|
|
53
|
+
"grok-2-latest",
|
|
54
|
+
"grok-2-vision",
|
|
55
|
+
"grok-2-vision-1212",
|
|
56
|
+
"grok-2-vision-latest",
|
|
57
|
+
"grok-3",
|
|
58
|
+
"grok-3-fast",
|
|
59
|
+
"grok-3-fast-latest",
|
|
60
|
+
"grok-3-latest",
|
|
61
|
+
"grok-3-mini",
|
|
62
|
+
"grok-3-mini-fast",
|
|
63
|
+
"grok-3-mini-fast-latest",
|
|
64
|
+
"grok-3-mini-latest",
|
|
65
|
+
"grok-4",
|
|
66
|
+
"grok-4-fast",
|
|
67
|
+
"grok-4-fast-non-reasoning",
|
|
68
|
+
"grok-beta",
|
|
69
|
+
"grok-code-fast-1",
|
|
70
|
+
"grok-vision-beta"
|
|
71
|
+
],
|
|
72
|
+
docUrl: "https://docs.x.ai/docs/models"
|
|
73
|
+
},
|
|
74
|
+
nvidia: {
|
|
75
|
+
url: "https://integrate.api.nvidia.com/v1/chat/completions",
|
|
76
|
+
apiKeyEnvVar: "NVIDIA_API_KEY",
|
|
77
|
+
apiKeyHeader: "Authorization",
|
|
78
|
+
name: "Nvidia",
|
|
79
|
+
models: [
|
|
80
|
+
"black-forest-labs/flux.1-dev",
|
|
81
|
+
"deepseek-ai/deepseek-v3.1",
|
|
82
|
+
"google/gemma-3-27b-it",
|
|
83
|
+
"microsoft/phi-4-mini-instruct",
|
|
84
|
+
"moonshotai/kimi-k2-instruct",
|
|
85
|
+
"nvidia/cosmos-nemotron-34b",
|
|
86
|
+
"nvidia/llama-3.1-nemotron-ultra-253b-v1",
|
|
87
|
+
"nvidia/nemoretriever-ocr-v1",
|
|
88
|
+
"nvidia/parakeet-tdt-0.6b-v2",
|
|
89
|
+
"openai/gpt-oss-120b",
|
|
90
|
+
"openai/whisper-large-v3",
|
|
91
|
+
"qwen/qwen3-235b-a22b",
|
|
92
|
+
"qwen/qwen3-coder-480b-a35b-instruct"
|
|
93
|
+
],
|
|
94
|
+
docUrl: "https://docs.api.nvidia.com/nim/"
|
|
95
|
+
},
|
|
96
|
+
upstage: {
|
|
97
|
+
url: "https://api.upstage.ai/chat/completions",
|
|
98
|
+
apiKeyEnvVar: "UPSTAGE_API_KEY",
|
|
99
|
+
apiKeyHeader: "Authorization",
|
|
100
|
+
name: "Upstage",
|
|
101
|
+
models: ["solar-mini", "solar-pro2"],
|
|
102
|
+
docUrl: "https://developers.upstage.ai/docs/apis/chat"
|
|
103
|
+
},
|
|
104
|
+
groq: {
|
|
105
|
+
url: "https://api.groq.com/openai/v1/chat/completions",
|
|
106
|
+
apiKeyEnvVar: "GROQ_API_KEY",
|
|
107
|
+
apiKeyHeader: "Authorization",
|
|
108
|
+
name: "Groq",
|
|
109
|
+
models: [
|
|
110
|
+
"deepseek-r1-distill-llama-70b",
|
|
111
|
+
"gemma2-9b-it",
|
|
112
|
+
"llama-3.1-8b-instant",
|
|
113
|
+
"llama-3.3-70b-versatile",
|
|
114
|
+
"llama-guard-3-8b",
|
|
115
|
+
"llama3-70b-8192",
|
|
116
|
+
"llama3-8b-8192",
|
|
117
|
+
"meta-llama/llama-4-maverick-17b-128e-instruct",
|
|
118
|
+
"meta-llama/llama-4-scout-17b-16e-instruct",
|
|
119
|
+
"meta-llama/llama-guard-4-12b",
|
|
120
|
+
"mistral-saba-24b",
|
|
121
|
+
"moonshotai/kimi-k2-instruct",
|
|
122
|
+
"moonshotai/kimi-k2-instruct-0905",
|
|
123
|
+
"openai/gpt-oss-120b",
|
|
124
|
+
"openai/gpt-oss-20b",
|
|
125
|
+
"qwen-qwq-32b",
|
|
126
|
+
"qwen/qwen3-32b"
|
|
127
|
+
],
|
|
128
|
+
docUrl: "https://console.groq.com/docs/models"
|
|
129
|
+
},
|
|
130
|
+
"github-copilot": {
|
|
131
|
+
url: "https://api.githubcopilot.com/chat/completions",
|
|
132
|
+
apiKeyEnvVar: "GITHUB_TOKEN",
|
|
133
|
+
apiKeyHeader: "Authorization",
|
|
134
|
+
name: "GitHub Copilot",
|
|
135
|
+
models: [
|
|
136
|
+
"claude-3.5-sonnet",
|
|
137
|
+
"claude-3.7-sonnet",
|
|
138
|
+
"claude-3.7-sonnet-thought",
|
|
139
|
+
"claude-opus-4",
|
|
140
|
+
"claude-opus-41",
|
|
141
|
+
"claude-sonnet-4",
|
|
142
|
+
"claude-sonnet-4.5",
|
|
143
|
+
"gemini-2.0-flash-001",
|
|
144
|
+
"gemini-2.5-pro",
|
|
145
|
+
"gpt-4.1",
|
|
146
|
+
"gpt-4o",
|
|
147
|
+
"gpt-5",
|
|
148
|
+
"gpt-5-codex",
|
|
149
|
+
"gpt-5-mini",
|
|
150
|
+
"grok-code-fast-1",
|
|
151
|
+
"o3",
|
|
152
|
+
"o3-mini",
|
|
153
|
+
"o4-mini"
|
|
154
|
+
],
|
|
155
|
+
docUrl: "https://docs.github.com/en/copilot"
|
|
156
|
+
},
|
|
157
|
+
mistral: {
|
|
158
|
+
url: "https://api.mistral.ai/v1/chat/completions",
|
|
159
|
+
apiKeyEnvVar: "MISTRAL_API_KEY",
|
|
160
|
+
apiKeyHeader: "Authorization",
|
|
161
|
+
name: "Mistral",
|
|
162
|
+
models: [
|
|
163
|
+
"codestral-latest",
|
|
164
|
+
"devstral-medium-2507",
|
|
165
|
+
"devstral-small-2505",
|
|
166
|
+
"devstral-small-2507",
|
|
167
|
+
"magistral-medium-latest",
|
|
168
|
+
"magistral-small",
|
|
169
|
+
"ministral-3b-latest",
|
|
170
|
+
"ministral-8b-latest",
|
|
171
|
+
"mistral-large-latest",
|
|
172
|
+
"mistral-medium-2505",
|
|
173
|
+
"mistral-medium-2508",
|
|
174
|
+
"mistral-medium-latest",
|
|
175
|
+
"mistral-nemo",
|
|
176
|
+
"mistral-small-latest",
|
|
177
|
+
"open-mistral-7b",
|
|
178
|
+
"open-mixtral-8x22b",
|
|
179
|
+
"open-mixtral-8x7b",
|
|
180
|
+
"pixtral-12b",
|
|
181
|
+
"pixtral-large-latest"
|
|
182
|
+
],
|
|
183
|
+
docUrl: "https://docs.mistral.ai/getting-started/models/"
|
|
184
|
+
},
|
|
185
|
+
vercel: {
|
|
186
|
+
url: "https://ai-gateway.vercel.sh/v1/chat/completions",
|
|
187
|
+
apiKeyEnvVar: "AI_GATEWAY_API_KEY",
|
|
188
|
+
apiKeyHeader: "Authorization",
|
|
189
|
+
name: "Vercel AI Gateway",
|
|
190
|
+
models: [
|
|
191
|
+
"amazon/nova-lite",
|
|
192
|
+
"amazon/nova-micro",
|
|
193
|
+
"amazon/nova-pro",
|
|
194
|
+
"anthropic/claude-3-5-haiku",
|
|
195
|
+
"anthropic/claude-3-haiku",
|
|
196
|
+
"anthropic/claude-3-opus",
|
|
197
|
+
"anthropic/claude-3.5-sonnet",
|
|
198
|
+
"anthropic/claude-3.7-sonnet",
|
|
199
|
+
"anthropic/claude-4-1-opus",
|
|
200
|
+
"anthropic/claude-4-opus",
|
|
201
|
+
"anthropic/claude-4-sonnet",
|
|
202
|
+
"anthropic/claude-4.5-sonnet",
|
|
203
|
+
"cerebras/qwen3-coder",
|
|
204
|
+
"deepseek/deepseek-r1",
|
|
205
|
+
"deepseek/deepseek-r1-distill-llama-70b",
|
|
206
|
+
"google/gemini-2.0-flash",
|
|
207
|
+
"google/gemini-2.0-flash-lite",
|
|
208
|
+
"google/gemini-2.5-flash",
|
|
209
|
+
"google/gemini-2.5-pro",
|
|
210
|
+
"meta/llama-3.3-70b",
|
|
211
|
+
"meta/llama-4-maverick",
|
|
212
|
+
"meta/llama-4-scout",
|
|
213
|
+
"mistral/codestral",
|
|
214
|
+
"mistral/magistral-medium",
|
|
215
|
+
"mistral/magistral-small",
|
|
216
|
+
"mistral/ministral-3b",
|
|
217
|
+
"mistral/ministral-8b",
|
|
218
|
+
"mistral/mistral-large",
|
|
219
|
+
"mistral/mistral-small",
|
|
220
|
+
"mistral/mixtral-8x22b-instruct",
|
|
221
|
+
"mistral/pixtral-12b",
|
|
222
|
+
"mistral/pixtral-large",
|
|
223
|
+
"moonshotai/kimi-k2",
|
|
224
|
+
"morph/morph-v3-fast",
|
|
225
|
+
"morph/morph-v3-large",
|
|
226
|
+
"openai/gpt-4-turbo",
|
|
227
|
+
"openai/gpt-4.1",
|
|
228
|
+
"openai/gpt-4.1-mini",
|
|
229
|
+
"openai/gpt-4.1-nano",
|
|
230
|
+
"openai/gpt-4o",
|
|
231
|
+
"openai/gpt-4o-mini",
|
|
232
|
+
"openai/gpt-5",
|
|
233
|
+
"openai/gpt-5-codex",
|
|
234
|
+
"openai/gpt-5-mini",
|
|
235
|
+
"openai/gpt-5-nano",
|
|
236
|
+
"openai/gpt-oss-120b",
|
|
237
|
+
"openai/gpt-oss-20b",
|
|
238
|
+
"openai/o1",
|
|
239
|
+
"openai/o3",
|
|
240
|
+
"openai/o3-mini",
|
|
241
|
+
"openai/o4-mini",
|
|
242
|
+
"vercel/v0-1.0-md",
|
|
243
|
+
"vercel/v0-1.5-md",
|
|
244
|
+
"xai/grok-2",
|
|
245
|
+
"xai/grok-2-vision",
|
|
246
|
+
"xai/grok-3",
|
|
247
|
+
"xai/grok-3-fast",
|
|
248
|
+
"xai/grok-3-mini",
|
|
249
|
+
"xai/grok-3-mini-fast",
|
|
250
|
+
"xai/grok-4",
|
|
251
|
+
"xai/grok-4-fast",
|
|
252
|
+
"xai/grok-4-fast-non-reasoning",
|
|
253
|
+
"xai/grok-code-fast-1"
|
|
254
|
+
],
|
|
255
|
+
docUrl: "https://github.com/vercel/ai/tree/5eb85cc45a259553501f535b8ac79a77d0e79223/packages/gateway"
|
|
256
|
+
},
|
|
257
|
+
deepseek: {
|
|
258
|
+
url: "https://api.deepseek.com/chat/completions",
|
|
259
|
+
apiKeyEnvVar: "DEEPSEEK_API_KEY",
|
|
260
|
+
apiKeyHeader: "Authorization",
|
|
261
|
+
name: "DeepSeek",
|
|
262
|
+
models: ["deepseek-chat", "deepseek-reasoner"],
|
|
263
|
+
docUrl: "https://platform.deepseek.com/api-docs/pricing"
|
|
264
|
+
},
|
|
265
|
+
"alibaba-cn": {
|
|
266
|
+
url: "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",
|
|
267
|
+
apiKeyEnvVar: "DASHSCOPE_API_KEY",
|
|
268
|
+
apiKeyHeader: "Authorization",
|
|
269
|
+
name: "Alibaba (China)",
|
|
270
|
+
models: ["qwen3-coder-plus"],
|
|
271
|
+
docUrl: "https://www.alibabacloud.com/help/en/model-studio/models"
|
|
272
|
+
},
|
|
273
|
+
venice: {
|
|
274
|
+
url: "https://api.venice.ai/api/v1/chat/completions",
|
|
275
|
+
apiKeyEnvVar: "VENICE_API_KEY",
|
|
276
|
+
apiKeyHeader: "Authorization",
|
|
277
|
+
name: "Venice AI",
|
|
278
|
+
models: [
|
|
279
|
+
"deepseek-coder-v2-lite",
|
|
280
|
+
"deepseek-r1-671b",
|
|
281
|
+
"dolphin-2.9.2-qwen2-72b",
|
|
282
|
+
"llama-3.1-405b",
|
|
283
|
+
"llama-3.2-3b",
|
|
284
|
+
"llama-3.3-70b",
|
|
285
|
+
"mistral-31-24b",
|
|
286
|
+
"qwen-2.5-coder-32b",
|
|
287
|
+
"qwen-2.5-qwq-32b",
|
|
288
|
+
"qwen-2.5-vl",
|
|
289
|
+
"qwen3-235b",
|
|
290
|
+
"qwen3-4b",
|
|
291
|
+
"venice-uncensored"
|
|
292
|
+
],
|
|
293
|
+
docUrl: "https://docs.venice.ai"
|
|
294
|
+
},
|
|
295
|
+
chutes: {
|
|
296
|
+
url: "https://llm.chutes.ai/v1/chat/completions",
|
|
297
|
+
apiKeyEnvVar: "CHUTES_API_KEY",
|
|
298
|
+
apiKeyHeader: "Authorization",
|
|
299
|
+
name: "Chutes",
|
|
300
|
+
models: [
|
|
301
|
+
"Qwen/Qwen3-235B-A22B-Instruct-2507",
|
|
302
|
+
"Qwen/Qwen3-235B-A22B-Thinking-2507",
|
|
303
|
+
"Qwen/Qwen3-30B-A3B",
|
|
304
|
+
"Qwen/Qwen3-30B-A3B-Instruct-2507",
|
|
305
|
+
"Qwen/Qwen3-30B-A3B-Thinking-2507",
|
|
306
|
+
"Qwen/Qwen3-Coder-30B-A3B-Instruct",
|
|
307
|
+
"Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8",
|
|
308
|
+
"Qwen/Qwen3-Next-80B-A3B-Instruct",
|
|
309
|
+
"Qwen/Qwen3-Next-80B-A3B-Thinking",
|
|
310
|
+
"chutesai/Devstral-Small-2505",
|
|
311
|
+
"chutesai/Mistral-Small-3.2-24B-Instruct-2506",
|
|
312
|
+
"deepseek-ai/DeepSeek-R1-0528",
|
|
313
|
+
"deepseek-ai/DeepSeek-R1-0528-Qwen3-8B",
|
|
314
|
+
"deepseek-ai/DeepSeek-R1-Distill-Llama-70B",
|
|
315
|
+
"deepseek-ai/DeepSeek-V3-0324",
|
|
316
|
+
"deepseek-ai/DeepSeek-V3.1",
|
|
317
|
+
"deepseek-ai/DeepSeek-V3.1-Terminus",
|
|
318
|
+
"deepseek-ai/DeepSeek-V3.1-turbo",
|
|
319
|
+
"deepseek-ai/DeepSeek-V3.1:THINKING",
|
|
320
|
+
"meituan-longcat/LongCat-Flash-Chat-FP8",
|
|
321
|
+
"moonshotai/Kimi-Dev-72B",
|
|
322
|
+
"moonshotai/Kimi-K2-Instruct-0905",
|
|
323
|
+
"moonshotai/Kimi-K2-Instruct-75k",
|
|
324
|
+
"moonshotai/Kimi-VL-A3B-Thinking",
|
|
325
|
+
"openai/gpt-oss-120b",
|
|
326
|
+
"tngtech/DeepSeek-R1T-Chimera",
|
|
327
|
+
"tngtech/DeepSeek-TNG-R1T2-Chimera",
|
|
328
|
+
"zai-org/GLM-4.5-Air",
|
|
329
|
+
"zai-org/GLM-4.5-FP8",
|
|
330
|
+
"zai-org/GLM-4.5-turbo"
|
|
331
|
+
],
|
|
332
|
+
docUrl: "https://llm.chutes.ai/v1/models"
|
|
333
|
+
},
|
|
334
|
+
cortecs: {
|
|
335
|
+
url: "https://api.cortecs.ai/v1/chat/completions",
|
|
336
|
+
apiKeyEnvVar: "CORTECS_API_KEY",
|
|
337
|
+
apiKeyHeader: "Authorization",
|
|
338
|
+
name: "Cortecs",
|
|
339
|
+
models: [
|
|
340
|
+
"claude-sonnet-4",
|
|
341
|
+
"deepseek-v3-0324",
|
|
342
|
+
"gemini-2.5-pro",
|
|
343
|
+
"gpt-4.1",
|
|
344
|
+
"gpt-oss-120b",
|
|
345
|
+
"kimi-k2-instruct",
|
|
346
|
+
"llama-3.1-405b-instruct",
|
|
347
|
+
"nova-pro-v1",
|
|
348
|
+
"qwen3-32b",
|
|
349
|
+
"qwen3-coder-480b-a35b-instruct"
|
|
350
|
+
],
|
|
351
|
+
docUrl: "https://api.cortecs.ai/v1/models"
|
|
352
|
+
},
|
|
353
|
+
"github-models": {
|
|
354
|
+
url: "https://models.github.ai/inference/chat/completions",
|
|
355
|
+
apiKeyEnvVar: "GITHUB_TOKEN",
|
|
356
|
+
apiKeyHeader: "Authorization",
|
|
357
|
+
name: "GitHub Models",
|
|
358
|
+
models: [
|
|
359
|
+
"ai21-labs/ai21-jamba-1.5-large",
|
|
360
|
+
"ai21-labs/ai21-jamba-1.5-mini",
|
|
361
|
+
"cohere/cohere-command-a",
|
|
362
|
+
"cohere/cohere-command-r",
|
|
363
|
+
"cohere/cohere-command-r-08-2024",
|
|
364
|
+
"cohere/cohere-command-r-plus",
|
|
365
|
+
"cohere/cohere-command-r-plus-08-2024",
|
|
366
|
+
"core42/jais-30b-chat",
|
|
367
|
+
"deepseek/deepseek-r1",
|
|
368
|
+
"deepseek/deepseek-r1-0528",
|
|
369
|
+
"deepseek/deepseek-v3-0324",
|
|
370
|
+
"meta/llama-3.2-11b-vision-instruct",
|
|
371
|
+
"meta/llama-3.2-90b-vision-instruct",
|
|
372
|
+
"meta/llama-3.3-70b-instruct",
|
|
373
|
+
"meta/llama-4-maverick-17b-128e-instruct-fp8",
|
|
374
|
+
"meta/llama-4-scout-17b-16e-instruct",
|
|
375
|
+
"meta/meta-llama-3-70b-instruct",
|
|
376
|
+
"meta/meta-llama-3-8b-instruct",
|
|
377
|
+
"meta/meta-llama-3.1-405b-instruct",
|
|
378
|
+
"meta/meta-llama-3.1-70b-instruct",
|
|
379
|
+
"meta/meta-llama-3.1-8b-instruct",
|
|
380
|
+
"microsoft/mai-ds-r1",
|
|
381
|
+
"microsoft/phi-3-medium-128k-instruct",
|
|
382
|
+
"microsoft/phi-3-medium-4k-instruct",
|
|
383
|
+
"microsoft/phi-3-mini-128k-instruct",
|
|
384
|
+
"microsoft/phi-3-mini-4k-instruct",
|
|
385
|
+
"microsoft/phi-3-small-128k-instruct",
|
|
386
|
+
"microsoft/phi-3-small-8k-instruct",
|
|
387
|
+
"microsoft/phi-3.5-mini-instruct",
|
|
388
|
+
"microsoft/phi-3.5-moe-instruct",
|
|
389
|
+
"microsoft/phi-3.5-vision-instruct",
|
|
390
|
+
"microsoft/phi-4",
|
|
391
|
+
"microsoft/phi-4-mini-instruct",
|
|
392
|
+
"microsoft/phi-4-mini-reasoning",
|
|
393
|
+
"microsoft/phi-4-multimodal-instruct",
|
|
394
|
+
"microsoft/phi-4-reasoning",
|
|
395
|
+
"mistral-ai/codestral-2501",
|
|
396
|
+
"mistral-ai/ministral-3b",
|
|
397
|
+
"mistral-ai/mistral-large-2411",
|
|
398
|
+
"mistral-ai/mistral-medium-2505",
|
|
399
|
+
"mistral-ai/mistral-nemo",
|
|
400
|
+
"mistral-ai/mistral-small-2503",
|
|
401
|
+
"openai/gpt-4.1",
|
|
402
|
+
"openai/gpt-4.1-mini",
|
|
403
|
+
"openai/gpt-4.1-nano",
|
|
404
|
+
"openai/gpt-4o",
|
|
405
|
+
"openai/gpt-4o-mini",
|
|
406
|
+
"openai/o1",
|
|
407
|
+
"openai/o1-mini",
|
|
408
|
+
"openai/o1-preview",
|
|
409
|
+
"openai/o3",
|
|
410
|
+
"openai/o3-mini",
|
|
411
|
+
"openai/o4-mini",
|
|
412
|
+
"xai/grok-3",
|
|
413
|
+
"xai/grok-3-mini"
|
|
414
|
+
],
|
|
415
|
+
docUrl: "https://docs.github.com/en/github-models"
|
|
416
|
+
},
|
|
417
|
+
togetherai: {
|
|
418
|
+
url: "https://api.together.xyz/v1/chat/completions",
|
|
419
|
+
apiKeyEnvVar: "TOGETHER_API_KEY",
|
|
420
|
+
apiKeyHeader: "Authorization",
|
|
421
|
+
name: "Together AI",
|
|
422
|
+
models: [
|
|
423
|
+
"Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8",
|
|
424
|
+
"deepseek-ai/DeepSeek-R1",
|
|
425
|
+
"deepseek-ai/DeepSeek-V3",
|
|
426
|
+
"meta-llama/Llama-3.3-70B-Instruct-Turbo",
|
|
427
|
+
"moonshotai/Kimi-K2-Instruct",
|
|
428
|
+
"openai/gpt-oss-120b"
|
|
429
|
+
],
|
|
430
|
+
docUrl: "https://docs.together.ai/docs/serverless-models"
|
|
431
|
+
},
|
|
432
|
+
baseten: {
|
|
433
|
+
url: "https://inference.baseten.co/v1/chat/completions",
|
|
434
|
+
apiKeyEnvVar: "BASETEN_API_KEY",
|
|
435
|
+
apiKeyHeader: "Authorization",
|
|
436
|
+
name: "Baseten",
|
|
437
|
+
models: ["Qwen3/Qwen3-Coder-480B-A35B-Instruct", "moonshotai/Kimi-K2-Instruct-0905"],
|
|
438
|
+
docUrl: "https://docs.baseten.co/development/model-apis/overview"
|
|
439
|
+
},
|
|
440
|
+
huggingface: {
|
|
441
|
+
url: "https://router.huggingface.co/v1/chat/completions",
|
|
442
|
+
apiKeyEnvVar: "HF_TOKEN",
|
|
443
|
+
apiKeyHeader: "Authorization",
|
|
444
|
+
name: "Hugging Face",
|
|
445
|
+
models: [
|
|
446
|
+
"Qwen/Qwen3-235B-A22B-Thinking-2507",
|
|
447
|
+
"Qwen/Qwen3-Coder-480B-A35B-Instruct",
|
|
448
|
+
"Qwen/Qwen3-Next-80B-A3B-Instruct",
|
|
449
|
+
"Qwen/Qwen3-Next-80B-A3B-Thinking",
|
|
450
|
+
"deepseek-ai/DeepSeek-R1-0528",
|
|
451
|
+
"deepseek-ai/Deepseek-V3-0324",
|
|
452
|
+
"moonshotai/Kimi-K2-Instruct",
|
|
453
|
+
"moonshotai/Kimi-K2-Instruct-0905",
|
|
454
|
+
"zai-org/GLM-4.5",
|
|
455
|
+
"zai-org/GLM-4.5-Air"
|
|
456
|
+
],
|
|
457
|
+
docUrl: "https://huggingface.co/docs/inference-providers"
|
|
458
|
+
},
|
|
459
|
+
opencode: {
|
|
460
|
+
url: "https://opencode.ai/zen/v1/chat/completions",
|
|
461
|
+
apiKeyEnvVar: "OPENCODE_API_KEY",
|
|
462
|
+
apiKeyHeader: "Authorization",
|
|
463
|
+
name: "opencode zen",
|
|
464
|
+
models: [
|
|
465
|
+
"claude-3-5-haiku",
|
|
466
|
+
"claude-opus-4-1",
|
|
467
|
+
"claude-sonnet-4",
|
|
468
|
+
"claude-sonnet-4-5",
|
|
469
|
+
"code-supernova",
|
|
470
|
+
"gpt-5",
|
|
471
|
+
"gpt-5-codex",
|
|
472
|
+
"grok-code",
|
|
473
|
+
"kimi-k2",
|
|
474
|
+
"qwen3-coder",
|
|
475
|
+
"qwen3-max"
|
|
476
|
+
],
|
|
477
|
+
docUrl: "https://opencode.ai/docs"
|
|
478
|
+
},
|
|
479
|
+
fastrouter: {
|
|
480
|
+
url: "https://go.fastrouter.ai/api/v1/chat/completions",
|
|
481
|
+
apiKeyEnvVar: "FASTROUTER_API_KEY",
|
|
482
|
+
apiKeyHeader: "Authorization",
|
|
483
|
+
name: "FastRouter",
|
|
484
|
+
models: [
|
|
485
|
+
"anthropic/claude-opus-4.1",
|
|
486
|
+
"anthropic/claude-sonnet-4",
|
|
487
|
+
"deepseek-ai/deepseek-r1-distill-llama-70b",
|
|
488
|
+
"google/gemini-2.5-flash",
|
|
489
|
+
"google/gemini-2.5-pro",
|
|
490
|
+
"moonshotai/kimi-k2",
|
|
491
|
+
"openai/gpt-4.1",
|
|
492
|
+
"openai/gpt-5",
|
|
493
|
+
"openai/gpt-5-mini",
|
|
494
|
+
"openai/gpt-5-nano",
|
|
495
|
+
"openai/gpt-oss-120b",
|
|
496
|
+
"openai/gpt-oss-20b",
|
|
497
|
+
"qwen/qwen3-coder",
|
|
498
|
+
"x-ai/grok-4"
|
|
499
|
+
],
|
|
500
|
+
docUrl: "https://fastrouter.ai/models"
|
|
501
|
+
},
|
|
502
|
+
google: {
|
|
503
|
+
url: "https://generativelanguage.googleapis.com/v1beta/chat/completions",
|
|
504
|
+
apiKeyEnvVar: "GOOGLE_GENERATIVE_AI_API_KEY",
|
|
505
|
+
apiKeyHeader: "Authorization",
|
|
506
|
+
name: "Google",
|
|
507
|
+
models: [
|
|
508
|
+
"gemini-1.5-flash",
|
|
509
|
+
"gemini-1.5-flash-8b",
|
|
510
|
+
"gemini-1.5-pro",
|
|
511
|
+
"gemini-2.0-flash",
|
|
512
|
+
"gemini-2.0-flash-lite",
|
|
513
|
+
"gemini-2.5-flash",
|
|
514
|
+
"gemini-2.5-flash-lite",
|
|
515
|
+
"gemini-2.5-flash-lite-preview-06-17",
|
|
516
|
+
"gemini-2.5-flash-lite-preview-09-2025",
|
|
517
|
+
"gemini-2.5-flash-preview-04-17",
|
|
518
|
+
"gemini-2.5-flash-preview-05-20",
|
|
519
|
+
"gemini-2.5-flash-preview-09-2025",
|
|
520
|
+
"gemini-2.5-pro",
|
|
521
|
+
"gemini-2.5-pro-preview-05-06",
|
|
522
|
+
"gemini-2.5-pro-preview-06-05",
|
|
523
|
+
"gemini-flash-latest",
|
|
524
|
+
"gemini-flash-lite-latest",
|
|
525
|
+
"gemini-live-2.5-flash-preview-native-audio"
|
|
526
|
+
],
|
|
527
|
+
docUrl: "https://ai.google.dev/gemini-api/docs/pricing"
|
|
528
|
+
},
|
|
529
|
+
inception: {
|
|
530
|
+
url: "https://api.inceptionlabs.ai/v1/chat/completions",
|
|
531
|
+
apiKeyEnvVar: "INCEPTION_API_KEY",
|
|
532
|
+
apiKeyHeader: "Authorization",
|
|
533
|
+
name: "Inception",
|
|
534
|
+
models: ["mercury", "mercury-coder"],
|
|
535
|
+
docUrl: "https://platform.inceptionlabs.ai/docs"
|
|
536
|
+
},
|
|
537
|
+
wandb: {
|
|
538
|
+
url: "https://api.inference.wandb.ai/v1/chat/completions",
|
|
539
|
+
apiKeyEnvVar: "WANDB_API_KEY",
|
|
540
|
+
apiKeyHeader: "Authorization",
|
|
541
|
+
name: "Weights & Biases",
|
|
542
|
+
models: [
|
|
543
|
+
"Qwen/Qwen3-235B-A22B-Instruct-2507",
|
|
544
|
+
"Qwen/Qwen3-235B-A22B-Thinking-2507",
|
|
545
|
+
"Qwen/Qwen3-Coder-480B-A35B-Instruct",
|
|
546
|
+
"deepseek-ai/DeepSeek-R1-0528",
|
|
547
|
+
"deepseek-ai/DeepSeek-V3-0324",
|
|
548
|
+
"meta-llama/Llama-3.1-8B-Instruct",
|
|
549
|
+
"meta-llama/Llama-3.3-70B-Instruct",
|
|
550
|
+
"meta-llama/Llama-4-Scout-17B-16E-Instruct",
|
|
551
|
+
"microsoft/Phi-4-mini-instruct",
|
|
552
|
+
"moonshotai/Kimi-K2-Instruct"
|
|
553
|
+
],
|
|
554
|
+
docUrl: "https://weave-docs.wandb.ai/guides/integrations/inference/"
|
|
555
|
+
},
|
|
556
|
+
openai: {
|
|
557
|
+
url: "https://api.openai.com/v1/chat/completions",
|
|
558
|
+
apiKeyEnvVar: "OPENAI_API_KEY",
|
|
559
|
+
apiKeyHeader: "Authorization",
|
|
560
|
+
name: "OpenAI",
|
|
561
|
+
models: [
|
|
562
|
+
"codex-mini-latest",
|
|
563
|
+
"gpt-3.5-turbo",
|
|
564
|
+
"gpt-4",
|
|
565
|
+
"gpt-4-turbo",
|
|
566
|
+
"gpt-4.1",
|
|
567
|
+
"gpt-4.1-mini",
|
|
568
|
+
"gpt-4.1-nano",
|
|
569
|
+
"gpt-4o",
|
|
570
|
+
"gpt-4o-2024-05-13",
|
|
571
|
+
"gpt-4o-2024-08-06",
|
|
572
|
+
"gpt-4o-2024-11-20",
|
|
573
|
+
"gpt-4o-mini",
|
|
574
|
+
"gpt-5",
|
|
575
|
+
"gpt-5-chat-latest",
|
|
576
|
+
"gpt-5-codex",
|
|
577
|
+
"gpt-5-mini",
|
|
578
|
+
"gpt-5-nano",
|
|
579
|
+
"o1",
|
|
580
|
+
"o1-mini",
|
|
581
|
+
"o1-preview",
|
|
582
|
+
"o1-pro",
|
|
583
|
+
"o3",
|
|
584
|
+
"o3-deep-research",
|
|
585
|
+
"o3-mini",
|
|
586
|
+
"o3-pro",
|
|
587
|
+
"o4-mini",
|
|
588
|
+
"o4-mini-deep-research"
|
|
589
|
+
],
|
|
590
|
+
docUrl: "https://platform.openai.com/docs/models"
|
|
591
|
+
},
|
|
592
|
+
"zhipuai-coding-plan": {
|
|
593
|
+
url: "https://open.bigmodel.cn/api/coding/paas/v4/chat/completions",
|
|
594
|
+
apiKeyEnvVar: "ZHIPU_API_KEY",
|
|
595
|
+
apiKeyHeader: "Authorization",
|
|
596
|
+
name: "Zhipu AI Coding Plan",
|
|
597
|
+
models: ["glm-4.5", "glm-4.5-air", "glm-4.5-flash", "glm-4.5v", "glm-4.6"],
|
|
598
|
+
docUrl: "https://docs.bigmodel.cn/cn/coding-plan/overview"
|
|
599
|
+
},
|
|
600
|
+
perplexity: {
|
|
601
|
+
url: "https://api.perplexity.ai/chat/completions",
|
|
602
|
+
apiKeyEnvVar: "PERPLEXITY_API_KEY",
|
|
603
|
+
apiKeyHeader: "Authorization",
|
|
604
|
+
name: "Perplexity",
|
|
605
|
+
models: ["sonar", "sonar-pro", "sonar-reasoning", "sonar-reasoning-pro"],
|
|
606
|
+
docUrl: "https://docs.perplexity.ai"
|
|
607
|
+
},
|
|
608
|
+
openrouter: {
|
|
609
|
+
url: "https://openrouter.ai/api/v1/chat/completions",
|
|
610
|
+
apiKeyEnvVar: "OPENROUTER_API_KEY",
|
|
611
|
+
apiKeyHeader: "Authorization",
|
|
612
|
+
name: "OpenRouter",
|
|
613
|
+
models: [
|
|
614
|
+
"anthropic/claude-3.5-haiku",
|
|
615
|
+
"anthropic/claude-3.7-sonnet",
|
|
616
|
+
"anthropic/claude-opus-4",
|
|
617
|
+
"anthropic/claude-opus-4.1",
|
|
618
|
+
"anthropic/claude-sonnet-4",
|
|
619
|
+
"anthropic/claude-sonnet-4.5",
|
|
620
|
+
"cognitivecomputations/dolphin3.0-mistral-24b",
|
|
621
|
+
"cognitivecomputations/dolphin3.0-r1-mistral-24b",
|
|
622
|
+
"deepseek/deepseek-chat-v3-0324",
|
|
623
|
+
"deepseek/deepseek-chat-v3.1",
|
|
624
|
+
"deepseek/deepseek-r1-0528-qwen3-8b:free",
|
|
625
|
+
"deepseek/deepseek-r1-0528:free",
|
|
626
|
+
"deepseek/deepseek-r1-distill-llama-70b",
|
|
627
|
+
"deepseek/deepseek-r1-distill-qwen-14b",
|
|
628
|
+
"deepseek/deepseek-r1:free",
|
|
629
|
+
"deepseek/deepseek-v3-base:free",
|
|
630
|
+
"deepseek/deepseek-v3.1-terminus",
|
|
631
|
+
"featherless/qwerky-72b",
|
|
632
|
+
"google/gemini-2.0-flash-001",
|
|
633
|
+
"google/gemini-2.0-flash-exp:free",
|
|
634
|
+
"google/gemini-2.5-flash",
|
|
635
|
+
"google/gemini-2.5-pro",
|
|
636
|
+
"google/gemini-2.5-pro-preview-05-06",
|
|
637
|
+
"google/gemini-2.5-pro-preview-06-05",
|
|
638
|
+
"google/gemma-2-9b-it:free",
|
|
639
|
+
"google/gemma-3-12b-it",
|
|
640
|
+
"google/gemma-3-27b-it",
|
|
641
|
+
"google/gemma-3n-e4b-it",
|
|
642
|
+
"google/gemma-3n-e4b-it:free",
|
|
643
|
+
"meta-llama/llama-3.2-11b-vision-instruct",
|
|
644
|
+
"meta-llama/llama-3.3-70b-instruct:free",
|
|
645
|
+
"meta-llama/llama-4-scout:free",
|
|
646
|
+
"microsoft/mai-ds-r1:free",
|
|
647
|
+
"mistralai/codestral-2508",
|
|
648
|
+
"mistralai/devstral-medium-2507",
|
|
649
|
+
"mistralai/devstral-small-2505",
|
|
650
|
+
"mistralai/devstral-small-2505:free",
|
|
651
|
+
"mistralai/devstral-small-2507",
|
|
652
|
+
"mistralai/mistral-7b-instruct:free",
|
|
653
|
+
"mistralai/mistral-medium-3",
|
|
654
|
+
"mistralai/mistral-medium-3.1",
|
|
655
|
+
"mistralai/mistral-nemo:free",
|
|
656
|
+
"mistralai/mistral-small-3.1-24b-instruct",
|
|
657
|
+
"mistralai/mistral-small-3.2-24b-instruct",
|
|
658
|
+
"mistralai/mistral-small-3.2-24b-instruct:free",
|
|
659
|
+
"moonshotai/kimi-dev-72b:free",
|
|
660
|
+
"moonshotai/kimi-k2",
|
|
661
|
+
"moonshotai/kimi-k2-0905",
|
|
662
|
+
"moonshotai/kimi-k2:free",
|
|
663
|
+
"nousresearch/deephermes-3-llama-3-8b-preview",
|
|
664
|
+
"nousresearch/hermes-4-405b",
|
|
665
|
+
"nousresearch/hermes-4-70b",
|
|
666
|
+
"openai/gpt-4.1",
|
|
667
|
+
"openai/gpt-4.1-mini",
|
|
668
|
+
"openai/gpt-4o-mini",
|
|
669
|
+
"openai/gpt-5",
|
|
670
|
+
"openai/gpt-5-chat",
|
|
671
|
+
"openai/gpt-5-codex",
|
|
672
|
+
"openai/gpt-5-mini",
|
|
673
|
+
"openai/gpt-5-nano",
|
|
674
|
+
"openai/gpt-oss-120b",
|
|
675
|
+
"openai/gpt-oss-20b",
|
|
676
|
+
"openai/o4-mini",
|
|
677
|
+
"openrouter/cypher-alpha:free",
|
|
678
|
+
"openrouter/horizon-alpha",
|
|
679
|
+
"openrouter/horizon-beta",
|
|
680
|
+
"openrouter/sonoma-dusk-alpha",
|
|
681
|
+
"openrouter/sonoma-sky-alpha",
|
|
682
|
+
"qwen/qwen-2.5-coder-32b-instruct",
|
|
683
|
+
"qwen/qwen2.5-vl-32b-instruct:free",
|
|
684
|
+
"qwen/qwen2.5-vl-72b-instruct",
|
|
685
|
+
"qwen/qwen2.5-vl-72b-instruct:free",
|
|
686
|
+
"qwen/qwen3-14b:free",
|
|
687
|
+
"qwen/qwen3-235b-a22b-07-25",
|
|
688
|
+
"qwen/qwen3-235b-a22b-07-25:free",
|
|
689
|
+
"qwen/qwen3-235b-a22b-thinking-2507",
|
|
690
|
+
"qwen/qwen3-235b-a22b:free",
|
|
691
|
+
"qwen/qwen3-30b-a3b-instruct-2507",
|
|
692
|
+
"qwen/qwen3-30b-a3b:free",
|
|
693
|
+
"qwen/qwen3-32b:free",
|
|
694
|
+
"qwen/qwen3-8b:free",
|
|
695
|
+
"qwen/qwen3-coder",
|
|
696
|
+
"qwen/qwen3-coder:free",
|
|
697
|
+
"qwen/qwen3-max",
|
|
698
|
+
"qwen/qwen3-next-80b-a3b-instruct",
|
|
699
|
+
"qwen/qwq-32b:free",
|
|
700
|
+
"rekaai/reka-flash-3",
|
|
701
|
+
"sarvamai/sarvam-m:free",
|
|
702
|
+
"thudm/glm-z1-32b:free",
|
|
703
|
+
"tngtech/deepseek-r1t2-chimera:free",
|
|
704
|
+
"x-ai/grok-3",
|
|
705
|
+
"x-ai/grok-3-beta",
|
|
706
|
+
"x-ai/grok-3-mini",
|
|
707
|
+
"x-ai/grok-3-mini-beta",
|
|
708
|
+
"x-ai/grok-4",
|
|
709
|
+
"x-ai/grok-4-fast",
|
|
710
|
+
"x-ai/grok-4-fast:free",
|
|
711
|
+
"x-ai/grok-code-fast-1",
|
|
712
|
+
"z-ai/glm-4.5",
|
|
713
|
+
"z-ai/glm-4.5-air",
|
|
714
|
+
"z-ai/glm-4.5-air:free",
|
|
715
|
+
"z-ai/glm-4.5v"
|
|
716
|
+
],
|
|
717
|
+
docUrl: "https://openrouter.ai/models"
|
|
718
|
+
},
|
|
719
|
+
synthetic: {
|
|
720
|
+
url: "https://api.synthetic.new/v1/chat/completions",
|
|
721
|
+
apiKeyEnvVar: "SYNTHETIC_API_KEY",
|
|
722
|
+
apiKeyHeader: "Authorization",
|
|
723
|
+
name: "Synthetic",
|
|
724
|
+
models: [
|
|
725
|
+
"hf:Qwen/Qwen2.5-Coder-32B-Instruct",
|
|
726
|
+
"hf:Qwen/Qwen3-235B-A22B-Instruct-2507",
|
|
727
|
+
"hf:Qwen/Qwen3-235B-A22B-Thinking-2507",
|
|
728
|
+
"hf:Qwen/Qwen3-Coder-480B-A35B-Instruct",
|
|
729
|
+
"hf:deepseek-ai/DeepSeek-R1",
|
|
730
|
+
"hf:deepseek-ai/DeepSeek-R1-0528",
|
|
731
|
+
"hf:deepseek-ai/DeepSeek-V3",
|
|
732
|
+
"hf:deepseek-ai/DeepSeek-V3-0324",
|
|
733
|
+
"hf:deepseek-ai/DeepSeek-V3.1",
|
|
734
|
+
"hf:deepseek-ai/DeepSeek-V3.1-Terminus",
|
|
735
|
+
"hf:meta-llama/Llama-3.1-405B-Instruct",
|
|
736
|
+
"hf:meta-llama/Llama-3.1-70B-Instruct",
|
|
737
|
+
"hf:meta-llama/Llama-3.1-8B-Instruct",
|
|
738
|
+
"hf:meta-llama/Llama-3.3-70B-Instruct",
|
|
739
|
+
"hf:meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8",
|
|
740
|
+
"hf:meta-llama/Llama-4-Scout-17B-16E-Instruct",
|
|
741
|
+
"hf:moonshotai/Kimi-K2-Instruct",
|
|
742
|
+
"hf:moonshotai/Kimi-K2-Instruct-0905",
|
|
743
|
+
"hf:openai/gpt-oss-120b",
|
|
744
|
+
"hf:zai-org/GLM-4.5"
|
|
745
|
+
],
|
|
746
|
+
docUrl: "https://synthetic.new/pricing"
|
|
747
|
+
},
|
|
748
|
+
deepinfra: {
|
|
749
|
+
url: "https://api.deepinfra.com/v1/openai/chat/completions",
|
|
750
|
+
apiKeyEnvVar: "DEEPINFRA_API_KEY",
|
|
751
|
+
apiKeyHeader: "Authorization",
|
|
752
|
+
name: "Deep Infra",
|
|
753
|
+
models: [
|
|
754
|
+
"Qwen/Qwen3-Coder-480B-A35B-Instruct",
|
|
755
|
+
"Qwen/Qwen3-Coder-480B-A35B-Instruct-Turbo",
|
|
756
|
+
"moonshotai/Kimi-K2-Instruct",
|
|
757
|
+
"zai-org/GLM-4.5"
|
|
758
|
+
],
|
|
759
|
+
docUrl: "https://deepinfra.com/models"
|
|
760
|
+
},
|
|
761
|
+
zhipuai: {
|
|
762
|
+
url: "https://open.bigmodel.cn/api/paas/v4/chat/completions",
|
|
763
|
+
apiKeyEnvVar: "ZHIPU_API_KEY",
|
|
764
|
+
apiKeyHeader: "Authorization",
|
|
765
|
+
name: "Zhipu AI",
|
|
766
|
+
models: ["glm-4.5", "glm-4.5-air", "glm-4.5-flash", "glm-4.5v", "glm-4.6"],
|
|
767
|
+
docUrl: "https://docs.z.ai/guides/overview/pricing"
|
|
768
|
+
},
|
|
769
|
+
submodel: {
|
|
770
|
+
url: "https://llm.submodel.ai/v1/chat/completions",
|
|
771
|
+
apiKeyEnvVar: "SUBMODEL_INSTAGEN_ACCESS_KEY",
|
|
772
|
+
apiKeyHeader: "Authorization",
|
|
773
|
+
name: "submodel",
|
|
774
|
+
models: [
|
|
775
|
+
"Qwen/Qwen3-235B-A22B-Instruct-2507",
|
|
776
|
+
"Qwen/Qwen3-235B-A22B-Thinking-2507",
|
|
777
|
+
"Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8",
|
|
778
|
+
"deepseek-ai/DeepSeek-R1-0528",
|
|
779
|
+
"deepseek-ai/DeepSeek-V3-0324",
|
|
780
|
+
"deepseek-ai/DeepSeek-V3.1",
|
|
781
|
+
"openai/gpt-oss-120b",
|
|
782
|
+
"zai-org/GLM-4.5-Air",
|
|
783
|
+
"zai-org/GLM-4.5-FP8"
|
|
784
|
+
],
|
|
785
|
+
docUrl: "https://submodel.gitbook.io"
|
|
786
|
+
},
|
|
787
|
+
zai: {
|
|
788
|
+
url: "https://api.z.ai/api/paas/v4/chat/completions",
|
|
789
|
+
apiKeyEnvVar: "ZHIPU_API_KEY",
|
|
790
|
+
apiKeyHeader: "Authorization",
|
|
791
|
+
name: "Z.AI",
|
|
792
|
+
models: ["glm-4.5", "glm-4.5-air", "glm-4.5-flash", "glm-4.5v", "glm-4.6"],
|
|
793
|
+
docUrl: "https://docs.z.ai/guides/overview/pricing"
|
|
794
|
+
},
|
|
795
|
+
inference: {
|
|
796
|
+
url: "https://inference.net/v1/chat/completions",
|
|
797
|
+
apiKeyEnvVar: "INFERENCE_API_KEY",
|
|
798
|
+
apiKeyHeader: "Authorization",
|
|
799
|
+
name: "Inference",
|
|
800
|
+
models: [
|
|
801
|
+
"google/gemma-3",
|
|
802
|
+
"meta/llama-3.1-8b-instruct",
|
|
803
|
+
"meta/llama-3.2-11b-vision-instruct",
|
|
804
|
+
"meta/llama-3.2-1b-instruct",
|
|
805
|
+
"meta/llama-3.2-3b-instruct",
|
|
806
|
+
"mistral/mistral-nemo-12b-instruct",
|
|
807
|
+
"osmosis/osmosis-structure-0.6b",
|
|
808
|
+
"qwen/qwen-2.5-7b-vision-instruct",
|
|
809
|
+
"qwen/qwen3-embedding-4b"
|
|
810
|
+
],
|
|
811
|
+
docUrl: "https://inference.net/models"
|
|
812
|
+
},
|
|
813
|
+
requesty: {
|
|
814
|
+
url: "https://router.requesty.ai/v1/chat/completions",
|
|
815
|
+
apiKeyEnvVar: "REQUESTY_API_KEY",
|
|
816
|
+
apiKeyHeader: "Authorization",
|
|
817
|
+
name: "Requesty",
|
|
818
|
+
models: [
|
|
819
|
+
"anthropic/claude-3-7-sonnet",
|
|
820
|
+
"anthropic/claude-4-sonnet-20250522",
|
|
821
|
+
"anthropic/claude-opus-4",
|
|
822
|
+
"anthropic/claude-opus-4-1-20250805",
|
|
823
|
+
"google/gemini-2.5-flash",
|
|
824
|
+
"google/gemini-2.5-pro",
|
|
825
|
+
"openai/gpt-4.1",
|
|
826
|
+
"openai/gpt-4.1-mini",
|
|
827
|
+
"openai/gpt-4o-mini",
|
|
828
|
+
"openai/gpt-5",
|
|
829
|
+
"openai/gpt-5-mini",
|
|
830
|
+
"openai/gpt-5-nano",
|
|
831
|
+
"openai/o4-mini"
|
|
832
|
+
],
|
|
833
|
+
docUrl: "https://requesty.ai/solution/llm-routing/models"
|
|
834
|
+
},
|
|
835
|
+
morph: {
|
|
836
|
+
url: "https://api.morphllm.com/v1/chat/completions",
|
|
837
|
+
apiKeyEnvVar: "MORPH_API_KEY",
|
|
838
|
+
apiKeyHeader: "Authorization",
|
|
839
|
+
name: "Morph",
|
|
840
|
+
models: ["auto", "morph-v3-fast", "morph-v3-large"],
|
|
841
|
+
docUrl: "https://docs.morphllm.com/api-reference/introduction"
|
|
842
|
+
},
|
|
843
|
+
lmstudio: {
|
|
844
|
+
url: "http://127.0.0.1:1234/v1/chat/completions",
|
|
845
|
+
apiKeyEnvVar: "LMSTUDIO_API_KEY",
|
|
846
|
+
apiKeyHeader: "Authorization",
|
|
847
|
+
name: "LMStudio",
|
|
848
|
+
models: ["openai/gpt-oss-20b", "qwen/qwen3-30b-a3b-2507", "qwen/qwen3-coder-30b"],
|
|
849
|
+
docUrl: "https://lmstudio.ai/models"
|
|
850
|
+
},
|
|
851
|
+
anthropic: {
|
|
852
|
+
url: "https://api.anthropic.com/v1/chat/completions",
|
|
853
|
+
apiKeyEnvVar: "ANTHROPIC_API_KEY",
|
|
854
|
+
apiKeyHeader: "x-api-key",
|
|
855
|
+
name: "Anthropic",
|
|
856
|
+
models: [
|
|
857
|
+
"claude-3-5-haiku-20241022",
|
|
858
|
+
"claude-3-5-sonnet-20240620",
|
|
859
|
+
"claude-3-5-sonnet-20241022",
|
|
860
|
+
"claude-3-7-sonnet-20250219",
|
|
861
|
+
"claude-3-haiku-20240307",
|
|
862
|
+
"claude-3-opus-20240229",
|
|
863
|
+
"claude-3-sonnet-20240229",
|
|
864
|
+
"claude-opus-4-1-20250805",
|
|
865
|
+
"claude-opus-4-20250514",
|
|
866
|
+
"claude-sonnet-4-20250514",
|
|
867
|
+
"claude-sonnet-4-5-20250929"
|
|
868
|
+
],
|
|
869
|
+
docUrl: "https://docs.anthropic.com/en/docs/about-claude/models"
|
|
870
|
+
},
|
|
871
|
+
"fireworks-ai": {
|
|
872
|
+
url: "https://api.fireworks.ai/inference/v1/chat/completions",
|
|
873
|
+
apiKeyEnvVar: "FIREWORKS_API_KEY",
|
|
874
|
+
apiKeyHeader: "Authorization",
|
|
875
|
+
name: "Fireworks AI",
|
|
876
|
+
models: [
|
|
877
|
+
"accounts/fireworks/models/deepseek-r1-0528",
|
|
878
|
+
"accounts/fireworks/models/deepseek-v3-0324",
|
|
879
|
+
"accounts/fireworks/models/deepseek-v3p1",
|
|
880
|
+
"accounts/fireworks/models/glm-4p5",
|
|
881
|
+
"accounts/fireworks/models/glm-4p5-air",
|
|
882
|
+
"accounts/fireworks/models/gpt-oss-120b",
|
|
883
|
+
"accounts/fireworks/models/gpt-oss-20b",
|
|
884
|
+
"accounts/fireworks/models/kimi-k2-instruct",
|
|
885
|
+
"accounts/fireworks/models/qwen3-235b-a22b",
|
|
886
|
+
"accounts/fireworks/models/qwen3-coder-480b-a35b-instruct"
|
|
887
|
+
],
|
|
888
|
+
docUrl: "https://fireworks.ai/docs/"
|
|
889
|
+
},
|
|
890
|
+
modelscope: {
|
|
891
|
+
url: "https://api-inference.modelscope.cn/v1/chat/completions",
|
|
892
|
+
apiKeyEnvVar: "MODELSCOPE_API_KEY",
|
|
893
|
+
apiKeyHeader: "Authorization",
|
|
894
|
+
name: "ModelScope",
|
|
895
|
+
models: [
|
|
896
|
+
"Qwen/Qwen3-235B-A22B-Instruct-2507",
|
|
897
|
+
"Qwen/Qwen3-235B-A22B-Thinking-2507",
|
|
898
|
+
"Qwen/Qwen3-30B-A3B-Instruct-2507",
|
|
899
|
+
"Qwen/Qwen3-30B-A3B-Thinking-2507",
|
|
900
|
+
"Qwen/Qwen3-Coder-30B-A3B-Instruct",
|
|
901
|
+
"Qwen/Qwen3-Coder-480B-A35B-Instruct",
|
|
902
|
+
"ZhipuAI/GLM-4.5"
|
|
903
|
+
],
|
|
904
|
+
docUrl: "https://modelscope.cn/docs/model-service/API-Inference/intro"
|
|
905
|
+
},
|
|
906
|
+
llama: {
|
|
907
|
+
url: "https://api.llama.com/compat/v1/chat/completions",
|
|
908
|
+
apiKeyEnvVar: "LLAMA_API_KEY",
|
|
909
|
+
apiKeyHeader: "Authorization",
|
|
910
|
+
name: "Llama",
|
|
911
|
+
models: [
|
|
912
|
+
"cerebras-llama-4-maverick-17b-128e-instruct",
|
|
913
|
+
"cerebras-llama-4-scout-17b-16e-instruct",
|
|
914
|
+
"groq-llama-4-maverick-17b-128e-instruct",
|
|
915
|
+
"llama-3.3-70b-instruct",
|
|
916
|
+
"llama-3.3-8b-instruct",
|
|
917
|
+
"llama-4-maverick-17b-128e-instruct-fp8",
|
|
918
|
+
"llama-4-scout-17b-16e-instruct-fp8"
|
|
919
|
+
],
|
|
920
|
+
docUrl: "https://llama.developer.meta.com/docs/models"
|
|
921
|
+
},
|
|
922
|
+
cerebras: {
|
|
923
|
+
url: "https://api.cerebras.ai/v1/chat/completions",
|
|
924
|
+
apiKeyEnvVar: "CEREBRAS_API_KEY",
|
|
925
|
+
apiKeyHeader: "Authorization",
|
|
926
|
+
name: "Cerebras",
|
|
927
|
+
models: ["gpt-oss-120b", "qwen-3-235b-a22b-instruct-2507", "qwen-3-coder-480b"],
|
|
928
|
+
docUrl: "https://inference-docs.cerebras.ai/models/overview"
|
|
929
|
+
}
|
|
930
|
+
};
|
|
931
|
+
function getProviderConfig(providerId) {
|
|
932
|
+
return PROVIDER_REGISTRY[providerId];
|
|
933
|
+
}
|
|
934
|
+
function parseModelString(modelString) {
|
|
935
|
+
const firstSlashIndex = modelString.indexOf("/");
|
|
936
|
+
if (firstSlashIndex !== -1) {
|
|
937
|
+
const provider = modelString.substring(0, firstSlashIndex);
|
|
938
|
+
const modelId = modelString.substring(firstSlashIndex + 1);
|
|
939
|
+
if (provider && modelId) {
|
|
940
|
+
return {
|
|
941
|
+
provider,
|
|
942
|
+
modelId
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
return {
|
|
947
|
+
provider: null,
|
|
948
|
+
modelId: modelString
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
// src/llm/model/openai-compatible.ts
|
|
953
|
+
function resolveApiKey({ provider, apiKey }) {
|
|
954
|
+
if (apiKey) return apiKey;
|
|
955
|
+
if (provider) {
|
|
956
|
+
const config = getProviderConfig(provider);
|
|
957
|
+
if (config?.apiKeyEnvVar) {
|
|
958
|
+
return process.env[config.apiKeyEnvVar];
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
return void 0;
|
|
962
|
+
}
|
|
963
|
+
function buildHeaders(apiKey, apiKeyHeader, customHeaders, provider) {
|
|
964
|
+
const headers = {
|
|
965
|
+
"Content-Type": "application/json",
|
|
966
|
+
...customHeaders
|
|
967
|
+
};
|
|
968
|
+
if (apiKey) {
|
|
969
|
+
if (apiKeyHeader === "x-api-key") {
|
|
970
|
+
headers["x-api-key"] = apiKey;
|
|
971
|
+
} else {
|
|
972
|
+
headers["Authorization"] = `Bearer ${apiKey}`;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
if (provider === "anthropic") {
|
|
976
|
+
headers["anthropic-version"] = "2023-06-01";
|
|
977
|
+
}
|
|
978
|
+
return headers;
|
|
979
|
+
}
|
|
980
|
+
var OpenAICompatibleModel = class {
|
|
981
|
+
specificationVersion = "v2";
|
|
982
|
+
defaultObjectGenerationMode = "json";
|
|
983
|
+
supportsStructuredOutputs = true;
|
|
984
|
+
supportsImageUrls = true;
|
|
985
|
+
supportedUrls = {};
|
|
986
|
+
modelId;
|
|
987
|
+
provider;
|
|
988
|
+
url;
|
|
989
|
+
headers;
|
|
990
|
+
apiKey;
|
|
991
|
+
constructor(config) {
|
|
992
|
+
let parsedConfig;
|
|
993
|
+
if (typeof config === "string") {
|
|
994
|
+
let isUrl = false;
|
|
995
|
+
try {
|
|
996
|
+
new URL(config);
|
|
997
|
+
isUrl = true;
|
|
998
|
+
} catch {
|
|
999
|
+
}
|
|
1000
|
+
if (isUrl) {
|
|
1001
|
+
parsedConfig = {
|
|
1002
|
+
id: "unknown",
|
|
1003
|
+
url: config
|
|
1004
|
+
};
|
|
1005
|
+
this.provider = "openai-compatible";
|
|
1006
|
+
} else {
|
|
1007
|
+
const firstSlashIndex = config.indexOf("/");
|
|
1008
|
+
if (firstSlashIndex !== -1) {
|
|
1009
|
+
const provider = config.substring(0, firstSlashIndex);
|
|
1010
|
+
const modelId = config.substring(firstSlashIndex + 1);
|
|
1011
|
+
const providerConfig2 = getProviderConfig(provider);
|
|
1012
|
+
if (!providerConfig2) {
|
|
1013
|
+
throw new Error(`Unknown provider: ${provider}. Use a custom URL instead.`);
|
|
1014
|
+
}
|
|
1015
|
+
parsedConfig = {
|
|
1016
|
+
id: modelId,
|
|
1017
|
+
url: providerConfig2.url,
|
|
1018
|
+
apiKey: resolveApiKey({ provider })
|
|
1019
|
+
};
|
|
1020
|
+
this.provider = provider;
|
|
1021
|
+
} else {
|
|
1022
|
+
throw new Error(`Invalid model string: "${config}". Use "provider/model" format or a direct URL.`);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
} else {
|
|
1026
|
+
parsedConfig = config;
|
|
1027
|
+
const parsed = parseModelString(config.id);
|
|
1028
|
+
if (!config.url && parsed.provider) {
|
|
1029
|
+
const providerConfig2 = getProviderConfig(parsed.provider);
|
|
1030
|
+
if (!providerConfig2) {
|
|
1031
|
+
throw new Error(`Unknown provider: ${parsed.provider}. Please provide a URL.`);
|
|
1032
|
+
}
|
|
1033
|
+
parsedConfig.url = providerConfig2.url;
|
|
1034
|
+
parsedConfig.id = parsed.modelId;
|
|
1035
|
+
this.provider = parsed.provider;
|
|
1036
|
+
} else {
|
|
1037
|
+
this.provider = parsed.provider || "openai-compatible";
|
|
1038
|
+
}
|
|
1039
|
+
if (!parsedConfig.apiKey) {
|
|
1040
|
+
parsedConfig.apiKey = resolveApiKey({ provider: parsed.provider || void 0 });
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
if (!parsedConfig.url) {
|
|
1044
|
+
throw new Error("URL is required for OpenAI-compatible model");
|
|
1045
|
+
}
|
|
1046
|
+
const providerConfig = this.provider !== "openai-compatible" ? getProviderConfig(this.provider) : void 0;
|
|
1047
|
+
this.modelId = parsedConfig.id;
|
|
1048
|
+
this.url = parsedConfig.url;
|
|
1049
|
+
this.apiKey = parsedConfig.apiKey;
|
|
1050
|
+
this.headers = buildHeaders(parsedConfig.apiKey, providerConfig?.apiKeyHeader, parsedConfig.headers, this.provider);
|
|
1051
|
+
}
|
|
1052
|
+
convertMessagesToOpenAI(messages) {
|
|
1053
|
+
return messages.map((msg) => {
|
|
1054
|
+
if (msg.role === "system") {
|
|
1055
|
+
return {
|
|
1056
|
+
role: "system",
|
|
1057
|
+
content: msg.content
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
if (msg.role === "user") {
|
|
1061
|
+
const contentParts = msg.content.map((part) => {
|
|
1062
|
+
if (part.type === "text") {
|
|
1063
|
+
return { type: "text", text: part.text };
|
|
1064
|
+
}
|
|
1065
|
+
if (part.type === "file") {
|
|
1066
|
+
return {
|
|
1067
|
+
type: "image_url",
|
|
1068
|
+
image_url: { url: part.data }
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
return null;
|
|
1072
|
+
}).filter(Boolean);
|
|
1073
|
+
if (contentParts.every((p) => p?.type === "text")) {
|
|
1074
|
+
return {
|
|
1075
|
+
role: "user",
|
|
1076
|
+
content: contentParts.map((p) => p?.text || "").join("")
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
return {
|
|
1080
|
+
role: "user",
|
|
1081
|
+
content: contentParts
|
|
1082
|
+
};
|
|
1083
|
+
}
|
|
1084
|
+
if (msg.role === "assistant") {
|
|
1085
|
+
const textContent = msg.content.filter((part) => part.type === "text").map((part) => part.text).join("");
|
|
1086
|
+
const toolCalls = msg.content.filter((part) => part.type === "tool-call").map((part) => ({
|
|
1087
|
+
id: part.toolCallId,
|
|
1088
|
+
type: "function",
|
|
1089
|
+
function: {
|
|
1090
|
+
name: part.toolName,
|
|
1091
|
+
arguments: JSON.stringify(part.input || {})
|
|
1092
|
+
}
|
|
1093
|
+
}));
|
|
1094
|
+
return {
|
|
1095
|
+
role: "assistant",
|
|
1096
|
+
content: textContent || null,
|
|
1097
|
+
...toolCalls.length > 0 && { tool_calls: toolCalls }
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
if (msg.role === "tool") {
|
|
1101
|
+
return msg.content.map((toolResponse) => ({
|
|
1102
|
+
role: "tool",
|
|
1103
|
+
tool_call_id: toolResponse.toolCallId,
|
|
1104
|
+
content: JSON.stringify(toolResponse.output)
|
|
1105
|
+
}));
|
|
1106
|
+
}
|
|
1107
|
+
return msg;
|
|
1108
|
+
}).flat();
|
|
1109
|
+
}
|
|
1110
|
+
convertToolsToOpenAI(tools) {
|
|
1111
|
+
if (!tools || Object.keys(tools).length === 0) return void 0;
|
|
1112
|
+
return Object.entries(tools).map(([name, tool]) => {
|
|
1113
|
+
if (tool.type === "function") {
|
|
1114
|
+
return {
|
|
1115
|
+
type: "function",
|
|
1116
|
+
function: {
|
|
1117
|
+
name: tool.name,
|
|
1118
|
+
description: tool.description,
|
|
1119
|
+
parameters: tool.inputSchema || {}
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1123
|
+
return {
|
|
1124
|
+
type: "function",
|
|
1125
|
+
function: {
|
|
1126
|
+
name,
|
|
1127
|
+
description: `Provider tool: ${name}`,
|
|
1128
|
+
parameters: {}
|
|
1129
|
+
}
|
|
1130
|
+
};
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
mapFinishReason(reason) {
|
|
1134
|
+
switch (reason) {
|
|
1135
|
+
case "stop":
|
|
1136
|
+
return "stop";
|
|
1137
|
+
case "length":
|
|
1138
|
+
case "max_tokens":
|
|
1139
|
+
return "length";
|
|
1140
|
+
case "tool_calls":
|
|
1141
|
+
case "function_call":
|
|
1142
|
+
return "tool-calls";
|
|
1143
|
+
case "content_filter":
|
|
1144
|
+
return "content-filter";
|
|
1145
|
+
default:
|
|
1146
|
+
return "unknown";
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
validateApiKey() {
|
|
1150
|
+
if (!this.apiKey && this.provider !== "openai-compatible") {
|
|
1151
|
+
const providerConfig = getProviderConfig(this.provider);
|
|
1152
|
+
if (providerConfig?.apiKeyEnvVar) {
|
|
1153
|
+
throw new Error(
|
|
1154
|
+
`API key not found for provider "${this.provider}". Please set the ${providerConfig.apiKeyEnvVar} environment variable.`
|
|
1155
|
+
);
|
|
1156
|
+
} else {
|
|
1157
|
+
throw new Error(
|
|
1158
|
+
`API key not found for provider "${this.provider}". Please provide an API key in the configuration.`
|
|
1159
|
+
);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
async doGenerate() {
|
|
1164
|
+
throw new Error(
|
|
1165
|
+
"doGenerate is not supported by OpenAICompatibleModel. Mastra only uses streaming (doStream) for all LLM calls."
|
|
1166
|
+
);
|
|
1167
|
+
}
|
|
1168
|
+
async doStream(options) {
|
|
1169
|
+
this.validateApiKey();
|
|
1170
|
+
const { prompt, tools, toolChoice, providerOptions } = options;
|
|
1171
|
+
const body = {
|
|
1172
|
+
messages: this.convertMessagesToOpenAI(prompt),
|
|
1173
|
+
model: this.modelId,
|
|
1174
|
+
stream: true,
|
|
1175
|
+
...providerOptions
|
|
1176
|
+
};
|
|
1177
|
+
const openAITools = this.convertToolsToOpenAI(tools);
|
|
1178
|
+
if (openAITools) {
|
|
1179
|
+
body.tools = openAITools;
|
|
1180
|
+
if (toolChoice) {
|
|
1181
|
+
body.tool_choice = toolChoice.type === "none" ? "none" : toolChoice.type === "required" ? "required" : toolChoice.type === "auto" ? "auto" : toolChoice.type === "tool" ? { type: "function", function: { name: toolChoice.toolName } } : "auto";
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
if (options.responseFormat?.type === "json") {
|
|
1185
|
+
body.response_format = {
|
|
1186
|
+
type: "json_schema",
|
|
1187
|
+
json_schema: {
|
|
1188
|
+
name: "response",
|
|
1189
|
+
strict: true,
|
|
1190
|
+
schema: options.responseFormat.schema
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1194
|
+
const fetchArgs = {
|
|
1195
|
+
method: "POST",
|
|
1196
|
+
headers: this.headers,
|
|
1197
|
+
body: JSON.stringify(body),
|
|
1198
|
+
signal: options.abortSignal
|
|
1199
|
+
};
|
|
1200
|
+
const response = await fetch(this.url, fetchArgs);
|
|
1201
|
+
if (!response.ok) {
|
|
1202
|
+
const error = await response.text();
|
|
1203
|
+
if (response.status === 401 || response.status === 403) {
|
|
1204
|
+
const providerConfig = getProviderConfig(this.provider);
|
|
1205
|
+
if (providerConfig?.apiKeyEnvVar) {
|
|
1206
|
+
throw new Error(
|
|
1207
|
+
`Authentication failed for provider "${this.provider}". Please ensure the ${providerConfig.apiKeyEnvVar} environment variable is set with a valid API key.`
|
|
1208
|
+
);
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
throw new Error(`OpenAI-compatible API error: ${response.status} - ${error}`);
|
|
1212
|
+
}
|
|
1213
|
+
const reader = response.body?.getReader();
|
|
1214
|
+
if (!reader) {
|
|
1215
|
+
throw new Error("Response body is not readable");
|
|
1216
|
+
}
|
|
1217
|
+
const decoder = new TextDecoder();
|
|
1218
|
+
let buffer = "";
|
|
1219
|
+
let sentStart = false;
|
|
1220
|
+
const toolCallBuffers = /* @__PURE__ */ new Map();
|
|
1221
|
+
const mapFinishReason = this.mapFinishReason.bind(this);
|
|
1222
|
+
const modelId = this.modelId;
|
|
1223
|
+
let isActiveText = false;
|
|
1224
|
+
const stream = new ReadableStream({
|
|
1225
|
+
async start(controller) {
|
|
1226
|
+
try {
|
|
1227
|
+
controller.enqueue({
|
|
1228
|
+
type: "stream-start",
|
|
1229
|
+
warnings: []
|
|
1230
|
+
});
|
|
1231
|
+
while (true) {
|
|
1232
|
+
const { done, value } = await reader.read();
|
|
1233
|
+
if (done) {
|
|
1234
|
+
for (const [_, toolCall] of toolCallBuffers) {
|
|
1235
|
+
if (!toolCall.sent && toolCall.id && toolCall.name && toolCall.args) {
|
|
1236
|
+
controller.enqueue({
|
|
1237
|
+
type: "tool-call",
|
|
1238
|
+
toolCallId: toolCall.id,
|
|
1239
|
+
toolName: toolCall.name,
|
|
1240
|
+
input: toolCall.args || "{}"
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
controller.close();
|
|
1245
|
+
break;
|
|
1246
|
+
}
|
|
1247
|
+
buffer += decoder.decode(value, { stream: true });
|
|
1248
|
+
const lines = buffer.split("\n");
|
|
1249
|
+
buffer = lines.pop() || "";
|
|
1250
|
+
for (const line of lines) {
|
|
1251
|
+
if (line.trim() === "" || line.trim() === "data: [DONE]") {
|
|
1252
|
+
continue;
|
|
1253
|
+
}
|
|
1254
|
+
if (line.startsWith("data: ")) {
|
|
1255
|
+
try {
|
|
1256
|
+
const data = JSON.parse(line.slice(6));
|
|
1257
|
+
if (!sentStart && data.id) {
|
|
1258
|
+
controller.enqueue({
|
|
1259
|
+
type: "response-metadata",
|
|
1260
|
+
id: data.id,
|
|
1261
|
+
modelId: data.model || modelId,
|
|
1262
|
+
timestamp: new Date(data.created ? data.created * 1e3 : Date.now())
|
|
1263
|
+
});
|
|
1264
|
+
sentStart = true;
|
|
1265
|
+
}
|
|
1266
|
+
const choice = data.choices?.[0];
|
|
1267
|
+
if (!choice) continue;
|
|
1268
|
+
if (choice.delta?.content) {
|
|
1269
|
+
if (!isActiveText) {
|
|
1270
|
+
controller.enqueue({ type: "text-start", id: "text-1" });
|
|
1271
|
+
isActiveText = true;
|
|
1272
|
+
}
|
|
1273
|
+
controller.enqueue({
|
|
1274
|
+
type: "text-delta",
|
|
1275
|
+
id: "text-1",
|
|
1276
|
+
delta: choice.delta.content
|
|
1277
|
+
});
|
|
1278
|
+
} else if (isActiveText) {
|
|
1279
|
+
controller.enqueue({ type: "text-end", id: "text-1" });
|
|
1280
|
+
isActiveText = false;
|
|
1281
|
+
}
|
|
1282
|
+
if (choice.delta?.tool_calls) {
|
|
1283
|
+
for (const toolCall of choice.delta.tool_calls) {
|
|
1284
|
+
const index = toolCall.index;
|
|
1285
|
+
if (!toolCallBuffers.has(index)) {
|
|
1286
|
+
if (toolCall.id && toolCall.function?.name) {
|
|
1287
|
+
controller.enqueue({
|
|
1288
|
+
type: "tool-input-start",
|
|
1289
|
+
id: toolCall.id,
|
|
1290
|
+
toolName: toolCall.function.name
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1293
|
+
toolCallBuffers.set(index, {
|
|
1294
|
+
id: toolCall.id || "",
|
|
1295
|
+
name: toolCall.function?.name || "",
|
|
1296
|
+
args: ""
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
const buffer2 = toolCallBuffers.get(index);
|
|
1300
|
+
if (toolCall.id) {
|
|
1301
|
+
buffer2.id = toolCall.id;
|
|
1302
|
+
}
|
|
1303
|
+
if (toolCall.function?.name) {
|
|
1304
|
+
buffer2.name = toolCall.function.name;
|
|
1305
|
+
}
|
|
1306
|
+
if (toolCall.function?.arguments) {
|
|
1307
|
+
buffer2.args += toolCall.function.arguments;
|
|
1308
|
+
controller.enqueue({
|
|
1309
|
+
type: "tool-input-delta",
|
|
1310
|
+
id: buffer2.id,
|
|
1311
|
+
delta: toolCall.function.arguments
|
|
1312
|
+
});
|
|
1313
|
+
try {
|
|
1314
|
+
JSON.parse(buffer2.args);
|
|
1315
|
+
if (buffer2.id && buffer2.name) {
|
|
1316
|
+
controller.enqueue({
|
|
1317
|
+
type: "tool-input-end",
|
|
1318
|
+
id: buffer2.id
|
|
1319
|
+
});
|
|
1320
|
+
controller.enqueue({
|
|
1321
|
+
type: "tool-call",
|
|
1322
|
+
toolCallId: buffer2.id,
|
|
1323
|
+
toolName: buffer2.name,
|
|
1324
|
+
input: buffer2.args
|
|
1325
|
+
});
|
|
1326
|
+
toolCallBuffers.set(index, {
|
|
1327
|
+
id: buffer2.id,
|
|
1328
|
+
name: buffer2.name,
|
|
1329
|
+
args: buffer2.args,
|
|
1330
|
+
sent: true
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
} catch {
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
if (choice.finish_reason) {
|
|
1339
|
+
toolCallBuffers.clear();
|
|
1340
|
+
controller.enqueue({
|
|
1341
|
+
type: "finish",
|
|
1342
|
+
finishReason: mapFinishReason(choice.finish_reason),
|
|
1343
|
+
usage: data.usage ? {
|
|
1344
|
+
inputTokens: data.usage.prompt_tokens || 0,
|
|
1345
|
+
outputTokens: data.usage.completion_tokens || 0,
|
|
1346
|
+
totalTokens: data.usage.total_tokens || 0
|
|
1347
|
+
} : {
|
|
1348
|
+
inputTokens: 0,
|
|
1349
|
+
outputTokens: 0,
|
|
1350
|
+
totalTokens: 0
|
|
1351
|
+
}
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
} catch (e) {
|
|
1355
|
+
console.error("Error parsing SSE data:", e);
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
} catch (error) {
|
|
1361
|
+
controller.error(error);
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
return {
|
|
1366
|
+
stream,
|
|
1367
|
+
request: { body: JSON.stringify(body) },
|
|
1368
|
+
response: { headers: Object.fromEntries(response.headers.entries()) },
|
|
1369
|
+
warnings: []
|
|
1370
|
+
};
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
exports.OpenAICompatibleModel = OpenAICompatibleModel;
|
|
1375
|
+
exports.PROVIDER_REGISTRY = PROVIDER_REGISTRY;
|
|
1376
|
+
exports.getProviderConfig = getProviderConfig;
|
|
1377
|
+
exports.parseModelString = parseModelString;
|
|
1378
|
+
//# sourceMappingURL=chunk-TIBULEK6.cjs.map
|
|
1379
|
+
//# sourceMappingURL=chunk-TIBULEK6.cjs.map
|