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.
https://api.diwakaryadav.com.np/v1Header:
Authorization: Bearer <your-issued-np-key>
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.
Authorization: Bearer <your-issued-np-key>
OpenAI-compatible client
Use the SDK you already know.
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);
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.
{
"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.
# 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_errorInvalid API key format
The value does not match the expected gateway key shape. Remove spaces and check the copied value.
401 authentication_errorKey not accepted
The public response stays generic for unknown, revoked, expired, or inactive credentials. Check the account portal or contact support.
403 plan_expiredPlan expired
The account access window ended. Request a renewal review before making payment.
403 model_not_allowedModel not allowed
Choose a model returned by GET /v1/models for this key.
403 subscription_errorQuota exhausted
The plan budget is spent. Check the account quota summary for the next action.
429 rate_limit_errorToo many requests
Pause and retry after the current rate-limit window.
502 provider_errorModel temporarily unavailable
Try another allowed model or retry later.
Service checks
Verify the surface you are using.
https://ai.diwakaryadav.com.nphttps://api.diwakaryadav.com.nphttps://api.diwakaryadav.com.np/health