omp-multi-auth 1.0.4 → 1.1.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 CHANGED
@@ -80,12 +80,26 @@ Create `.omp/multi-auth.json` in a project to restrict which subscription provid
80
80
 
81
81
  ### API key
82
82
 
83
- | Provider | Service | Environment variable |
84
- |---|---|---|
85
- | `minimax` | MiniMax (Global) | `$MINIMAX_API_KEY` |
86
- | `minimax-cn` | MiniMax (China) | `$MINIMAX_CN_API_KEY` |
87
-
88
- MiniMax providers use API keys, with one key per environment; they do not support multiple accounts. Cursor and GitLab Duo require custom handlers and are not exposed.
83
+ | Provider | Service |
84
+ |---|---|
85
+ | `openai` | OpenAI (API key) |
86
+ | `deepseek` | DeepSeek |
87
+ | `mistral` | Mistral |
88
+ | `groq` | Groq |
89
+ | `xai` | xAI (API key) |
90
+ | `google` | Google Gemini (API key) |
91
+ | `openrouter` | OpenRouter |
92
+ | `together` | Together AI |
93
+ | `fireworks` | Fireworks AI |
94
+ | `cerebras` | Cerebras |
95
+ | `moonshot` | Moonshot (Kimi) |
96
+ | `zai` | Z.AI (GLM) |
97
+ | `minimax` | MiniMax (Global) |
98
+ | `minimax-cn` | MiniMax (China) |
99
+
100
+ API-key providers support full multi-account operation. Add an account with `/multi-auth add`, select the provider, then authenticate via `/multi-auth login` (or `/login <name>`) and paste your API key when prompted. Each account stores its own key independently in OMP auth storage.
101
+
102
+ Cursor and GitLab Duo require custom handlers and are not exposed.
89
103
 
90
104
  ## Built-in limits
91
105
 
@@ -74,6 +74,21 @@ export function flowBackedOAuth(providerId: string, name: string): ProviderOAuth
74
74
  };
75
75
  }
76
76
 
77
+ export function buildApiKeyOAuth(displayName: string, index: number, placeholder: string): ProviderOAuth {
78
+ return {
79
+ name: `${displayName} #${index}`,
80
+ async login(callbacks: OAuthLoginCallbacks): Promise<string> {
81
+ const key = (await callbacks.onPrompt({
82
+ message: `Paste your ${displayName} API key:`,
83
+ placeholder,
84
+ })).trim();
85
+ if (!key) throw new Error(`No API key entered for ${displayName} #${index}`);
86
+ return key; // string return -> OMP stores {type:"api_key", key} under this provider
87
+ },
88
+ };
89
+ }
90
+
91
+
77
92
 
78
93
  // GitHub Copilot base URL derivation, ported from the pi-ai OAuth flow
79
94
  // (no longer part of the public pi-ai surface).
@@ -216,11 +231,35 @@ export function getSubscriptionStream(baseProvider: string): SubscriptionStream
216
231
 
217
232
  export interface ProviderTemplate {
218
233
  displayName: string;
219
- apiKey?: string;
220
234
  buildOAuth?(index: number): ProviderOAuth;
221
235
  buildModifyModels?(providerName: string): ProviderOAuth["modifyModels"];
222
236
  }
223
237
 
238
+ interface ApiKeyProviderSpec {
239
+ id: string; // bundled-catalog provider id
240
+ displayName: string;
241
+ placeholder: string; // key-format hint shown in the login prompt
242
+ }
243
+
244
+ // Direct-API-key providers with a static baseUrl and bearer auth in the bundled
245
+ // catalog. Add a row to support another; no other code changes are required.
246
+ export const API_KEY_PROVIDERS: ApiKeyProviderSpec[] = [
247
+ { id: "openai", displayName: "OpenAI (API key)", placeholder: "sk-..." },
248
+ { id: "deepseek", displayName: "DeepSeek", placeholder: "sk-..." },
249
+ { id: "mistral", displayName: "Mistral", placeholder: "..." },
250
+ { id: "groq", displayName: "Groq", placeholder: "gsk_..." },
251
+ { id: "xai", displayName: "xAI (API key)", placeholder: "xai-..." },
252
+ { id: "google", displayName: "Google Gemini (API key)", placeholder: "AIza..." },
253
+ { id: "openrouter", displayName: "OpenRouter", placeholder: "sk-or-..." },
254
+ { id: "together", displayName: "Together AI", placeholder: "..." },
255
+ { id: "fireworks", displayName: "Fireworks AI", placeholder: "fw_..." },
256
+ { id: "cerebras", displayName: "Cerebras", placeholder: "csk-..." },
257
+ { id: "moonshot", displayName: "Moonshot (Kimi)", placeholder: "sk-..." },
258
+ { id: "zai", displayName: "Z.AI (GLM)", placeholder: "..." },
259
+ { id: "minimax", displayName: "MiniMax (Global)", placeholder: "..." },
260
+ { id: "minimax-cn", displayName: "MiniMax (China)", placeholder: "..." },
261
+ ];
262
+
224
263
  export const PROVIDER_TEMPLATES: Record<string, ProviderTemplate> = {
225
264
  anthropic: {
226
265
  displayName: "Anthropic (Claude Pro/Max)",
@@ -280,17 +319,16 @@ export const PROVIDER_TEMPLATES: Record<string, ProviderTemplate> = {
280
319
  },
281
320
  },
282
321
 
283
- minimax: {
284
- displayName: "MiniMax (Global)",
285
- apiKey: "$MINIMAX_API_KEY",
286
- },
287
-
288
- "minimax-cn": {
289
- displayName: "MiniMax (China)",
290
- apiKey: "$MINIMAX_CN_API_KEY",
291
- },
292
322
  };
293
323
 
324
+ for (const spec of API_KEY_PROVIDERS) {
325
+ PROVIDER_TEMPLATES[spec.id] = {
326
+ displayName: spec.displayName,
327
+ buildOAuth: (index: number) => buildApiKeyOAuth(spec.displayName, index, spec.placeholder),
328
+ };
329
+ }
330
+
331
+
294
332
  export const SUPPORTED_PROVIDERS = Object.keys(PROVIDER_TEMPLATES);
295
333
 
296
334
  export function subDisplayName(entry: SubEntry): string {
@@ -353,7 +391,6 @@ export function registerSub(pi: ExtensionAPI, entry: SubEntry): void {
353
391
  pi.registerProvider(name, {
354
392
  baseUrl,
355
393
  api: transportApi ?? builtinModels[0]?.api,
356
- apiKey: template.apiKey,
357
394
  streamSimple,
358
395
  oauth: oauth && modifyModels ? { ...oauth, modifyModels } : oauth,
359
396
  models,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omp-multi-auth",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "Multi-account OAuth login for omp (Oh My Pi) -- add and manage multiple accounts per provider from one place.",
6
6
  "keywords": [