START
API quickstart
Terza Inference speaks the familiar OpenAI- and Anthropic-style protocols. Point an existing SDK at the base URL and use your Terza key.
1. Fund your balance and create a key
- Sign in to the console.
- Under Billing, top up (minimum $5) with USDC or USDT on AllScale's checkout page, or send TAO from any Bittensor wallet or exchange. Your balance is credited in US dollars once the payment confirms.
- Under API keys, create a key. Give it a monthly budget and, optionally, restrict its models or IP addresses. The full key is shown once.
2. Make a request
Base URL: https://terza.si/v1
curl https://terza.si/v1/chat/completions \
-H "Authorization: Bearer $TERZA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "MODEL_ID", "messages": [{"role": "user", "content": "Hello"}]}'With the OpenAI Python SDK:
from openai import OpenAI
client = OpenAI(base_url="https://terza.si/v1", api_key=TERZA_API_KEY)
reply = client.chat.completions.create(
model="MODEL_ID",
messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)List the models available to your key with GET /v1/models, or browse them in the console.
Supported endpoints
| Endpoint | Notes |
|---|---|
POST /v1/chat/completions | JSON or streaming (SSE). Function tools supported. |
POST /v1/responses | Stored for 7 days by default (store: false to opt out); continue with previous_response_id using the same key. |
POST /v1/messages | Anthropic-style; x-api-key is accepted. |
POST /v1/embeddings, /v1/rerank | Retrieval. |
POST /v1/systemone | Structured decisions (Jev): send a state and named questions of type noul, choice or score, each with instructions. Answers come back with probabilities. Billed on input tokens; output is free. Image questions are not supported yet. |
POST /v1/images/generations, /edits | Images; optional streaming of partial images. |
POST /v1/audio/speech, /transcriptions, /translations | Audio. |
GET /v1/realtime | WebSocket voice; priced per session of up to 60 seconds. |
POST /v1/media/tasks | Asynchronous video, image, music and sound. See Media tasks. |
Billing
- Prices are set by each model’s miners, per million input and output tokens (or per unit for media). The console shows the current price of every model.
- Before a request is sent, its maximum possible cost is reserved from your balance. You are charged the actual cost; the rest is released.
- Failed requests and rejected miner receipts are never charged.
- Add
X-Terza-Offer: OFFER_IDto route to one specific offer instead of the cheapest. - Add
X-Terza-Tier: economy,standardorpriorityto use the cheapest healthy offer in that tier. Each model lists its tiers and prices on the Models page. - Each API key has a routing mode (balanced, lowest price, highest success rate or fastest) and an allowed tier order, set when you create it. Add
X-Terza-Routing: price,success_rate,speedorautoto override the mode for one request. If a quote fails before answering, the next one is tried automatically, and failed attempts are free.
Errors
| Status | Meaning |
|---|---|
| 401 | Missing or invalid API key. |
| 402 | Insufficient balance or key budget. Nothing was sent. |
| 429 | Rate limited; retry with backoff. |
| 502 | The miner could not complete the request. No charge. |
| 503 | No eligible offer right now (no_eligible_supply or offer_unavailable). No charge. |