@oh-my-pi/pi-ai 14.5.12 → 14.5.14
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 +27 -1
- package/package.json +3 -3
- package/src/auth-storage.ts +58 -49
- package/src/cli.ts +33 -24
- package/src/index.ts +5 -5
- package/src/models.json +1854 -207
- package/src/provider-models/openai-compat.ts +13 -2
- package/src/providers/antigravity-user-agent.ts +19 -0
- package/src/providers/gitlab-duo.ts +1 -3
- package/src/providers/google-gemini-cli.ts +14 -170
- package/src/providers/google-gemini-headers.ts +141 -0
- package/src/providers/kimi.ts +2 -4
- package/src/providers/openai-codex-responses.ts +11 -4
- package/src/providers/openai-completions-compat.ts +9 -1
- package/src/providers/openai-completions.ts +65 -16
- package/src/providers/synthetic.ts +1 -2
- package/src/stream.ts +29 -11
- package/src/types.ts +2 -0
- package/src/usage/google-antigravity.ts +1 -1
- package/src/usage/kimi.ts +1 -1
- package/src/utils/discovery/antigravity.ts +1 -1
- package/src/utils/oauth/google-antigravity.ts +2 -2
- package/src/utils/oauth/google-gemini-cli.ts +1 -1
- package/src/utils/oauth/index.ts +25 -130
- package/src/utils/oauth/kimi.ts +20 -19
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [14.5.14] - 2026-05-01
|
|
6
|
+
### Added
|
|
7
|
+
|
|
8
|
+
- Added package-level `google-gemini-headers` exports (`getGeminiCliHeaders`, `getGeminiCliUserAgent`, `getAntigravityHeaders`, `extractRetryDelay`, and `ANTIGRAVITY_SYSTEM_INSTRUCTION`) for header and retry handling reuse without importing full Google providers
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Changed package exports and streaming/provider wiring to load heavy Google/Kimi/GitLab/synthetic provider modules lazily through `register-builtins`, reducing startup import overhead from optional provider SDKs
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Fixed DeepSeek V4 tool-call follow-up 400 errors from three root causes:
|
|
17
|
+
- Mapped `reasoning_effort` "xhigh" to "max" for DeepSeek-family models on any provider (NVIDIA, OpenCode-Go, etc.), not just `deepseek`
|
|
18
|
+
- Recovered `reasoning_content` from thinking blocks with valid signatures that were filtered by the non-empty-text check
|
|
19
|
+
- Added empty-string fallback when `reasoning_content` is genuinely absent (e.g. proxy-stripped) but the provider requires the field
|
|
20
|
+
|
|
21
|
+
## [14.5.13] - 2026-05-01
|
|
22
|
+
|
|
23
|
+
### Breaking Changes
|
|
24
|
+
|
|
25
|
+
- Removed `utils/oauth` re-exports from the package entrypoint, so OAuth helper imports from the root module must be updated
|
|
26
|
+
|
|
5
27
|
## [14.5.10] - 2026-04-30
|
|
6
28
|
|
|
7
29
|
### Added
|
|
@@ -9,6 +31,7 @@
|
|
|
9
31
|
- Added provider response metadata callbacks for Anthropic and OpenAI streaming requests.
|
|
10
32
|
|
|
11
33
|
## [14.5.9] - 2026-04-30
|
|
34
|
+
|
|
12
35
|
### Added
|
|
13
36
|
|
|
14
37
|
- Added `usage.reasoningTokens` to OpenAI and Google usage output when providers report reasoning/thinking tokens
|
|
@@ -21,6 +44,7 @@
|
|
|
21
44
|
- Fixed Anthropic streaming usage handling so a previously populated cache TTL breakdown is preserved when later events omit `cache_creation`
|
|
22
45
|
|
|
23
46
|
## [14.5.4] - 2026-04-28
|
|
47
|
+
|
|
24
48
|
### Changed
|
|
25
49
|
|
|
26
50
|
- Changed OpenAI custom Lark grammar payloads to strip comments and blank lines before sending provider requests.
|
|
@@ -30,6 +54,7 @@
|
|
|
30
54
|
- Fixed OpenAI Codex GPT model pricing by inheriting matching OpenAI catalog rates for zero-priced discovered Codex entries.
|
|
31
55
|
|
|
32
56
|
## [14.5.3] - 2026-04-27
|
|
57
|
+
|
|
33
58
|
### Added
|
|
34
59
|
|
|
35
60
|
- Added `fireworks` as a supported provider with API key login flow and credential storage
|
|
@@ -122,6 +147,7 @@
|
|
|
122
147
|
- Preserved user-provided `session_id` and `x-client-request-id` headers in OpenAI Responses requests instead of overriding them with automatic session-derived values
|
|
123
148
|
- Stopped sending `session_id` and `x-client-request-id` headers for OpenAI Responses requests when `cacheRetention` is set to `none`
|
|
124
149
|
- Fixed direct OpenAI Responses requests to send `session_id` and `x-client-request-id` from the same session-derived value as `prompt_cache_key`, improving prompt cache affinity for append-only sessions
|
|
150
|
+
|
|
125
151
|
## [14.1.1] - 2026-04-14
|
|
126
152
|
|
|
127
153
|
### Added
|
|
@@ -2182,4 +2208,4 @@ _Dedicated to Peter's shoulder ([@steipete](https://twitter.com/steipete))_
|
|
|
2182
2208
|
|
|
2183
2209
|
## [0.9.4] - 2025-11-26
|
|
2184
2210
|
|
|
2185
|
-
Initial release with multi-provider LLM support.
|
|
2211
|
+
Initial release with multi-provider LLM support.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-ai",
|
|
4
|
-
"version": "14.5.
|
|
4
|
+
"version": "14.5.14",
|
|
5
5
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
6
6
|
"homepage": "https://github.com/can1357/oh-my-pi",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"@aws-sdk/credential-provider-node": "^3.972.36",
|
|
47
47
|
"@bufbuild/protobuf": "^2.12.0",
|
|
48
48
|
"@google/genai": "^1.50.1",
|
|
49
|
-
"@oh-my-pi/pi-natives": "14.5.
|
|
50
|
-
"@oh-my-pi/pi-utils": "14.5.
|
|
49
|
+
"@oh-my-pi/pi-natives": "14.5.14",
|
|
50
|
+
"@oh-my-pi/pi-utils": "14.5.14",
|
|
51
51
|
"@sinclair/typebox": "^0.34.49",
|
|
52
52
|
"@smithy/node-http-handler": "^4.6.1",
|
|
53
53
|
"ajv": "^8.20.0",
|
package/src/auth-storage.ts
CHANGED
|
@@ -29,46 +29,7 @@ import { kimiUsageProvider } from "./usage/kimi";
|
|
|
29
29
|
import { codexRankingStrategy, openaiCodexUsageProvider } from "./usage/openai-codex";
|
|
30
30
|
import { zaiUsageProvider } from "./usage/zai";
|
|
31
31
|
import { getOAuthApiKey, getOAuthProvider, refreshOAuthToken } from "./utils/oauth";
|
|
32
|
-
// Re-export login functions so consumers of AuthStorage.login() have access
|
|
33
|
-
// (these are used inside the login() switch-case)
|
|
34
|
-
import { loginAlibabaCodingPlan } from "./utils/oauth/alibaba-coding-plan";
|
|
35
|
-
import { loginAnthropic } from "./utils/oauth/anthropic";
|
|
36
|
-
import { loginCerebras } from "./utils/oauth/cerebras";
|
|
37
|
-
import { loginCloudflareAiGateway } from "./utils/oauth/cloudflare-ai-gateway";
|
|
38
|
-
import { loginCursor } from "./utils/oauth/cursor";
|
|
39
|
-
import { loginFireworks } from "./utils/oauth/fireworks";
|
|
40
|
-
import { loginGitHubCopilot } from "./utils/oauth/github-copilot";
|
|
41
|
-
import { loginGitLabDuo } from "./utils/oauth/gitlab-duo";
|
|
42
|
-
import { loginAntigravity } from "./utils/oauth/google-antigravity";
|
|
43
|
-
import { loginGeminiCli } from "./utils/oauth/google-gemini-cli";
|
|
44
|
-
import { loginHuggingface } from "./utils/oauth/huggingface";
|
|
45
|
-
import { loginKagi } from "./utils/oauth/kagi";
|
|
46
|
-
import { loginKilo } from "./utils/oauth/kilo";
|
|
47
|
-
import { loginKimi } from "./utils/oauth/kimi";
|
|
48
|
-
import { loginLiteLLM } from "./utils/oauth/litellm";
|
|
49
|
-
import { loginLmStudio } from "./utils/oauth/lm-studio";
|
|
50
|
-
import { loginMiniMaxCode, loginMiniMaxCodeCn } from "./utils/oauth/minimax-code";
|
|
51
|
-
import { loginMoonshot } from "./utils/oauth/moonshot";
|
|
52
|
-
import { loginNanoGPT } from "./utils/oauth/nanogpt";
|
|
53
|
-
import { loginNvidia } from "./utils/oauth/nvidia";
|
|
54
|
-
import { loginOllama } from "./utils/oauth/ollama";
|
|
55
|
-
import { loginOllamaCloud } from "./utils/oauth/ollama-cloud";
|
|
56
|
-
import { loginOpenAICodex } from "./utils/oauth/openai-codex";
|
|
57
|
-
import { loginOpenCode } from "./utils/oauth/opencode";
|
|
58
|
-
import { loginParallel } from "./utils/oauth/parallel";
|
|
59
|
-
import { loginPerplexity } from "./utils/oauth/perplexity";
|
|
60
|
-
import { loginQianfan } from "./utils/oauth/qianfan";
|
|
61
|
-
import { loginQwenPortal } from "./utils/oauth/qwen-portal";
|
|
62
|
-
import { loginSynthetic } from "./utils/oauth/synthetic";
|
|
63
|
-
import { loginTavily } from "./utils/oauth/tavily";
|
|
64
|
-
import { loginTogether } from "./utils/oauth/together";
|
|
65
32
|
import type { OAuthController, OAuthCredentials, OAuthProvider, OAuthProviderId } from "./utils/oauth/types";
|
|
66
|
-
import { loginVenice } from "./utils/oauth/venice";
|
|
67
|
-
import { loginVercelAiGateway } from "./utils/oauth/vercel-ai-gateway";
|
|
68
|
-
import { loginVllm } from "./utils/oauth/vllm";
|
|
69
|
-
import { loginXiaomi } from "./utils/oauth/xiaomi";
|
|
70
|
-
import { loginZai } from "./utils/oauth/zai";
|
|
71
|
-
import { loginZenMux } from "./utils/oauth/zenmux";
|
|
72
33
|
|
|
73
34
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
74
35
|
// Credential Types
|
|
@@ -758,18 +719,22 @@ export class AuthStorage {
|
|
|
758
719
|
};
|
|
759
720
|
const manualCodeInput = () => ctrl.onPrompt({ message: "Paste the authorization code (or full redirect URL):" });
|
|
760
721
|
switch (provider) {
|
|
761
|
-
case "anthropic":
|
|
722
|
+
case "anthropic": {
|
|
723
|
+
const { loginAnthropic } = await import("./utils/oauth/anthropic");
|
|
762
724
|
credentials = await loginAnthropic({
|
|
763
725
|
...ctrl,
|
|
764
726
|
onManualCodeInput: ctrl.onManualCodeInput ?? manualCodeInput,
|
|
765
727
|
});
|
|
766
728
|
break;
|
|
729
|
+
}
|
|
767
730
|
case "alibaba-coding-plan": {
|
|
731
|
+
const { loginAlibabaCodingPlan } = await import("./utils/oauth/alibaba-coding-plan");
|
|
768
732
|
const apiKey = await loginAlibabaCodingPlan(ctrl);
|
|
769
733
|
await saveApiKeyCredential(apiKey);
|
|
770
734
|
return;
|
|
771
735
|
}
|
|
772
|
-
case "github-copilot":
|
|
736
|
+
case "github-copilot": {
|
|
737
|
+
const { loginGitHubCopilot } = await import("./utils/oauth/github-copilot");
|
|
773
738
|
credentials = await loginGitHubCopilot({
|
|
774
739
|
onAuth: (url, instructions) => ctrl.onAuth({ url, instructions }),
|
|
775
740
|
onPrompt: ctrl.onPrompt,
|
|
@@ -777,62 +742,83 @@ export class AuthStorage {
|
|
|
777
742
|
signal: ctrl.signal,
|
|
778
743
|
});
|
|
779
744
|
break;
|
|
780
|
-
|
|
745
|
+
}
|
|
746
|
+
case "google-gemini-cli": {
|
|
747
|
+
const { loginGeminiCli } = await import("./utils/oauth/google-gemini-cli");
|
|
781
748
|
credentials = await loginGeminiCli({
|
|
782
749
|
...ctrl,
|
|
783
750
|
onManualCodeInput: ctrl.onManualCodeInput ?? manualCodeInput,
|
|
784
751
|
});
|
|
785
752
|
break;
|
|
786
|
-
|
|
753
|
+
}
|
|
754
|
+
case "google-antigravity": {
|
|
755
|
+
const { loginAntigravity } = await import("./utils/oauth/google-antigravity");
|
|
787
756
|
credentials = await loginAntigravity({
|
|
788
757
|
...ctrl,
|
|
789
758
|
onManualCodeInput: ctrl.onManualCodeInput ?? manualCodeInput,
|
|
790
759
|
});
|
|
791
760
|
break;
|
|
792
|
-
|
|
761
|
+
}
|
|
762
|
+
case "openai-codex": {
|
|
763
|
+
const { loginOpenAICodex } = await import("./utils/oauth/openai-codex");
|
|
793
764
|
credentials = await loginOpenAICodex({
|
|
794
765
|
...ctrl,
|
|
795
766
|
onManualCodeInput: ctrl.onManualCodeInput ?? manualCodeInput,
|
|
796
767
|
});
|
|
797
768
|
break;
|
|
798
|
-
|
|
769
|
+
}
|
|
770
|
+
case "gitlab-duo": {
|
|
771
|
+
const { loginGitLabDuo } = await import("./utils/oauth/gitlab-duo");
|
|
799
772
|
credentials = await loginGitLabDuo({
|
|
800
773
|
...ctrl,
|
|
801
774
|
onManualCodeInput: ctrl.onManualCodeInput ?? manualCodeInput,
|
|
802
775
|
});
|
|
803
776
|
break;
|
|
804
|
-
|
|
777
|
+
}
|
|
778
|
+
case "kimi-code": {
|
|
779
|
+
const { loginKimi } = await import("./utils/oauth/kimi");
|
|
805
780
|
credentials = await loginKimi(ctrl);
|
|
806
781
|
break;
|
|
807
|
-
|
|
782
|
+
}
|
|
783
|
+
case "kilo": {
|
|
784
|
+
const { loginKilo } = await import("./utils/oauth/kilo");
|
|
808
785
|
credentials = await loginKilo(ctrl);
|
|
809
786
|
break;
|
|
810
|
-
|
|
787
|
+
}
|
|
788
|
+
case "cursor": {
|
|
789
|
+
const { loginCursor } = await import("./utils/oauth/cursor");
|
|
811
790
|
credentials = await loginCursor(
|
|
812
791
|
url => ctrl.onAuth({ url }),
|
|
813
792
|
ctrl.onProgress ? () => ctrl.onProgress?.("Waiting for browser authentication...") : undefined,
|
|
814
793
|
);
|
|
815
794
|
break;
|
|
816
|
-
|
|
795
|
+
}
|
|
796
|
+
case "perplexity": {
|
|
797
|
+
const { loginPerplexity } = await import("./utils/oauth/perplexity");
|
|
817
798
|
credentials = await loginPerplexity(ctrl);
|
|
818
799
|
break;
|
|
800
|
+
}
|
|
819
801
|
case "huggingface": {
|
|
802
|
+
const { loginHuggingface } = await import("./utils/oauth/huggingface");
|
|
820
803
|
const apiKey = await loginHuggingface(ctrl);
|
|
821
804
|
await saveApiKeyCredential(apiKey);
|
|
822
805
|
return;
|
|
823
806
|
}
|
|
824
807
|
case "opencode-zen":
|
|
825
808
|
case "opencode-go": {
|
|
809
|
+
const { loginOpenCode } = await import("./utils/oauth/opencode");
|
|
826
810
|
const apiKey = await loginOpenCode(ctrl);
|
|
827
811
|
await saveApiKeyCredential(apiKey);
|
|
828
812
|
return;
|
|
829
813
|
}
|
|
830
814
|
case "lm-studio": {
|
|
815
|
+
const { loginLmStudio } = await import("./utils/oauth/lm-studio");
|
|
831
816
|
const apiKey = await loginLmStudio(ctrl);
|
|
832
817
|
await saveApiKeyCredential(apiKey);
|
|
833
818
|
return;
|
|
834
819
|
}
|
|
835
820
|
case "ollama": {
|
|
821
|
+
const { loginOllama } = await import("./utils/oauth/ollama");
|
|
836
822
|
const apiKey = await loginOllama(ctrl);
|
|
837
823
|
if (!apiKey) {
|
|
838
824
|
return;
|
|
@@ -841,116 +827,139 @@ export class AuthStorage {
|
|
|
841
827
|
return;
|
|
842
828
|
}
|
|
843
829
|
case "ollama-cloud": {
|
|
830
|
+
const { loginOllamaCloud } = await import("./utils/oauth/ollama-cloud");
|
|
844
831
|
const apiKey = await loginOllamaCloud(ctrl);
|
|
845
832
|
await saveApiKeyCredential(apiKey);
|
|
846
833
|
return;
|
|
847
834
|
}
|
|
848
835
|
case "cerebras": {
|
|
836
|
+
const { loginCerebras } = await import("./utils/oauth/cerebras");
|
|
849
837
|
const apiKey = await loginCerebras(ctrl);
|
|
850
838
|
await saveApiKeyCredential(apiKey);
|
|
851
839
|
return;
|
|
852
840
|
}
|
|
853
841
|
case "fireworks": {
|
|
842
|
+
const { loginFireworks } = await import("./utils/oauth/fireworks");
|
|
854
843
|
const apiKey = await loginFireworks(ctrl);
|
|
855
844
|
await saveApiKeyCredential(apiKey);
|
|
856
845
|
return;
|
|
857
846
|
}
|
|
858
847
|
case "zai": {
|
|
848
|
+
const { loginZai } = await import("./utils/oauth/zai");
|
|
859
849
|
const apiKey = await loginZai(ctrl);
|
|
860
850
|
await saveApiKeyCredential(apiKey);
|
|
861
851
|
return;
|
|
862
852
|
}
|
|
863
853
|
case "qianfan": {
|
|
854
|
+
const { loginQianfan } = await import("./utils/oauth/qianfan");
|
|
864
855
|
const apiKey = await loginQianfan(ctrl);
|
|
865
856
|
await saveApiKeyCredential(apiKey);
|
|
866
857
|
return;
|
|
867
858
|
}
|
|
868
859
|
case "minimax-code": {
|
|
860
|
+
const { loginMiniMaxCode } = await import("./utils/oauth/minimax-code");
|
|
869
861
|
const apiKey = await loginMiniMaxCode(ctrl);
|
|
870
862
|
await saveApiKeyCredential(apiKey);
|
|
871
863
|
return;
|
|
872
864
|
}
|
|
873
865
|
case "minimax-code-cn": {
|
|
866
|
+
const { loginMiniMaxCodeCn } = await import("./utils/oauth/minimax-code");
|
|
874
867
|
const apiKey = await loginMiniMaxCodeCn(ctrl);
|
|
875
868
|
await saveApiKeyCredential(apiKey);
|
|
876
869
|
return;
|
|
877
870
|
}
|
|
878
871
|
case "synthetic": {
|
|
872
|
+
const { loginSynthetic } = await import("./utils/oauth/synthetic");
|
|
879
873
|
const apiKey = await loginSynthetic(ctrl);
|
|
880
874
|
await saveApiKeyCredential(apiKey);
|
|
881
875
|
return;
|
|
882
876
|
}
|
|
883
877
|
case "tavily": {
|
|
878
|
+
const { loginTavily } = await import("./utils/oauth/tavily");
|
|
884
879
|
const apiKey = await loginTavily(ctrl);
|
|
885
880
|
await saveApiKeyCredential(apiKey);
|
|
886
881
|
return;
|
|
887
882
|
}
|
|
888
883
|
case "venice": {
|
|
884
|
+
const { loginVenice } = await import("./utils/oauth/venice");
|
|
889
885
|
const apiKey = await loginVenice(ctrl);
|
|
890
886
|
await saveApiKeyCredential(apiKey);
|
|
891
887
|
return;
|
|
892
888
|
}
|
|
893
889
|
case "litellm": {
|
|
890
|
+
const { loginLiteLLM } = await import("./utils/oauth/litellm");
|
|
894
891
|
const apiKey = await loginLiteLLM(ctrl);
|
|
895
892
|
await saveApiKeyCredential(apiKey);
|
|
896
893
|
return;
|
|
897
894
|
}
|
|
898
895
|
case "moonshot": {
|
|
896
|
+
const { loginMoonshot } = await import("./utils/oauth/moonshot");
|
|
899
897
|
const apiKey = await loginMoonshot(ctrl);
|
|
900
898
|
await saveApiKeyCredential(apiKey);
|
|
901
899
|
return;
|
|
902
900
|
}
|
|
903
901
|
case "kagi": {
|
|
902
|
+
const { loginKagi } = await import("./utils/oauth/kagi");
|
|
904
903
|
const apiKey = await loginKagi(ctrl);
|
|
905
904
|
await saveApiKeyCredential(apiKey);
|
|
906
905
|
return;
|
|
907
906
|
}
|
|
908
907
|
case "nanogpt": {
|
|
908
|
+
const { loginNanoGPT } = await import("./utils/oauth/nanogpt");
|
|
909
909
|
const apiKey = await loginNanoGPT(ctrl);
|
|
910
910
|
await saveApiKeyCredential(apiKey);
|
|
911
911
|
return;
|
|
912
912
|
}
|
|
913
913
|
case "together": {
|
|
914
|
+
const { loginTogether } = await import("./utils/oauth/together");
|
|
914
915
|
const apiKey = await loginTogether(ctrl);
|
|
915
916
|
await saveApiKeyCredential(apiKey);
|
|
916
917
|
return;
|
|
917
918
|
}
|
|
918
919
|
case "cloudflare-ai-gateway": {
|
|
920
|
+
const { loginCloudflareAiGateway } = await import("./utils/oauth/cloudflare-ai-gateway");
|
|
919
921
|
const apiKey = await loginCloudflareAiGateway(ctrl);
|
|
920
922
|
await saveApiKeyCredential(apiKey);
|
|
921
923
|
return;
|
|
922
924
|
}
|
|
923
925
|
case "vercel-ai-gateway": {
|
|
926
|
+
const { loginVercelAiGateway } = await import("./utils/oauth/vercel-ai-gateway");
|
|
924
927
|
const apiKey = await loginVercelAiGateway(ctrl);
|
|
925
928
|
await saveApiKeyCredential(apiKey);
|
|
926
929
|
return;
|
|
927
930
|
}
|
|
928
931
|
case "vllm": {
|
|
932
|
+
const { loginVllm } = await import("./utils/oauth/vllm");
|
|
929
933
|
const apiKey = await loginVllm(ctrl);
|
|
930
934
|
await saveApiKeyCredential(apiKey);
|
|
931
935
|
return;
|
|
932
936
|
}
|
|
933
937
|
case "parallel": {
|
|
938
|
+
const { loginParallel } = await import("./utils/oauth/parallel");
|
|
934
939
|
const apiKey = await loginParallel(ctrl);
|
|
935
940
|
await saveApiKeyCredential(apiKey);
|
|
936
941
|
return;
|
|
937
942
|
}
|
|
938
943
|
case "qwen-portal": {
|
|
944
|
+
const { loginQwenPortal } = await import("./utils/oauth/qwen-portal");
|
|
939
945
|
const apiKey = await loginQwenPortal(ctrl);
|
|
940
946
|
await saveApiKeyCredential(apiKey);
|
|
941
947
|
return;
|
|
942
948
|
}
|
|
943
949
|
case "nvidia": {
|
|
950
|
+
const { loginNvidia } = await import("./utils/oauth/nvidia");
|
|
944
951
|
const apiKey = await loginNvidia(ctrl);
|
|
945
952
|
await saveApiKeyCredential(apiKey);
|
|
946
953
|
return;
|
|
947
954
|
}
|
|
948
955
|
case "xiaomi": {
|
|
956
|
+
const { loginXiaomi } = await import("./utils/oauth/xiaomi");
|
|
949
957
|
const apiKey = await loginXiaomi(ctrl);
|
|
950
958
|
await saveApiKeyCredential(apiKey);
|
|
951
959
|
return;
|
|
952
960
|
}
|
|
953
961
|
case "zenmux": {
|
|
962
|
+
const { loginZenMux } = await import("./utils/oauth/zenmux");
|
|
954
963
|
const apiKey = await loginZenMux(ctrl);
|
|
955
964
|
await saveApiKeyCredential(apiKey);
|
|
956
965
|
return;
|
package/src/cli.ts
CHANGED
|
@@ -2,23 +2,7 @@
|
|
|
2
2
|
import * as readline from "node:readline";
|
|
3
3
|
import { AuthCredentialStore } from "./auth-storage";
|
|
4
4
|
import { getOAuthProviders } from "./utils/oauth";
|
|
5
|
-
import { loginAnthropic } from "./utils/oauth/anthropic";
|
|
6
|
-
import { loginCursor } from "./utils/oauth/cursor";
|
|
7
|
-
import { loginGitHubCopilot } from "./utils/oauth/github-copilot";
|
|
8
|
-
import { loginAntigravity } from "./utils/oauth/google-antigravity";
|
|
9
|
-
import { loginGeminiCli } from "./utils/oauth/google-gemini-cli";
|
|
10
|
-
import { loginKagi } from "./utils/oauth/kagi";
|
|
11
|
-
import { loginKilo } from "./utils/oauth/kilo";
|
|
12
|
-
import { loginKimi } from "./utils/oauth/kimi";
|
|
13
|
-
import { loginMiniMaxCode, loginMiniMaxCodeCn } from "./utils/oauth/minimax-code";
|
|
14
|
-
import { loginNanoGPT } from "./utils/oauth/nanogpt";
|
|
15
|
-
import { loginOllamaCloud } from "./utils/oauth/ollama-cloud";
|
|
16
|
-
import { loginOpenAICodex } from "./utils/oauth/openai-codex";
|
|
17
|
-
import { loginParallel } from "./utils/oauth/parallel";
|
|
18
|
-
import { loginTavily } from "./utils/oauth/tavily";
|
|
19
5
|
import type { OAuthCredentials, OAuthProvider } from "./utils/oauth/types";
|
|
20
|
-
import { loginZai } from "./utils/oauth/zai";
|
|
21
|
-
import { loginZenMux } from "./utils/oauth/zenmux";
|
|
22
6
|
|
|
23
7
|
const PROVIDERS = getOAuthProviders();
|
|
24
8
|
|
|
@@ -82,7 +66,8 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
82
66
|
let credentials: OAuthCredentials;
|
|
83
67
|
|
|
84
68
|
switch (provider) {
|
|
85
|
-
case "anthropic":
|
|
69
|
+
case "anthropic": {
|
|
70
|
+
const { loginAnthropic } = await import("./utils/oauth/anthropic");
|
|
86
71
|
credentials = await loginAnthropic({
|
|
87
72
|
onAuth(info) {
|
|
88
73
|
const { url } = info;
|
|
@@ -93,8 +78,10 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
93
78
|
},
|
|
94
79
|
});
|
|
95
80
|
break;
|
|
81
|
+
}
|
|
96
82
|
|
|
97
|
-
case "github-copilot":
|
|
83
|
+
case "github-copilot": {
|
|
84
|
+
const { loginGitHubCopilot } = await import("./utils/oauth/github-copilot");
|
|
98
85
|
credentials = await loginGitHubCopilot({
|
|
99
86
|
onAuth(url, instructions) {
|
|
100
87
|
console.log(`\nOpen this URL in your browser:\n${url}`);
|
|
@@ -106,8 +93,10 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
106
93
|
},
|
|
107
94
|
});
|
|
108
95
|
break;
|
|
96
|
+
}
|
|
109
97
|
|
|
110
|
-
case "google-gemini-cli":
|
|
98
|
+
case "google-gemini-cli": {
|
|
99
|
+
const { loginGeminiCli } = await import("./utils/oauth/google-gemini-cli");
|
|
111
100
|
credentials = await loginGeminiCli({
|
|
112
101
|
onAuth(info) {
|
|
113
102
|
const { url, instructions } = info;
|
|
@@ -117,8 +106,10 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
117
106
|
},
|
|
118
107
|
});
|
|
119
108
|
break;
|
|
109
|
+
}
|
|
120
110
|
|
|
121
|
-
case "google-antigravity":
|
|
111
|
+
case "google-antigravity": {
|
|
112
|
+
const { loginAntigravity } = await import("./utils/oauth/google-antigravity");
|
|
122
113
|
credentials = await loginAntigravity({
|
|
123
114
|
onAuth(info) {
|
|
124
115
|
const { url, instructions } = info;
|
|
@@ -128,7 +119,9 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
128
119
|
},
|
|
129
120
|
});
|
|
130
121
|
break;
|
|
131
|
-
|
|
122
|
+
}
|
|
123
|
+
case "openai-codex": {
|
|
124
|
+
const { loginOpenAICodex } = await import("./utils/oauth/openai-codex");
|
|
132
125
|
credentials = await loginOpenAICodex({
|
|
133
126
|
onAuth(info) {
|
|
134
127
|
const { url, instructions } = info;
|
|
@@ -141,8 +134,10 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
141
134
|
},
|
|
142
135
|
});
|
|
143
136
|
break;
|
|
137
|
+
}
|
|
144
138
|
|
|
145
|
-
case "kimi-code":
|
|
139
|
+
case "kimi-code": {
|
|
140
|
+
const { loginKimi } = await import("./utils/oauth/kimi");
|
|
146
141
|
credentials = await loginKimi({
|
|
147
142
|
onAuth(info) {
|
|
148
143
|
const { url, instructions } = info;
|
|
@@ -152,7 +147,9 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
152
147
|
},
|
|
153
148
|
});
|
|
154
149
|
break;
|
|
155
|
-
|
|
150
|
+
}
|
|
151
|
+
case "kilo": {
|
|
152
|
+
const { loginKilo } = await import("./utils/oauth/kilo");
|
|
156
153
|
credentials = await loginKilo({
|
|
157
154
|
onAuth(info) {
|
|
158
155
|
const { url, instructions } = info;
|
|
@@ -162,7 +159,9 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
162
159
|
},
|
|
163
160
|
});
|
|
164
161
|
break;
|
|
162
|
+
}
|
|
165
163
|
case "kagi": {
|
|
164
|
+
const { loginKagi } = await import("./utils/oauth/kagi");
|
|
166
165
|
const apiKey = await loginKagi({
|
|
167
166
|
onAuth(info) {
|
|
168
167
|
const { url, instructions } = info;
|
|
@@ -179,6 +178,7 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
179
178
|
return;
|
|
180
179
|
}
|
|
181
180
|
case "tavily": {
|
|
181
|
+
const { loginTavily } = await import("./utils/oauth/tavily");
|
|
182
182
|
const apiKey = await loginTavily({
|
|
183
183
|
onAuth(info) {
|
|
184
184
|
const { url, instructions } = info;
|
|
@@ -195,6 +195,7 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
195
195
|
return;
|
|
196
196
|
}
|
|
197
197
|
case "parallel": {
|
|
198
|
+
const { loginParallel } = await import("./utils/oauth/parallel");
|
|
198
199
|
const apiKey = await loginParallel({
|
|
199
200
|
onAuth(info) {
|
|
200
201
|
const { url, instructions } = info;
|
|
@@ -211,7 +212,8 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
211
212
|
return;
|
|
212
213
|
}
|
|
213
214
|
|
|
214
|
-
case "cursor":
|
|
215
|
+
case "cursor": {
|
|
216
|
+
const { loginCursor } = await import("./utils/oauth/cursor");
|
|
215
217
|
credentials = await loginCursor(
|
|
216
218
|
url => {
|
|
217
219
|
console.log(`\nOpen this URL in your browser:\n${url}\n`);
|
|
@@ -221,8 +223,10 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
221
223
|
},
|
|
222
224
|
);
|
|
223
225
|
break;
|
|
226
|
+
}
|
|
224
227
|
|
|
225
228
|
case "zai": {
|
|
229
|
+
const { loginZai } = await import("./utils/oauth/zai");
|
|
226
230
|
const apiKey = await loginZai({
|
|
227
231
|
onAuth(info) {
|
|
228
232
|
const { url, instructions } = info;
|
|
@@ -240,6 +244,7 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
240
244
|
}
|
|
241
245
|
|
|
242
246
|
case "nanogpt": {
|
|
247
|
+
const { loginNanoGPT } = await import("./utils/oauth/nanogpt");
|
|
243
248
|
const apiKey = await loginNanoGPT({
|
|
244
249
|
onAuth(info) {
|
|
245
250
|
const { url, instructions } = info;
|
|
@@ -257,6 +262,7 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
257
262
|
}
|
|
258
263
|
|
|
259
264
|
case "zenmux": {
|
|
265
|
+
const { loginZenMux } = await import("./utils/oauth/zenmux");
|
|
260
266
|
const apiKey = await loginZenMux({
|
|
261
267
|
onAuth(info) {
|
|
262
268
|
const { url, instructions } = info;
|
|
@@ -273,6 +279,7 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
273
279
|
return;
|
|
274
280
|
}
|
|
275
281
|
case "ollama-cloud": {
|
|
282
|
+
const { loginOllamaCloud } = await import("./utils/oauth/ollama-cloud");
|
|
276
283
|
const apiKey = await loginOllamaCloud({
|
|
277
284
|
onAuth(info) {
|
|
278
285
|
const { url, instructions } = info;
|
|
@@ -290,6 +297,7 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
290
297
|
}
|
|
291
298
|
|
|
292
299
|
case "minimax-code": {
|
|
300
|
+
const { loginMiniMaxCode } = await import("./utils/oauth/minimax-code");
|
|
293
301
|
const apiKey = await loginMiniMaxCode({
|
|
294
302
|
onAuth(info) {
|
|
295
303
|
const { url, instructions } = info;
|
|
@@ -307,6 +315,7 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
307
315
|
}
|
|
308
316
|
|
|
309
317
|
case "minimax-code-cn": {
|
|
318
|
+
const { loginMiniMaxCodeCn } = await import("./utils/oauth/minimax-code");
|
|
310
319
|
const apiKey = await loginMiniMaxCodeCn({
|
|
311
320
|
onAuth(info) {
|
|
312
321
|
const { url, instructions } = info;
|
package/src/index.ts
CHANGED
|
@@ -10,11 +10,12 @@ export * from "./provider-details";
|
|
|
10
10
|
export * from "./provider-models";
|
|
11
11
|
export * from "./providers/anthropic";
|
|
12
12
|
export * from "./providers/azure-openai-responses";
|
|
13
|
-
export * from "./providers/cursor";
|
|
13
|
+
export type * from "./providers/cursor";
|
|
14
14
|
export * from "./providers/gitlab-duo";
|
|
15
|
-
export * from "./providers/google";
|
|
16
|
-
export * from "./providers/google-gemini-cli";
|
|
17
|
-
export * from "./providers/google-
|
|
15
|
+
export type * from "./providers/google";
|
|
16
|
+
export type * from "./providers/google-gemini-cli";
|
|
17
|
+
export * from "./providers/google-gemini-headers";
|
|
18
|
+
export type * from "./providers/google-vertex";
|
|
18
19
|
export * from "./providers/kimi";
|
|
19
20
|
export * from "./providers/ollama";
|
|
20
21
|
export type { OpenAICodexResponsesOptions } from "./providers/openai-codex-responses";
|
|
@@ -36,7 +37,6 @@ export * from "./usage/zai";
|
|
|
36
37
|
export * from "./utils/anthropic-auth";
|
|
37
38
|
export * from "./utils/discovery";
|
|
38
39
|
export * from "./utils/event-stream";
|
|
39
|
-
export * from "./utils/oauth";
|
|
40
40
|
export * from "./utils/overflow";
|
|
41
41
|
export * from "./utils/retry";
|
|
42
42
|
export * from "./utils/schema";
|