Skip to content

feat: integrate Neon AI Gateway support and enhance CLI functionality: - #329

Merged
yashdev9274 merged 1 commit into
mainfrom
supercode-cli
Oct 27, 2026
Merged

yashdev9274 merged 1 commit into
mainfrom
supercode-cli

Conversation

@yashdev9274

@yashdev9274 yashdev9274 commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner
  • Added support for the Neon AI Gateway, including configuration and connection management.
  • Introduced new commands for connecting to the Neon service and managing API keys.
  • Implemented Neon-specific model handling and routing within the AI provider framework.
  • Enhanced the README with instructions for using the Neon AI Gateway.
  • Updated various components to accommodate the new Neon integration, including CLI prompts and model selection.
  • Added tests for Neon configuration and model routing to ensure reliability and correctness.

Description

Please include a summary of the change and which issue is fixed.

Fixes #(issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

  • bun test passes
  • bun run typecheck passes
  • bun run lint passes (if applicable)

Checklist:

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Summary by CodeRabbit

  • New Features
    • Added Neon AI Gateway support to the CLI, including provider setup, model selection, and streaming chat.
    • Added a searchable, provider-filterable model catalog in Settings. Model selections are saved for each signed-in user and restored during the session.
    • Added model and provider logos throughout the catalog.
  • Documentation
    • Added Neon setup guidance, including requirements, configuration, access, and known limitations.
  • Bug Fixes
    • Improved handling of invalid question selections and AI stream errors.

- Added support for the Neon AI Gateway, including configuration and connection management.
- Introduced new commands for connecting to the Neon service and managing API keys.
- Implemented Neon-specific model handling and routing within the AI provider framework.
- Enhanced the README with instructions for using the Neon AI Gateway.
- Updated various components to accommodate the new Neon integration, including CLI prompts and model selection.
- Added tests for Neon configuration and model routing to ensure reliability and correctness.
@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
supercli Ready Ready Preview Oct 27, 2026 6:28am UTC
supercli-client Ready Ready Preview Oct 27, 2026 6:28am UTC
supercli-docs Ready Ready Preview Oct 27, 2026 6:28am UTC
vercel-supercodeai-integration Ready Ready Preview Oct 27, 2026 6:28am UTC

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Walkthrough

The changes add Neon AI Gateway support across the CLI and server, and add a searchable model catalog and selection settings to the web app. They also update MergeDev connector handling, several CLI behaviors, and Nova page metadata.

Changes

Neon AI Gateway support

Layer / File(s) Summary
Gateway configuration and model access
apps/supercode-cli/server/config/neon.config.ts, apps/supercode-cli/server/src/cli/ai/provider.ts, apps/supercode-cli/server/src/lib/model-access.ts, apps/supercode-cli/server/package.json, apps/supercode-cli/server/README.md, apps/supercode-cli/server/src/runtime/config/cli-config.ts
The server adds Neon URL and credential validation, a default model, provider configuration, and model access entries. The package adds the Neon SDK provider and raises the minimum Node.js version. The README documents setup and usage.
CLI Neon connection and provider
apps/supercode-cli/server/src/cli/commands/slashCommands/connect-neon.ts, apps/supercode-cli/server/src/cli/commands/slashCommands/connect.ts, apps/supercode-cli/server/src/cli/commands/slashCommands/model.ts, apps/supercode-cli/server/src/cli/ai/neon-service.ts, apps/supercode-cli/server/src/cli/ai/provider.ts, apps/supercode-cli/server/src/cli/ai/adapters/openai-compatible.ts
The CLI adds Neon connection prompts and model choices. The provider constructs a Neon service with streaming and object-generation support. The adapter accepts a native model override and throws full-stream errors.
Server streaming and generation
apps/supercode-cli/server/src/runtime/stream/neon-stream.ts, apps/supercode-cli/server/src/index.ts, apps/supercode-cli/server/src/config/neon.test.ts
The server converts messages and tools for Neon requests, streams chat events, records usage, checks model access, and handles structured generation. Tests cover configuration, provider routing, and message and tool conversion.

Web model catalog and settings

