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 and model slug in the runnable command.

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": "<allowed-model-slug>",
    "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: process.env.NAG_MODEL,
  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=os.environ["NAG_MODEL"],
    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

Choose from the current model catalog.

Use these public examples to pick a starting model. Then call the model list endpoint with your key to confirm the exact models enabled for your account.

Use case Good starting slugs Why users choose it
Flagship quality claude-opus-4.8 claude-sonnet High-quality writing, analysis, and agent work.
OpenAI-style apps gpt-4o gpt-4o-mini Easy drop-in for OpenAI-compatible clients.
Reasoning and coding deepseek-v4-pro kimi-k2.7-code qwen-coder-480b Useful for code generation, debugging, and longer technical tasks.
Fast daily use gemini-3-flash deepseek-v4-flash Lower-latency choices for quick chats and utility calls.
Long context minimax-m3 minimax-m2.7 Good for larger files, notes, and document-heavy workflows.
Open-weight and RAG llama-4-maverick nemotron-3-ultra command-r-plus Practical options for retrieval, structured output, and experimentation.

Pro plan usage note: Claude models (claude-opus-4.8, claude-opus-4-7, claude-sonnet-4-6, and other claude-* slugs) are premium and draw down your plan quota about 4× faster than standard models per token. Lighter models such as gemini-3-flash or deepseek-v4-flash use far less. Pick the model that fits the task to make your single plan last longer.

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.

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

Plan expired

The account access window ended. Request a renewal review before making payment.

403 model_not_allowed

Model not allowed

Choose a model returned by GET /v1/models for this key.

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

Try another allowed model or retry later.

Service checks

Verify the surface you are using.

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