Skip to content

Add NanoGPT API support (Issue #129) - #131

Merged
jmagly merged 1 commit into
elder-plinius:mainfrom
robbee184-spec:robbee184-spec-issue-129-add-nanogpt-support-4eb1ab
Jul 31, 2026
Merged

Add NanoGPT API support (Issue #129)#131
jmagly merged 1 commit into
elder-plinius:mainfrom
robbee184-spec:robbee184-spec-issue-129-add-nanogpt-support-4eb1ab

Conversation

@robbee184-spec

@robbee184-spec robbee184-spec commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Implement native NanoGPT API provider support so users can call NanoGPT directly without routing through OpenRouter.

API contract

  • Canonical base URL: https://nano-gpt.com/api/v1
  • Chat endpoint: POST /chat/completions
  • Model discovery: GET /models
  • Authentication: Authorization: Bearer <key>
  • Environment variable: NANOGPT_API_KEY
  • Wire format: OpenAI-compatible
  • Static fail-open model: minimax/minimax-m2.7 (live discovery remains authoritative)

Changes

  • Adds nanogpt to the LLM provider/configuration surface and fallback chain.
  • Routes chat through a NanoGPT-specific OpenAI-compatible adapter with direct Bearer authentication.
  • Enables live NanoGPT model discovery through the canonical models endpoint.
  • Adds generated-env, shell setup, interactive setup, and Universal API Config coverage.
  • Redacts NanoGPT keys from exported configuration and server-visible text.
  • Strips NANOGPT_API_KEY before spawning local Codex/Claude/Hermes processes.
  • Preserves the newer Hugging Face provider added to main after the original PR head.

Verification

Exact head f60f1abf93bdfd159609c8488c4cf041db45b468:

  • npm run typecheck — pass
  • npm test — pass (65 files, 682 tests; repository self-checks pass)
  • npm run lint — pass with 0 errors (133 existing warnings)
  • npm run build --silent — pass
  • git diff --check — pass

The fallback model and its context/output/capability metadata were checked against the live GET /api/v1/models?detailed=true response. The implementation does not use or route through OpenRouter.

Fixes #129

jmagly
jmagly previously requested changes Jul 27, 2026

@jmagly jmagly left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This does not currently implement NanoGPT’s published API contract, and the exact head is not build-green.

  • npm run typecheck fails at src/__tests__/nanogpt-provider.test.ts:54 because cfg is declared but unused.
  • NanoGPT documents the OpenAI-compatible base URL as https://nano-gpt.com/api/v1, not https://api.nanogpt.com/verse1: https://docs.nano-gpt.com/
  • The documented environment variable is NANOGPT_API_KEY, not RBE_API_KEY: https://docs.nano-gpt.com/authentication
  • Model IDs should come from GET /api/v1/models; the PR hard-codes rbe-1 without support from the published model contract: https://docs.nano-gpt.com/api-reference/endpoint/models
  • Please also add nanogpt to the export-redaction invariant and env template/setup path; the current redaction test omits the new provider, so future config refactors could expose or silently mishandle this key.

Please correct the endpoint/key/model contract and make the tests validate the published interface rather than the current self-consistent constants.

@jmagly jmagly mentioned this pull request Jul 27, 2026
@jmagly
jmagly force-pushed the robbee184-spec-issue-129-add-nanogpt-support-4eb1ab branch from eaedc21 to f60f1ab Compare July 31, 2026 01:59
@jmagly

jmagly commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Maintainer courtesy update at f60f1abf93bdfd159609c8488c4cf041db45b468:

I rebased the provider work onto current main and corrected the reviewed NanoGPT contract:

  • canonical direct base URL: https://nano-gpt.com/api/v1;
  • canonical key name: NANOGPT_API_KEY;
  • direct OpenAI-compatible POST /chat/completions with Bearer authentication;
  • live OpenAI-compatible GET /models discovery;
  • removed the unsupported rbe-1 assumption and replaced it with the currently documented/live minimax/minimax-m2.7 fail-open entry, with metadata verified from models?detailed=true;
  • added generated-env, interactive setup, and Universal API Config coverage;
  • added export redaction, sk-nano-* response redaction, and local-agent child-environment isolation for the NanoGPT key;
  • preserved the newer Hugging Face provider changes that caused the old head to conflict.

Exact-head local verification:

  • npm run typecheck — pass
  • npm test — pass (65 files, 682 tests; all repository self-checks pass)
  • npm run lint — pass with 0 errors (133 existing warnings)
  • npm run build --silent — pass
  • git diff --check — pass

I force-updated only after confirming the contributor branch still matched the reviewed old head eaedc21d46528693f79f2b3af4ca7759dbb6aed9, using an exact lease. Please review the replacement commit; no unrelated branch content was removed beyond rebuilding the obsolete single commit on current main.

@jmagly
jmagly dismissed their stale review July 31, 2026 02:58

Superseded by corrected head f60f1ab. The requested NanoGPT endpoint, key, model-discovery, redaction, setup, and exact-head verification corrections are complete; repository CI run 30597775219 passed.

@jmagly
jmagly merged commit 8df967d into elder-plinius:main Jul 31, 2026
1 check passed
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.

Add NanoGPT support

2 participants