Layer / File(s) Summary
Provider catalog, filtering, and logos
apps/web/modules/nova-web/models.ts, apps/web/modules/nova-web/model-settings.ts, apps/web/modules/nova-web/model-logos.ts, apps/web/modules/nova-web/model-settings.test.ts, apps/web/modules/nova-web/model-logos.test.ts, apps/web/public/logos/models/LICENSE
The catalog adds Neon provider metadata and nine models. New helpers describe provider configuration, validate model selections, filter catalog entries, and map models to logos. Tests cover catalog, filtering, selection parsing, and logo mappings.
Model settings and saved selection
apps/web/modules/nova-web/settings-sections.ts, apps/web/modules/nova-web/components/settings.tsx, apps/web/modules/nova-web/components/settings-models.tsx, apps/web/modules/nova-web/nova-app.tsx
Settings adds a Models section with provider filters, search, expandable model details, and selection callbacks. The app restores and saves user-specific model selections in session storage.

MergeDev connector connection

Layer / File(s) Summary
MergeDev configuration and connection
apps/supercode-cli/server/src/connectors/mergedev.ts, apps/supercode-cli/server/src/cli/commands/slashCommands/connectors.ts
The connector manager stores explicit configuration. The CLI displays MergeDev status from the MCP manager, masks the API key prompt, and reconnects the configured MCP server.

CLI and agent behavior adjustments

Layer / File(s) Summary
Question and todo rendering
apps/supercode-cli/server/src/agents/tools/question.ts, apps/supercode-cli/server/src/agents/tools/todowrite.ts
Question selection resolves labels through the available options. Todo rendering tracks the active todo object.
CLI and SDK type alignment
apps/supercode-cli/server/src/cli/ai/chat/chat.ts, apps/supercode-cli/server/src/cli/commands/login.ts, apps/supercode-cli/server/src/cli/tui/index.tsx, apps/supercode-cli/server/src/config/agent-config.ts, apps/supercode-cli/server/src/types/bun-test.d.ts, apps/supercode-cli/server/src/index.ts, apps/supercode-cli/server/src/runtime/stream/openai-compatible-stream.ts
Chat mode selection uses values from the mode tuple, login forwards parsed options, and tool definitions use inputSchema. The TUI and test declarations use updated types. The stream compatibility comments are removed without changing the guarded flush calls.

Nova page metadata

Layer / File(s) Summary
Canonical and social metadata
apps/web/app/(nova-app)/layout.tsx
The layout adds canonical URL, Open Graph, and Twitter large-image metadata.

Priority: Not assessed

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ChatAPI as api/ai/chat
  participant Stream as streamNeonChat
  participant SDK as Neon AI SDK
  Client->>ChatAPI: Send chat request
  ChatAPI->>Stream: Pass model, messages, tools, and response writer
  Stream->>SDK: Stream converted messages and tools
  SDK-->>Stream: Return text, reasoning, tool-call, and usage events
  Stream-->>ChatAPI: Write events and return usage
  ChatAPI-->>Client: End response and record usage
Loading
Merge Risk: Moderate · up to a9f41

Two behaviors should be fixed before merging. A user who mistypes MergeDev credentials cannot correct them in the same session. A login against a custom server stores a token that later requests may send to a different server. ConcentrateAI error handling also loses its non-streaming fallback.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

I’m a rabbit with a model to choose,
Neon hops in with fresh gateway routes.
I search the list and save my pick,
While streams bring answers, smooth and quick.
I twitch my ears and nibble a leaf,
Then bound along, content and brief.

Comment @coderabbitai help to get the list of available commands.

]

