API Reference

OpenAI-compatible API for multi-provider AI inference

Quick Start

Get started with Aotearoa Inference API in minutes. First, create an API key from your dashboard.

Example Request

curl https://elasterrific.com/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [
      {"role": "user", "content": "What is the capital of France?"}
    ]
  }'

Authentication

Authenticate your API requests using Bearer token authentication in the Authorization header.

Authorization: Bearer sk-aotearoa-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Your API keys carry many privileges, so keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, etc.

Endpoints

POST/api/v1/chat/completions

Creates a chat completion response. This endpoint is compatible with the OpenAI Chat Completions API format.

Request Body

messagesarrayrequired

A list of messages comprising the conversation so far. Each message must have a role (system, user, or assistant) and content.

modelstringoptional

The model/provider to use. Use "auto" (default) to automatically rotate between providers, or specify a provider name like "elastix-deepseek", "elastix-qwen", etc.

streambooleanoptional

Not supported yet. Must be false or omitted.

Response

{
  "id": "chatcmpl-abc123...",
  "object": "chat.completion",
  "created": 1738134000,
  "model": "DeepSeek-V3.2",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The capital of France is Paris."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 15,
    "completion_tokens": 8,
    "total_tokens": 23
  },
  "aotearoa": {
    "provider": "elastix-deepseek",
    "cost": {
      "input": 0.0000006,
      "output": 0.0000028,
      "total": 0.0000034
    },
    "balance": 4.9999966,
    "duration_ms": 1234
  }
}

The aotearoa object contains additional metadata specific to Aotearoa Inference, including the provider used, cost breakdown, remaining balance, and response duration.

Code Examples

Python

from openai import OpenAI

# Use Aotearoa Inference as a drop-in replacement for OpenAI
client = OpenAI(
    api_key="sk-aotearoa-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    base_url="https://elasterrific.com/api/v1"
)

response = client.chat.completions.create(
    model="auto",  # or specify a provider like "elastix-deepseek", "elastix-qwen"
    messages=[
        {"role": "user", "content": "Explain quantum computing in simple terms"}
    ]
)

print(response.choices[0].message.content)

# Access Aotearoa-specific metadata
aotearoa_info = response.model_dump()["aotearoa"]
print(f"Provider: {aotearoa_info['provider']}")
print(f"Cost: ${aotearoa_info['cost']['total']:.6f}")
print(f"Balance: ${aotearoa_info['balance']:.4f}")

Node.js

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'sk-aotearoa-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  baseURL: 'https://elasterrific.com/api/v1'
});

async function chat() {
  const response = await client.chat.completions.create({
    model: 'auto',
    messages: [
      { role: 'user', content: 'What is machine learning?' }
    ]
  });

  console.log(response.choices[0].message.content);

  // Access Aotearoa-specific metadata
  console.log('Provider:', response.aotearoa.provider);
  console.log('Cost: $' + response.aotearoa.cost.total.toFixed(6));
  console.log('Balance: $' + response.aotearoa.balance.toFixed(4));
}

chat();

cURL

curl https://elasterrific.com/api/v1/chat/completions \
  -H "Authorization: Bearer sk-aotearoa-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "Write a haiku about coding"
      }
    ]
  }'

Available Models

Specify one of these provider names in the model parameter, or use "auto" to automatically rotate between providers for load distribution.

Provider NameModelAuto-Select
elastix-gpt-oss-120bgpt-oss-120bYes
elastix-deepseekDeepSeek-V3.2Yes
elastix-kimiKimi-K2-ThinkingYes
elastix-qwenQwen3-Coder-480B-A35B-InstructYes
autoRotates automaticallyDefault

Error Codes

401missing_api_key / invalid_api_key

Missing or invalid Authorization header. Ensure you're using Authorization: Bearer sk-aotearoa-xxx.

402insufficient_balance

Your account balance is too low. Add more credits from your dashboard.

400invalid_messages

The messages array is empty or invalid. Ensure you're sending at least one message.

400streaming_not_supported

Streaming is not yet supported. Set stream: false or omit the parameter.

500internal_error

An unexpected error occurred. Contact support if the issue persists.

Pricing & Billing

All API calls are billed based on token usage. Costs are deducted from your account balance in real-time. View detailed pricing on the pricing page.

Balance Tracking: Every API response includes your remaining balance in the aotearoa.balance field, so you can monitor your usage in real-time.

Support

Need help? We're here to assist you.