Repository navigation
feat: integrate Neon AI Gateway support and enhance CLI functionality: - #329
Conversation
- 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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. WalkthroughThe 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. ChangesNeon AI Gateway support
Web model catalog and settings
MergeDev connector connection
CLI and agent behavior adjustments
Nova page metadata
Priority: 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
Merge Risk:
|
| ] | ||
|
|
||
| export const ALL_MODELS: NovaModelEntry[] = [ | ||
| ...NEON_MODELS, |
[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
|
| process.env.NEON_AI_GATEWAY_BASE_URL = baseURL | ||
| process.env.NEON_AI_GATEWAY_TOKEN = token |
There was a problem hiding this comment.
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.
| const result = await generateObject({ model: createNeonModel(modelName), schema: jsonSchema(schema), prompt, abortSignal: AbortSignal.timeout(120_000) }) | ||
| res.json({ object: result.object }) |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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.
| 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") |
There was a problem hiding this comment.
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!
Description
Please include a summary of the change and which issue is fixed.
Fixes #(issue)
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
bun testpassesbun run typecheckpassesbun run lintpasses (if applicable)Checklist:
Summary by CodeRabbit