export const ALL_MODELS: NovaModelEntry[] = [
...NEON_MODELS,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prepending Neon changes model-only kimi-k3 requests from Supercode Cloud to Neon, causing previously working turns to require separately configured Neon credentials.

Fix on Vercel

@greptile-apps

greptile-apps Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 3/5 Tier: plus

[Medium impact] The changes add Neon as an optional model route for CLI and Nova users.

Fix Neon startup recovery and object usage accounting before merging.

Findings

  1. P1 Neon blocks the next launch ▶
  2. P1 Object requests escape usage limits ▶
  3. P2 Neon spending shows as zero ▶
  4. P2 Neon requests go untested ▶

Summary

Adds Neon AI Gateway support to the CLI and Nova.

  • The CLI connects to Neon and offers its models for chat.
  • Nova’s harness sends Neon requests through its server.
  • Nova Settings lets people search models and choose one to use.
  • Merge Agent Handler setup connects the configured Tool Pack.
  • Nova pages now include social preview details.
  • The login command passes its server URL option to the login flow.
  • Several CLI helpers use clearer types and local values.

Known limits documented by yashdev9274: Gemini structured output and multi-step tools are unsupported; Responses tool continuations may fail upstream.

Static review only; tests and UI checks were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  CLI["CLI: connect or select Neon"] --> ENV["Session URL and token"]
  ENV --> SERVICE["NeonService"]
  NOVA["Nova model picker or Settings"] --> API["Authenticated harness request"]
  API --> GATE["Plan and budget checks"]
  GATE --> STREAM["streamNeonChat"]
  SERVICE --> SDK["Native Neon model"]
  STREAM --> SDK
  SDK --> CLAUDE["Claude: Messages"]
  SDK --> GPT["OpenAI: Responses"]
  SDK --> OTHER["Other models: Chat Completions"]
  STREAM --> EVENTS["Nova text and tool events"]
Loading

Reviews (1) · Last reviewed commit: "feat: integrate Neon AI Gateway support ..." · Reviewed by Greptile

Comment on lines +31 to +32
process.env.NEON_AI_GATEWAY_BASE_URL = baseURL
process.env.NEON_AI_GATEWAY_TOKEN = token

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Neon blocks the next launch

Connecting through the prompts saves provider: "neon", but these credentials disappear when the process exits. On the next supercode init, bootstrapSession keeps Neon selected even without credentials. startChat then calls createProvider and exits before the user can run /connect.

Keep the credentials session-only, but add a startup fallback or prompt before creating the saved Neon provider.

Comment on lines +1491 to +1492
const result = await generateObject({ model: createNeonModel(modelName), schema: jsonSchema(schema), prompt, abortSignal: AbortSignal.timeout(120_000) })
res.json({ object: result.object })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Object requests escape usage limits

The new Neon branch returns result.object without recording result.usage. The monthly request limit counts usageEvent rows, and the daily token budget sums their tokens. Repeated successful Neon object requests therefore never advance either limit.

Record their usage before returning, as the Neon chat branch does.

const cachedInputTokens = usage.inputTokenDetails?.cacheReadTokens ?? 0
recordUsage({ provider: "neon", model: modelName, inputTokens, outputTokens, cachedInputTokens,
totalTokens: usage.totalTokens ?? inputTokens + outputTokens,
costUsd: computeCost(modelName, inputTokens, outputTokens, cachedInputTokens),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Neon spending shows as zero

For the default gpt-5-mini, and every listed Neon model except kimi-k3, computeCost has no matching price and returns 0. Nova adds these records to its spend totals, so successful Neon calls show no spend despite consuming gateway credits.

Add prices or model-name aliases for the new catalog before recording their cost.

Comment on lines +18 to +26
test("routes all picker models to native SDK endpoints", () => {
const provider = createNeon({ baseURL: "https://branch.example", apiKey: "synthetic-test-token" })
for (const entry of NEON_MODELS) {
const model = provider(entry.id)
expect(model.modelId).toBe(entry.id)
}
expect(getNeonModelRoute("claude-sonnet-4-6")).toBe("anthropic")
expect(getNeonModelRoute("gpt-5-3-codex")).toBe("openai")
expect(getNeonModelRoute("kimi-k3")).toBe("mlflow")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Neon requests go untested

This routing test constructs createNeon directly and only reads model metadata. It never covers this PR's createNeonModel or streamNeonChat request path, so a broken endpoint or request body can pass unchanged.

Add a fake fetch test for each route that checks the URL, auth header, streamed response, and tool round-trip.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@yashdev9274
yashdev9274 merged commit 5816c42 into main Oct 27, 2026
7 of 10 checks passed

This branch was successfully deployed

4 active deployments
Preview – supercli — a9f41afb Deployed Oct 27, 2026 by vercel[bot]
Preview – vercel-supercodeai-integration — a9f41afb Deployed Oct 27, 2026 by vercel[bot]
Preview – supercli-client — a9f41afb Deployed Oct 27, 2026 by vercel[bot]
Preview – supercli-docs — a9f41afb Deployed Oct 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant