@oh-my-pi/pi-ai 12.12.3 → 12.13.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/README.md +6 -2
- package/package.json +2 -2
- package/src/cli.ts +19 -0
- package/src/models.json +10499 -63
- package/src/provider-models/descriptors.ts +7 -0
- package/src/provider-models/openai-compat.ts +91 -8
- package/src/stream.ts +1 -0
- package/src/types.ts +1 -0
- package/src/utils/discovery/gemini.ts +3 -4
- package/src/utils/discovery/openai-compatible.ts +3 -4
- package/src/utils/oauth/index.ts +9 -0
- package/src/utils/oauth/nanogpt.ts +52 -0
- package/src/utils/oauth/types.ts +1 -0
package/README.md
CHANGED
|
@@ -58,6 +58,7 @@ Unified LLM API with automatic model discovery, provider configuration, token an
|
|
|
58
58
|
- **Moonshot** (requires `MOONSHOT_API_KEY`)
|
|
59
59
|
- **Qianfan** (requires `QIANFAN_API_KEY`)
|
|
60
60
|
- **NVIDIA** (requires `NVIDIA_API_KEY`)
|
|
61
|
+
- **NanoGPT** (requires `NANO_GPT_API_KEY`)
|
|
61
62
|
- **Hugging Face Inference**
|
|
62
63
|
- **xAI**
|
|
63
64
|
- **Venice** (requires `VENICE_API_KEY`)
|
|
@@ -916,6 +917,7 @@ In Node.js environments, you can set environment variables to avoid passing API
|
|
|
916
917
|
| Hugging Face | `HUGGINGFACE_HUB_TOKEN` or `HF_TOKEN` |
|
|
917
918
|
| Synthetic | `SYNTHETIC_API_KEY` |
|
|
918
919
|
| NVIDIA | `NVIDIA_API_KEY` |
|
|
920
|
+
| NanoGPT | `NANO_GPT_API_KEY` |
|
|
919
921
|
| Venice | `VENICE_API_KEY` |
|
|
920
922
|
| Moonshot | `MOONSHOT_API_KEY` |
|
|
921
923
|
| xAI | `XAI_API_KEY` |
|
|
@@ -939,6 +941,7 @@ Provider endpoint defaults for the current OpenAI-compatible integrations:
|
|
|
939
941
|
- Moonshot: `https://api.moonshot.ai/v1`
|
|
940
942
|
- Qianfan: `https://qianfan.baidubce.com/v2`
|
|
941
943
|
- NVIDIA: `https://integrate.api.nvidia.com/v1`
|
|
944
|
+
- NanoGPT: `https://nano-gpt.com/api/v1`
|
|
942
945
|
- Hugging Face Inference: `https://router.huggingface.co/v1`
|
|
943
946
|
- Venice: `https://api.venice.ai/api/v1`
|
|
944
947
|
- Xiaomi MiMo: `https://api.xiaomimimo.com/anthropic`
|
|
@@ -1035,7 +1038,7 @@ Credentials are saved to `agent.db` in the agent directory. `/login qianfan` ope
|
|
|
1035
1038
|
|
|
1036
1039
|
`login` supports OAuth providers (Anthropic, OpenAI Codex, GitHub Copilot, Gemini CLI, Antigravity) and API-key onboarding flows.
|
|
1037
1040
|
|
|
1038
|
-
For the current OpenAI-compatible integrations, API-key onboarding covers Together, Moonshot, Qianfan, NVIDIA, Hugging Face, Venice, Xiaomi, vLLM, LiteLLM, Cloudflare AI Gateway, and Qwen Portal. Ollama is typically local and unauthenticated; set `OLLAMA_API_KEY` only when your Ollama deployment enforces bearer auth.
|
|
1041
|
+
For the current OpenAI-compatible integrations, API-key onboarding covers Together, Moonshot, Qianfan, NVIDIA, NanoGPT, Hugging Face, Venice, Xiaomi, vLLM, LiteLLM, Cloudflare AI Gateway, and Qwen Portal. Ollama is typically local and unauthenticated; set `OLLAMA_API_KEY` only when your Ollama deployment enforces bearer auth.
|
|
1039
1042
|
|
|
1040
1043
|
### Programmatic OAuth
|
|
1041
1044
|
|
|
@@ -1054,6 +1057,7 @@ import {
|
|
|
1054
1057
|
loginLiteLLM,
|
|
1055
1058
|
loginMoonshot,
|
|
1056
1059
|
loginNvidia,
|
|
1060
|
+
loginNanoGPT,
|
|
1057
1061
|
loginQianfan,
|
|
1058
1062
|
loginQwenPortal,
|
|
1059
1063
|
loginTogether,
|
|
@@ -1066,7 +1070,7 @@ import {
|
|
|
1066
1070
|
getOAuthApiKey, // (provider, credentialsMap) => { newCredentials, apiKey } | null
|
|
1067
1071
|
|
|
1068
1072
|
// Types
|
|
1069
|
-
type OAuthProvider, // includes 'anthropic', 'openai-codex', 'github-copilot', 'google-gemini-cli', 'google-antigravity', 'together', 'moonshot', 'qianfan', 'nvidia', 'huggingface', 'venice', 'xiaomi', 'vllm', 'litellm', 'cloudflare-ai-gateway', 'qwen-portal', ...
|
|
1073
|
+
type OAuthProvider, // includes 'anthropic', 'openai-codex', 'github-copilot', 'google-gemini-cli', 'google-antigravity', 'together', 'moonshot', 'qianfan', 'nvidia', 'nanogpt', 'huggingface', 'venice', 'xiaomi', 'vllm', 'litellm', 'cloudflare-ai-gateway', 'qwen-portal', ...
|
|
1070
1074
|
type OAuthCredentials,
|
|
1071
1075
|
} from "@oh-my-pi/pi-ai";
|
|
1072
1076
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-ai",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.13.0",
|
|
4
4
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@connectrpc/connect-node": "^2.1.1",
|
|
64
64
|
"@google/genai": "^1.41.0",
|
|
65
65
|
"@mistralai/mistralai": "^1.14.0",
|
|
66
|
-
"@oh-my-pi/pi-utils": "12.
|
|
66
|
+
"@oh-my-pi/pi-utils": "12.13.0",
|
|
67
67
|
"@sinclair/typebox": "^0.34.48",
|
|
68
68
|
"@smithy/node-http-handler": "^4.4.10",
|
|
69
69
|
"ajv": "^8.18.0",
|
package/src/cli.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { loginAntigravity } from "./utils/oauth/google-antigravity";
|
|
|
9
9
|
import { loginGeminiCli } from "./utils/oauth/google-gemini-cli";
|
|
10
10
|
import { loginKimi } from "./utils/oauth/kimi";
|
|
11
11
|
import { loginMiniMaxCode, loginMiniMaxCodeCn } from "./utils/oauth/minimax-code";
|
|
12
|
+
import { loginNanoGPT } from "./utils/oauth/nanogpt";
|
|
12
13
|
import { loginOpenAICodex } from "./utils/oauth/openai-codex";
|
|
13
14
|
import type { OAuthCredentials, OAuthProvider } from "./utils/oauth/types";
|
|
14
15
|
import { loginZai } from "./utils/oauth/zai";
|
|
@@ -174,6 +175,23 @@ async function login(provider: OAuthProvider): Promise<void> {
|
|
|
174
175
|
return;
|
|
175
176
|
}
|
|
176
177
|
|
|
178
|
+
case "nanogpt": {
|
|
179
|
+
const apiKey = await loginNanoGPT({
|
|
180
|
+
onAuth(info) {
|
|
181
|
+
const { url, instructions } = info;
|
|
182
|
+
console.log(`\nOpen this URL in your browser:\n${url}`);
|
|
183
|
+
if (instructions) console.log(instructions);
|
|
184
|
+
console.log();
|
|
185
|
+
},
|
|
186
|
+
onPrompt(p) {
|
|
187
|
+
return promptFn(`${p.message}${p.placeholder ? ` (${p.placeholder})` : ""}:`);
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
storage.saveApiKey(provider, apiKey);
|
|
191
|
+
console.log(`\nAPI key saved to ~/.omp/agent/agent.db`);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
177
195
|
case "minimax-code": {
|
|
178
196
|
const apiKey = await loginMiniMaxCode({
|
|
179
197
|
onAuth(info) {
|
|
@@ -242,6 +260,7 @@ Providers:
|
|
|
242
260
|
openai-codex OpenAI Codex (ChatGPT Plus/Pro)
|
|
243
261
|
kimi-code Kimi Code
|
|
244
262
|
zai Z.AI (GLM Coding Plan)
|
|
263
|
+
nanogpt NanoGPT
|
|
245
264
|
minimax-code MiniMax Coding Plan (International)
|
|
246
265
|
minimax-code-cn MiniMax Coding Plan (China)
|
|
247
266
|
cursor Cursor (Claude, GPT, etc.)
|