omp-multi-auth 1.0.3 → 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 +20 -6
- package/extensions/lib/providers.ts +61 -19
- package/extensions/multi-auth.ts +1 -1
- package/package.json +1 -1
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 |
|
|
84
|
-
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
|
|
88
|
-
|
|
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).
|
|
@@ -114,17 +129,22 @@ export const SUB_TRANSPORT_CONFIG: Record<string, { builtinApi: Api | ((modelId:
|
|
|
114
129
|
};
|
|
115
130
|
|
|
116
131
|
|
|
117
|
-
|
|
132
|
+
const ANTIGRAVITY_ZWSP = "\u200B";
|
|
133
|
+
|
|
134
|
+
/** Substrings that make up Cloud Code Assist's system-prompt abuse fingerprint
|
|
135
|
+
* (omp #11699, #12655). The live trigger is the `<conventions>` tag plus the
|
|
136
|
+
* `RFC 2119: ...` sentence; breaking any one component defeats it. */
|
|
137
|
+
export const ANTIGRAVITY_FINGERPRINTS = ["RFC 2119", "<conventions>", "</conventions>"] as const;
|
|
118
138
|
|
|
119
|
-
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
139
|
+
/** Break Cloud Code Assist's system-prompt fingerprint so it stops masking
|
|
140
|
+
* requests as 429 RESOURCE_EXHAUSTED (omp #11699, #12655). A zero-width space is
|
|
141
|
+
* inserted into each flagged substring: invisible to the model, but it breaks
|
|
142
|
+
* the contiguous literal the upstream WAF matches. Idempotent — a second pass
|
|
143
|
+
* finds no intact substring. Content is otherwise preserved. */
|
|
122
144
|
export function defeatAntigravityFingerprint(text: string): string {
|
|
123
145
|
let out = text;
|
|
124
|
-
for (const
|
|
125
|
-
out = out
|
|
126
|
-
.split(`<${tag}>`).join(`<${tag.toUpperCase()}>`)
|
|
127
|
-
.split(`</${tag}>`).join(`</${tag.toUpperCase()}>`);
|
|
146
|
+
for (const s of ANTIGRAVITY_FINGERPRINTS) {
|
|
147
|
+
out = out.split(s).join(s[0] + ANTIGRAVITY_ZWSP + s.slice(1));
|
|
128
148
|
}
|
|
129
149
|
return out;
|
|
130
150
|
}
|
|
@@ -211,11 +231,35 @@ export function getSubscriptionStream(baseProvider: string): SubscriptionStream
|
|
|
211
231
|
|
|
212
232
|
export interface ProviderTemplate {
|
|
213
233
|
displayName: string;
|
|
214
|
-
apiKey?: string;
|
|
215
234
|
buildOAuth?(index: number): ProviderOAuth;
|
|
216
235
|
buildModifyModels?(providerName: string): ProviderOAuth["modifyModels"];
|
|
217
236
|
}
|
|
218
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
|
+
|
|
219
263
|
export const PROVIDER_TEMPLATES: Record<string, ProviderTemplate> = {
|
|
220
264
|
anthropic: {
|
|
221
265
|
displayName: "Anthropic (Claude Pro/Max)",
|
|
@@ -275,17 +319,16 @@ export const PROVIDER_TEMPLATES: Record<string, ProviderTemplate> = {
|
|
|
275
319
|
},
|
|
276
320
|
},
|
|
277
321
|
|
|
278
|
-
minimax: {
|
|
279
|
-
displayName: "MiniMax (Global)",
|
|
280
|
-
apiKey: "$MINIMAX_API_KEY",
|
|
281
|
-
},
|
|
282
|
-
|
|
283
|
-
"minimax-cn": {
|
|
284
|
-
displayName: "MiniMax (China)",
|
|
285
|
-
apiKey: "$MINIMAX_CN_API_KEY",
|
|
286
|
-
},
|
|
287
322
|
};
|
|
288
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
|
+
|
|
289
332
|
export const SUPPORTED_PROVIDERS = Object.keys(PROVIDER_TEMPLATES);
|
|
290
333
|
|
|
291
334
|
export function subDisplayName(entry: SubEntry): string {
|
|
@@ -348,7 +391,6 @@ export function registerSub(pi: ExtensionAPI, entry: SubEntry): void {
|
|
|
348
391
|
pi.registerProvider(name, {
|
|
349
392
|
baseUrl,
|
|
350
393
|
api: transportApi ?? builtinModels[0]?.api,
|
|
351
|
-
apiKey: template.apiKey,
|
|
352
394
|
streamSimple,
|
|
353
395
|
oauth: oauth && modifyModels ? { ...oauth, modifyModels } : oauth,
|
|
354
396
|
models,
|
package/extensions/multi-auth.ts
CHANGED
|
@@ -20,7 +20,7 @@ export default function multiSub(pi: ExtensionAPI) {
|
|
|
20
20
|
registerSub(pi, entry);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
//
|
|
23
|
+
// Break Cloud Code Assist's system-prompt fingerprint at the OMP payload seam (base provider).
|
|
24
24
|
pi.on("before_provider_request", (event, ctx) => {
|
|
25
25
|
if (ctx.model?.provider === "google-antigravity") {
|
|
26
26
|
return rewriteAntigravitySystemInstruction(event.payload);
|
package/package.json
CHANGED