Enigma AI API v1.0

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.

Base URL
https://aiapi.enigmasoftware.in

For OpenAI SDK-compatible configuration, use https://aiapi.enigmasoftware.in/v1 as the SDK base URL.

1. Quick start

  1. Create or sign in to an Enigma AI account.
  2. Open Dashboard → API Keys.
  3. Create an API key. It will use the sk-eai-... format.
  4. Store the key on your backend/server as an environment variable.
  5. POST chat messages to /v1/chat/completions.

2. Authentication

AI requests use your Enigma AI API key as a Bearer token:

HTTP header
Authorization: Bearer sk-eai-YOUR_API_KEY
Content-Type: application/json
Security: Never hard-code a real API key in public browser JavaScript, a mobile app bundle or a public Git repository. Call Enigma AI from your own backend when shipping a production application.

3. Chat completions

POSThttps://aiapi.enigmasoftware.in/v1/chat/completions

Request body

FieldTypeDescription
modelstringUse enigmaai-r1:8b.
messagesarrayOne or more system, user or assistant messages.
streambooleanCurrently use false unless streaming is enabled by your backend version.
temperaturenumberOptional value from 0 to 2.
max_tokensintegerOptional maximum number of generated tokens.

4. cURL example

Terminal
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

Node.js 18+
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

Python + requests
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.

Python OpenAI client
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)
Compatibility is currently focused on the chat completions endpoint documented here. Do not assume unrelated OpenAI endpoints (embeddings, files, assistants, images, etc.) exist unless they are added to the Enigma AI API.

8. Response and token usage

Example response
{
  "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

UsagePrice
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

POST/api/keys/create

Creates an API key. This endpoint uses your account JWT, not an API key.

GET/api/keys/

Lists your account API keys.

DELETE/api/keys/{key_id}

Revokes an API key.

Account endpoints such as API-key management and wallet endpoints use the JWT returned by /api/auth/login. AI inference uses the separate sk-eai-... API key.

11. Common errors

StatusMeaning
401 / 403Missing, invalid or revoked authentication credential.
422Request body validation failed. Check required fields and types.
5xxServer-side or upstream AI processing error. Retry only when appropriate.

Interactive backend schema is also available in Swagger UI.