Skip to main content
With Nuwa LLM Gateway, you can unify multiple LLM providers (OpenAI, OpenRouter, LiteLLM) behind a single endpoint with DID authentication and usage-based pricing. The gateway provides provider-first routing, automatic usage tracking, and seamless payment integration. NPM Package: @nuwa-ai/llm-gateway - Ready to use without building from source.
Before you start: obtain a Service Key for your service DID. See the Service Key guide and use the copied value as SERVICE_KEY.

Quick start

Provider routing

The gateway uses provider-first routing for clear endpoint organization:

Using PaymentChannelHttpClient

For programmatic access with automatic payment handling, use the PaymentChannelHttpClient from the Payment Kit:

Pricing configuration

The gateway supports flexible pricing configuration:
  • Built-in pricing: Default model pricing for OpenAI models
  • Pricing overrides: Custom pricing via PRICING_OVERRIDES environment variable
  • Global multiplier: Adjust all costs with PRICING_MULTIPLIER (range 0-2)

Usage tracking

  • Automatic tracking: All requests are logged with token counts and USD costs
  • Streaming support: Chat Completions automatically inject stream_options.include_usage=true
  • Response API: Usage appears in response.completed SSE events
  • Access logs: Structured JSON logs to stdout with request details

Common issues

  • “SERVICE_KEY is required”: Generate and set your service key from the Service Key guide
  • “At least one provider API key is required”: Configure at least one provider API key
  • Port conflicts: Use --port <number> to specify a different port

Relevant Docs

Service Key

How to obtain and configure SERVICE_KEY

Payment Kit

PaymentChannelHttpClient for programmatic access

Service Pricing

Configure pricing for your LLM Gateway

Revenue

View balances, withdraw, and audit revenue history