Skip to content

Commit 4f69f1c

Browse files
committed
fix: add projectId warning logs and blackbox.ai provider (#175, #176)
- Added warning logs when generateProjectId() is used as fallback in antigravity.ts and openai-to-gemini.ts (3 locations), helping admins diagnose 404 errors from fake GCP project IDs (#176) - Added blackbox.ai as new OpenAI-compatible provider with 6 models (GPT-4o, Gemini 2.5 Flash, Claude Sonnet 4, DeepSeek V3, Blackbox AI, Blackbox AI Pro) and provider logo (#175)
1 parent 1b422ed commit 4f69f1c

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,17 @@ export class AntigravityExecutor extends BaseExecutor {
3636
}
3737

3838
transformRequest(model, body, stream, credentials) {
39+
const hasRealProject = !!credentials?.projectId;
3940
const projectId = credentials?.projectId || this.generateProjectId();
4041

42+
if (!hasRealProject) {
43+
console.warn(
44+
`[Antigravity] ⚠️ No projectId in credentials — using generated fallback "${projectId}". ` +
45+
`This may cause 404 errors if the account has no active GCP project. ` +
46+
`Ensure the OAuth token includes a valid project.`
47+
);
48+
}
49+
4150
// Fix contents for Claude models via Antigravity
4251
const normalizedContents =
4352
body.request?.contents?.map((c) => {

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)