Build with Enigma AI
Enigma AI exposes an OpenAI-style chat completions endpoint so you can add AI to websites, mobile apps, CRMs, ERPs, automation systems and internal tools.
https://aiapi.enigmasoftware.inFor OpenAI SDK-compatible configuration, use https://aiapi.enigmasoftware.in/v1 as the SDK base URL.
1. Quick start
- Create or sign in to an Enigma AI account.
- Open Dashboard → API Keys.
- Create an API key. It will use the
sk-eai-...format. - Store the key on your backend/server as an environment variable.
- POST chat messages to
/v1/chat/completions.
2. Authentication
AI requests use your Enigma AI API key as a Bearer token:
Authorization: Bearer sk-eai-YOUR_API_KEY Content-Type: application/json
3. Chat completions
Request body
| Field | Type | Description |
|---|---|---|
| model | string | Use enigmaai-r1:8b. |
| messages | array | One or more system, user or assistant messages. |
| stream | boolean | Currently use false unless streaming is enabled by your backend version. |
| temperature | number | Optional value from 0 to 2. |
| max_tokens | integer | Optional maximum number of generated tokens. |
4. cURL example
curl https://aiapi.enigmasoftware.in/v1/chat/completions \
-H "Authorization: Bearer $ENIGMA_AI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "enigmaai-r1:8b",
"messages": [
{"role": "user", "content": "Hello, what can you do?"}
],
"stream": false,
"temperature": 0.7,
"max_tokens": 300
}'5. JavaScript / Node.js
const response = await fetch(
"https://aiapi.enigmasoftware.in/v1/chat/completions",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.ENIGMA_AI_API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "enigmaai-r1:8b",
messages: [
{ role: "user", content: "Create a CRM follow-up plan." }
],
stream: false,
temperature: 0.7,
max_tokens: 500
})
}
);
const data = await response.json();
console.log(data.choices[0].message.content);6. Python
import os
import requests
response = requests.post(
"https://aiapi.enigmasoftware.in/v1/chat/completions",
headers={
"Authorization": f"Bearer {os.environ['ENIGMA_AI_API_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "enigmaai-r1:8b",
"messages": [
{"role": "user", "content": "Explain this sales report."}
],
"stream": False,
"temperature": 0.7,
"max_tokens": 500,
},
timeout=120,
)
response.raise_for_status()
data = response.json()
print(data["choices"][0]["message"]["content"])7. OpenAI SDK-style integration
Because the Enigma AI chat endpoint follows the OpenAI chat-completions structure, you can point compatible OpenAI SDK clients at the Enigma AI /v1 base URL.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["ENIGMA_AI_API_KEY"],
base_url="https://aiapi.enigmasoftware.in/v1",
)
completion = client.chat.completions.create(
model="enigmaai-r1:8b",
messages=[
{"role": "user", "content": "Hello from my application"}
],
temperature=0.7,
max_tokens=300,
)
print(completion.choices[0].message.content)8. Response and token usage
{
"id": "...",
"object": "chat.completion",
"model": "enigmaai-r1:8b",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 972,
"completion_tokens": 200,
"total_tokens": 1172
}
}Read the assistant reply from choices[0].message.content. Use the usage object to monitor token consumption.
9. Usage billing
| Usage | Price |
|---|---|
| Input tokens | ₹0.10 per 1,000 tokens |
| Output tokens | ₹0.20 per 1,000 tokens |
Wallet balance and transactions are available in the Enigma AI dashboard.
10. API key management endpoints
Creates an API key. This endpoint uses your account JWT, not an API key.
Lists your account API keys.
Revokes an API key.
/api/auth/login. AI inference uses the separate sk-eai-... API key.11. Common errors
| Status | Meaning |
|---|---|
| 401 / 403 | Missing, invalid or revoked authentication credential. |
| 422 | Request body validation failed. Check required fields and types. |
| 5xx | Server-side or upstream AI processing error. Retry only when appropriate. |
Interactive backend schema is also available in Swagger UI.