Quickstart documentation

Make a first request in minutes.

Use the production base URL and send your issued key as a Bearer token. Replace the key in the runnable command. The model is diwakar, the only model served right now, and it is free.

Base URL: https://api.diwakaryadav.com.np/v1
Header: Authorization: Bearer <your-issued-np-key>
First request with cURL
curl https://api.diwakaryadav.com.np/v1/chat/completions \
  -H "Authorization: Bearer <your-issued-np-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "diwakar",
    "messages": [
      {"role": "user", "content": "Namaste from Nepal AI Gateway"}
    ]
  }'

Authentication

Send the key in the header.

Trim accidental whitespace and keep the key private. Do not paste it into public code or screenshots.

HTTP header
Authorization: Bearer <your-issued-np-key>
Keys are shown only when issued. The account portal checks access without showing the full key again.

OpenAI-compatible client

Use the SDK you already know.

Node.js
const OpenAI = require("openai");

const client = new OpenAI({
  apiKey: process.env.NAG_API_KEY,
  baseURL: "https://api.diwakaryadav.com.np/v1"
});

const response = await client.chat.completions.create({
  model: "diwakar",
  messages: [{ role: "user", content: "Namaste" }]
});

console.log(response.choices[0].message.content);
Python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["NAG_API_KEY"],
    base_url="https://api.diwakaryadav.com.np/v1",
)

response = client.chat.completions.create(
    model="diwakar",
    messages=[{"role": "user", "content": "Namaste"}],
)

print(response.choices[0].message.content)

Response shape

Read the assistant message.

Example JSON
{
  "id": "chatcmpl_example",
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Namaste! How can I help?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 8,
    "total_tokens": 18
  }
}

Model access

One model right now: diwakar.

The gateway currently serves exactly one model, diwakar, a stealth model by Diwakar Yadav. It is free to use with any gateway key. There are no paid plans or paid models at the moment.

The model list endpoint below is the source of truth. If more models are added later, they will appear there first.

List models (public — no key needed)
# Public: returns the free-tier catalog, no key required and no quota used
curl https://api.diwakaryadav.com.np/v1/models

# With a key: returns your plan-filtered catalog (still quota-free)
curl https://api.diwakaryadav.com.np/v1/models \
  -H "Authorization: Bearer <your-issued-np-key>"

Rate limits and quota

Two limits can stop a request.

rate_limit_error

Short-window request limit

Wait before retrying. Your account page shows the requests-per-minute limit returned for your plan.

subscription_error

Hard quota exhausted

Do not retry continuously. Review remaining quota and the reset or renewal action in your account.

Free trial

Try the gateway with one key, no credit card.

Sign up at trial.html with Google. You get one gateway key, shown once at first issue, that works against the /v1 endpoint and calls the free diwakar model.

  • 1 key per identity — the full secret appears only at signup; sign in daily with Google to keep the key active.
  • 2,000,000 tokens daily, 15 requests/minute, 200K context window.
  • Expires at midnight UTC — sign in within the trial window to re-enable the same key.
  • No paid-provider fallback. Free requests never silently hit a paid upstream.

Trial requests are logged for operations, abuse prevention, analytics, and quality improvement. Prompt bodies are stored only in hashed form.

diwakar: a stealth multimodal model by Diwakar Yadav, free for a limited time. It does not train on your data.

Error reference

Respond to the state, not just the status code.

400 invalid_request_error

Invalid API key format

The value does not match the expected gateway key shape. Remove spaces and check the copied value.

401 authentication_error

Key not accepted

The public response stays generic for unknown, revoked, expired, or inactive credentials. Check the account portal or contact support.

403 plan_expired

Access expired

The key's access window ended. Sign in again from the account page to re-enable it.

403 model_not_allowed

Model not allowed

Use diwakar, the model returned by GET /v1/models.

403 subscription_error

Quota exhausted

The plan budget is spent. Check the account quota summary for the next action.

429 rate_limit_error

Too many requests

Pause and retry after the current rate-limit window.

502 provider_error

Model temporarily unavailable

Wait a moment and retry.

Service checks

Verify the surface you are using.

Websitehttps://ai.diwakaryadav.com.np
APIhttps://api.diwakaryadav.com.np
Healthhttps://api.diwakaryadav.com.np/health