Documentation

Getting Started

What is Nia Gateway?

Nia Gateway is a sector-agnostic AI gateway: it fronts an AI provider (currently Anthropic) behind a single, simple API, and handles per-tenant billing, isolation, and payment on your behalf. You send it a prompt with your API key; it either bills the request against your prepaid balance or routes it through your own provider key, and hands back the completion. See the Overview page for the sector-agnostic framing and this project's flagship integration.

Getting an API key

Create an account at /account/signup: your email, a password, and your name (or a business name). Signing up does two things at once:

  • creates your Nia Gateway account and API key, and
  • creates a SMPLY PAY wallet for you. SMPLY PAY is the payments platform you'll use to fund your usage. SMPLY PAY also emails you a link to claim that account, so you can view your wallet there directly if you want to.

You're logged in straight away. Then:

  1. On your dashboard (/account/dashboard), open the API key card and click Reveal API key to see it.
  2. If you ever need to rotate it (e.g. it leaked), the same card has a Regenerate API key button — the old key stops working immediately and a new one takes its place.
  3. Next time, log in at /login with the email and password you signed up with.

This dashboard login is a separate system from the API key itself — see Authentication for exactly how they differ.

Your first request

Every request to the gateway's AI endpoint goes to POST /v1/ai/complete, authenticated with your API key in the x-api-key header:

curl -s -X POST https://your-gateway-host/v1/ai/complete \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Say hello in exactly three words."}'

A successful response looks like this (captured from a real run against a platform-billed tenant):

{
  "response": "Hello there, friend!",
  "tenant_name": "Vaultwave Financial",
  "used_byok_key": false,
  "cost": "0.00044",
  "balance_after": "2459.99934"
}

cost and balance_after reflect your prepaid balance moving by exactly what this one request was billed — see Billing for how that number is computed. If your tenant is configured with your own provider key instead (BYOK), used_byok_key is true, cost is always "0", and balance_after is simply your current (unaffected) balance — also covered in Billing.

From here: Authentication covers the x-api-key header in more depth, Endpoint Reference documents every real error case you might hit, and Deposits covers funding a metered balance.