Introduction
NiruX API is an OpenAI-compatible REST API powered by NiruX AI — a custom AI model built in India. You can use it as a drop-in replacement for OpenAI in any project.
🔗 Base URL: https://delusion-fraying-prowling.ngrok-free.dev
🤖 Model: nirux-1 (NiruX AI powered by LLaMA 3.2)
📋 Format: OpenAI-compatible JSON API
Authentication
All API requests require a Bearer token in the Authorization header.
Authorization: Bearer YOUR_NIRUX_API_KEY
Get your free API key on the Get API Key page. Keys look like: nirux-abc123...
Chat Completions
The main endpoint. Send a conversation and get an AI response. Fully compatible with OpenAI's chat completions format.
Generate an AI response from a conversation history.
Parameters
| Parameter | Type | Description |
| messages | required | Array of message objects with role (system/user/assistant) and content |
| model | string | Model to use. Use nirux-1 or nirux-pro |
| temperature | number | Randomness 0-1. Default: 0.8. Lower = more focused. |
| max_tokens | number | Max response length. Default: 2048. |
POST /v1/chat/completions
Authorization: Bearer YOUR_KEY
Content-Type: application/json
{
"model": "nirux-1",
"messages": [
{ "role": "system", "content": "You are a helpful assistant" },
{ "role": "user", "content": "Write a Python hello world" }
],
"temperature": 0.8,
"max_tokens": 1024
}
{
"id": "nirux-abc123",
"object": "chat.completion",
"model": "nirux-1",
"choices": [{
"message": {
"role": "assistant",
"content": "print('Hello, World!')"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 12,
"total_tokens": 36
}
}
JavaScript Example
async function askNiruX(question) {
const res = await fetch('https://delusion-fraying-prowling.ngrok-free.dev/v1/chat/completions', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
model: 'nirux-1',
messages: [{ role: 'user', content: question }]
})
});
const data = await res.json();
return data.choices[0].message.content;
}
// Usage
askNiruX('Explain machine learning in simple terms')
.then(console.log);
Python Example
import requests
def ask_nirux(question):
response = requests.post(
'https://delusion-fraying-prowling.ngrok-free.dev/v1/chat/completions',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'model': 'nirux-1',
'messages': [{'role': 'user', 'content': question}]
}
)
return response.json()['choices'][0]['message']['content']
# Usage
answer = ask_nirux('Write a Python function to sort a list')
print(answer)
cURL Example
curl -X POST https://delusion-fraying-prowling.ngrok-free.dev/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nirux-1",
"messages": [{"role": "user", "content": "Hello!"}]
}'