Skip to content

Commit b25552e

Browse files
committed
Merge PR #183: fix projectId warnings + add blackbox.ai provider (#175, #176)
- Added warning logs when generateProjectId() is used as fallback - Prefer translator-set body.project before generating a new fallback - Added blackbox.ai as OpenAI-compatible provider with 6 models + logo - Includes improvement from Copilot PRs #184 and #185
2 parents 1b422ed + 78094af commit b25552e

File tree

4 files changed

+47
-2
lines changed

4 files changed

+47
-2
lines changed

open-sse/config/providerRegistry.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,25 @@ export const REGISTRY: Record<string, RegistryEntry> = {
641641
],
642642
},
643643

644+
blackbox: {
645+
id: "blackbox",
646+
alias: "bb",
647+
format: "openai",
648+
executor: "default",
649+
baseUrl: "https://api.blackbox.ai/v1/chat/completions",
650+
modelsUrl: "https://api.blackbox.ai/v1/models",
651+
authType: "apikey",
652+
authHeader: "bearer",
653+
models: [
654+
{ id: "gpt-4o", name: "GPT-4o" },
655+
{ id: "gemini-2.5-flash", name: "Gemini 2.5 Flash" },
656+
{ id: "claude-sonnet-4", name: "Claude Sonnet 4" },
657+
{ id: "deepseek-v3", name: "DeepSeek V3" },
658+
{ id: "blackboxai", name: "Blackbox AI" },
659+
{ id: "blackboxai-pro", name: "Blackbox AI Pro" },
660+
],
661+
},
662+
644663
xai: {
645664
id: "xai",
646665
alias: "xai",

open-sse/executors/antigravity.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,18 @@ export class AntigravityExecutor extends BaseExecutor {
3636
}
3737

3838
transformRequest(model, body, stream, credentials) {
39-
const projectId = credentials?.projectId || this.generateProjectId();
39+
const bodyProjectId = body?.project;
40+
const credentialsProjectId = credentials?.projectId;
41+
const hasExplicitProject = !!(bodyProjectId || credentialsProjectId);
42+
const projectId = bodyProjectId || credentialsProjectId || this.generateProjectId();
43+
44+
if (!hasExplicitProject) {
45+
console.warn(
46+
`[Antigravity] ⚠️ No projectId provided via body or credentials — using generated fallback "${projectId}". ` +
47+
`This may cause 404 errors if the account has no active GCP project. ` +
48+
`Ensure the OAuth token includes a valid project or the request includes a project field.`
49+
);
50+
}
4051

4152
// Fix contents for Claude models via Antigravity
4253
const normalizedContents =

open-sse/translator/request/openai-to-gemini.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,16 @@ export function openaiToGeminiCLIRequest(model, body, stream) {
271271

272272
// Wrap Gemini CLI format in Cloud Code wrapper
273273
function wrapInCloudCodeEnvelope(model, geminiCLI, credentials = null, isAntigravity = false) {
274+
const hasRealProject = !!credentials?.projectId;
274275
const projectId = credentials?.projectId || generateProjectId();
275276

277+
if (!hasRealProject) {
278+
console.warn(
279+
`[${isAntigravity ? "Antigravity" : "GeminiCLI"}] ⚠️ No projectId in credentials — using generated fallback "${projectId}". ` +
280+
`This may cause 404 errors. Ensure the OAuth token includes a valid GCP project.`
281+
);
282+
}
283+
276284
const cleanModel = model.includes("/") ? model.split("/").pop()! : model;
277285

278286
const envelope: Record<string, any> = {
@@ -315,10 +323,17 @@ function wrapInCloudCodeEnvelope(model, geminiCLI, credentials = null, isAntigra
315323
return envelope;
316324
}
317325

318-
// Wrap Claude format in Cloud Code envelope for Antigravity
319326
function wrapInCloudCodeEnvelopeForClaude(model, claudeRequest, credentials = null) {
327+
const hasRealProject = !!credentials?.projectId;
320328
const projectId = credentials?.projectId || generateProjectId();
321329

330+
if (!hasRealProject) {
331+
console.warn(
332+
`[Antigravity/Claude] ⚠️ No projectId in credentials — using generated fallback "${projectId}". ` +
333+
`This may cause 404 errors. Ensure the OAuth token includes a valid GCP project.`
334+
);
335+
}
336+
322337
const cleanModel = model.includes("/") ? model.split("/").pop()! : model;
323338

324339
const envelope: Record<string, any> = {

public/providers/blackbox.png

441 KB
Loading

0 commit comments

Comments
 (0)