API Documentation

OpenAI-compatible API for sovereign AI

Authentication

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

Authorization: Bearer <your-api-key>

Generate API keys from your dashboard. Keys are shown only once at creation — store them securely.

Base URL

https://api.au.yarn.prosodylabs.com.au

Endpoints

Chat Completions

POST /v1/chat/completions

Send a list of messages and receive a model-generated response. Supports streaming via "stream": true.

Request body
{
  "model": "mistralai/Mistral-7B-Instruct-v0.2",
  "messages": [
    {"role": "user", "content": "What is data sovereignty?"}
  ],
  "stream": false
}

Response follows the standard OpenAI chat completion format.

List Models

GET /v1/models

Returns a list of available models, including sovereignty information for each model.

Models

Yarn provides two categories of model, each with different data handling:

Sovereign models

Open-weight models running on Australian hardware. Your prompts and responses are processed entirely within Australia and never leave the country. Examples: Mistral 7B, Llama.

Global models

Frontier models accessed via overseas providers (OpenAI, Anthropic). Your prompts are sent to the provider's servers outside Australia. Examples: GPT-4o, Claude.

Each model response includes a sovereignty field indicating whether the model is sovereign or global.

Code Examples

curl

curl -X POST https://api.au.yarn.prosodylabs.com.au/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistralai/Mistral-7B-Instruct-v0.2",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.au.yarn.prosodylabs.com.au/v1"
)

response = client.chat.completions.create(
    model="mistralai/Mistral-7B-Instruct-v0.2",
    messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content)

JavaScript

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'YOUR_API_KEY',
  baseURL: 'https://api.au.yarn.prosodylabs.com.au/v1',
});

const response = await client.chat.completions.create({
  model: 'mistralai/Mistral-7B-Instruct-v0.2',
  messages: [{ role: 'user', content: 'Hello' }],
});

Streaming (Python)

stream = client.chat.completions.create(
    model="mistralai/Mistral-7B-Instruct-v0.2",
    messages=[{"role": "user", "content": "Explain data sovereignty"}],
    stream=True
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

Rate Limits

API requests are rate-limited per API key. Current limits are returned in the response headers:

  • X-RateLimit-Limit — maximum requests per window
  • X-RateLimit-Remaining — remaining requests in the current window
  • RateLimit-Reset — seconds until the window resets

If you need higher limits, contact jordan@prosodylabs.com.au.

Data Sovereignty

Yarn is built for Australian data residency. When you use a sovereign model, your data is processed on GPU hardware in Perth, Western Australia. It never leaves Australian infrastructure.

When you use a global model (GPT-4o, Claude, etc.), your prompt is proxied to the provider's API servers, which are located outside Australia. Responses are returned to you via Yarn but the prompt content transits through the provider's infrastructure.

Check the sovereignty field in the model response or the GET /v1/models endpoint before sending sensitive data. For full details, see our Privacy Policy.