Skip to content

KnowSky404/N2API

Repository files navigation

N2API

N2API is a personal AI API/account gateway for self-hosted use. It is inspired by sub2api's practical workflow, but it is a new implementation focused on personal use rather than platform billing or merchant operations.

V1 Direction

  • Go backend service.
  • PostgreSQL as the default persistent database.
  • Bun + SvelteKit + Tailwind CSS admin UI.
  • Docker Compose first for local development and VPS deployment.
  • Codex/OpenAI OAuth is the first upstream provider.
  • OpenAI-compatible API routes and Codex-oriented adapter behavior share one internal gateway pipeline.

Non-Goals

  • No sub2api source-code fork or copy.
  • No public registration, payment, recharge, balance, sponsor, invoice, merchant, or platform billing features.
  • No Redis requirement in V1. Redis can be added later for optional distributed rate limiting, queues, or locks.
  • No SQLite implementation in V1.

Repository Layout

backend/   Go service entrypoint and future gateway/provider/store code
frontend/  Bun-managed SvelteKit admin UI
deploy/    Docker Compose and deployment notes
docs/      Design specs and implementation plans

Local Development

Copy the environment template:

cp .env.example .env

Edit .env and set real secrets before running the full stack. OPENAI_API_BASE_URL defaults to https://api.openai.com and can be changed for compatible upstreams.

Backend:

cd backend
go test ./...
go run ./cmd/n2api

Frontend:

cd frontend
bun install
bun run check
bun run build

Docker Compose:

docker compose -f deploy/compose.yaml --env-file .env up --build

Current Status

The backend includes admin API key management, OpenAI/Codex OAuth account connection, request logs, static admin UI serving, and an initial OpenAI-compatible gateway for /v1/models, /v1/chat/completions, and core /v1/responses routes.

About

N Sources, One API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors