HomeQuickstartAuthenticationSDKsExamplesError Codes
DOCS

Documentation

Everything you need to integrate the Tuori Cloud API, from your first request to production-grade retries, streaming, tools, and monitoring.

Introduction

Tuori Cloud provides a unified, OpenAI-compatible API for model inference. One endpoint and one API key can be used across supported commercial and open models.

BASE URLhttps://api.tuori.cloud/v1
OpenAI compatible

Use familiar chat completions, streaming, messages, and tool-calling formats.

Unified authentication

Manage scoped keys, budgets, and environments from one account.

Operational controls

Configure timeouts, retries, rate limits, and fallback behavior.

Quickstart

  1. Create an API key.

    Generate a development key and store it as TUORI_API_KEY. Never expose secret keys in browser code.

  2. Install the SDK.
    pip install openai
  3. Send your first request.
    Python
    from openai import OpenAI
    import os
    
    client = OpenAI(
        api_key=os.environ["TUORI_API_KEY"],
        base_url="https://api.tuori.cloud/v1",
        timeout=30.0,
        max_retries=2,
    )
    
    response = client.chat.completions.create(
        model="your-model-id",
        messages=[
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user", "content": "Explain vector databases in one paragraph."}
        ],
    )
    print(response.choices[0].message.content)
  4. Inspect usage and request IDs.

    Record token usage, latency, status code, and the response request ID for support and debugging.

Authentication

Send your secret key as a Bearer token. Use separate keys for development and production, apply least-privilege scopes, and rotate keys regularly.

HTTP Header
Authorization: Bearer $TUORI_API_KEY
Content-Type: application/json
Security note

API keys must only be used from trusted server-side environments. A client-side form or website should call your own backend, which then calls Tuori Cloud.

SDKs

Python

openai package with base_url configured.

Node.js

openai package with baseURL configured.

REST / cURL

Direct HTTPS requests from any server-side language.

Node.js
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.TUORI_API_KEY,
  baseURL: "https://api.tuori.cloud/v1",
  timeout: 30_000,
  maxRetries: 2,
});

const response = await client.chat.completions.create({
  model: "your-model-id",
  messages: [{ role: "user", content: "Hello" }],
});

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

Streaming

Enable streaming for lower perceived latency. Accumulate content deltas and handle disconnects gracefully.

Python streaming
stream = client.chat.completions.create(
    model="your-model-id",
    messages=[{"role": "user", "content": "Write a short launch announcement."}],
    stream=True,
)

for chunk in stream:
    delta = chunk.choices[0].delta.content
    if delta:
        print(delta, end="", flush=True)

Tool Calling

Declare tools with JSON Schema, execute validated tool calls in your application, then return tool results to the model. Never execute untrusted arguments without validation.

Retries and Timeouts

Retry rate-limit and transient server errors with exponential backoff and jitter. Do not retry invalid authentication or malformed requests.

StatusAction
408 / 429Retry with backoff and respect Retry-After.
500 / 502 / 503 / 504Retry a limited number of times.
400 / 401 / 403 / 404Fix the request or credentials; do not blindly retry.

cURL Example

Chat completion
curl https://api.tuori.cloud/v1/chat/completions \
  -H "Authorization: Bearer $TUORI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "your-model-id",
    "messages": [{"role": "user", "content": "Hello"}],
    "temperature": 0.2
  }'

Error Codes

CodeMeaningRecommended response
400Invalid requestValidate parameters and JSON.
401Authentication failedCheck or rotate the API key.
403Permission deniedReview key scopes and account access.
404Model or endpoint not foundCheck the model ID and path.
429Rate or budget limit reachedBack off or increase limits.
5xxTemporary service errorRetry with backoff and capture the request ID.

Rate Limits

Limits may be enforced by requests per minute, tokens per minute, concurrent requests, or budget. Keep concurrency bounded and use a queue for bursty workloads.

NEXT STEP

Ready to make your first request?

View Integration Guide →