API Documentation

Interactive API documentation and code examples

Quick Start

Python (OpenAI SDK)
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_NATARIS_KEY",
    base_url="https://api.nataris.ai/v1"
)

response = client.chat.completions.create(
    model="llama-3.2-1b-instruct-q4_k_m",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
cURL
# OpenAI-compatible Chat Completions API
curl -X POST https://api.nataris.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama-3.2-1b-instruct-q4_k_m",
    "messages": [{"role": "user", "content": "Hello, world!"}]
  }'

Available Models

llama-3.2-1b-instruct-q4_k_m

Text · 1B

phi-3-mini-4k-instruct-q4_k_m

Text · 3.8B

qwen2.5-0.5b-instruct-q6_k

Text · 0.5B

mistral-7b-instruct-q4_k_m

Text · 7B

P2P Inference Network

Nataris routes your requests to community phone providers — real people running AI models on their devices. With smart failover (5 retries in under 15 seconds) and automatic re-routing, your requests are resilient even when individual devices go offline.

P2PCommunity Providers

Runs on real phones in the Nataris network. 85% of revenue goes directly to device providers.

FailoverSmart Retry

If a device fails, the job is instantly re-routed to the next available device. 5 retries, fast linear backoff.

Check response.nataris.inference_type to see if your request was handled by "p2p" or "cloud". Each model's tier field indicates where it can run: P2P, CLOUD, or HYBRID.

API Endpoints

MethodEndpointDescription
POST/v1/chat/completionsChat completionsRecommended
POST/v1/jobsLegacy inference job
GET/v1/jobs/:idGet job status and result
GET/v1/modelsList available models
GET/v1/workflowsList workflowsOrchestration
GET/v1/workflows/:idGet workflow details + steps
POST/v1/workflows/estimateEstimate orchestration cost
POST/v1/conversationsCreate conversationMemory
GET/v1/conversationsList conversations
GET/v1/conversations/:idGet conversation context
POST/v1/conversations/:id/messagesAdd message to conversation

Authentication

All API requests require a Bearer token in the Authorization header.

Authorization: Bearer YOUR_API_KEY

Get your API key from the dashboard after signing up.

Verified Provider Routing

Route requests only to providers with verified device integrity via Google Play Integrity API.

{
  "modelId": "llama-3.2-1b-instruct-q4_k_m",
  "prompt": "Your prompt here",
  "privacyLevel": "verified"
}

Multi-Step Workflows (Orchestration)

Research Workflow — auto-chains research → analyze → write
curl -X POST https://api.nataris.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama-3.2-1b-instruct-q4_k_m",
    "messages": [{"role": "user", "content": "Research renewable energy trends"}],
    "orchestration": {
      "enabled": true,
      "workflow": "research",
      "max_steps": 10,
      "max_cost_usd": 1.0
    }
  }'
Workflow types: research · code · agent · map_reduce · auto — Billed at 1.5x base rate

Conversation Memory

Pass a conversation_id to automatically persist messages server-side. The API maintains conversation context with auto-generated titles and rolling summarization — no need to send full chat history every time.

{
  "model": "llama-3.2-1b-instruct-q4_k_m",
  "messages": [{"role": "user", "content": "Tell me more about that"}],
  "conversation_id": "conv-uuid-from-POST-/v1/conversations"
}

Manage conversations via /v1/conversations — create, list, get context, delete.

Interactive API Reference

Explore the full API with request/response schemas using our interactive Swagger documentation.

Open Swagger UI →

Ready to get started?

Get Your API Key →