Tensor Machine Docs

Rate Limits

Request quotas, token limits per plan, and how to handle 429 responses gracefully.

Limits by plan

PlanRequests/minTokens/monthConcurrent requests
Free10100K2
Developer605M10
Pro30050M50
EnterpriseCustomCustomCustom

Limits apply per API key. Creating multiple keys does not increase per-account limits.

Rate limit headers

Every response includes headers showing your current usage:

X-RateLimit-Limit-Requests: 60
X-RateLimit-Remaining-Requests: 43
X-RateLimit-Limit-Tokens: 5000000
X-RateLimit-Remaining-Tokens: 4821309
X-RateLimit-Reset-Requests: 2026-06-24T10:30:00Z

Handling 429 responses

When you exceed a limit, the API returns 429 Too Many Requests with a Retry-After header:

{
  "error": {
    "message": "Rate limit exceeded. Please retry after 12 seconds.",
    "type": "rate_limit_error",
    "code": "rate_limit_exceeded"
  }
}

Python — exponential backoff

import time
import random
from openai import OpenAI, RateLimitError

client = OpenAI(api_key="tx_live_...", base_url="https://edge.tensormachine.ai/v1")

def call_with_retry(messages, max_retries=5):
    for attempt in range(max_retries):
        try:
            return client.chat.completions.create(
                model="z-ai/glm-5.2",
                messages=messages,
            )
        except RateLimitError as e:
            if attempt == max_retries - 1:
                raise
            wait = (2 ** attempt) + random.random()
            time.sleep(wait)

Node.js — exponential backoff

import OpenAI from 'openai';

const client = new OpenAI({ apiKey: process.env.TENSORMACHINE_API_KEY, baseURL: 'https://edge.tensormachine.ai/v1' });

async function callWithRetry(messages: OpenAI.ChatCompletionMessageParam[], retries = 5) {
  for (let i = 0; i < retries; i++) {
    try {
      return await client.chat.completions.create({ model: 'z-ai/glm-5.2', messages });
    } catch (e: unknown) {
      if (e instanceof OpenAI.RateLimitError && i < retries - 1) {
        await new Promise(r => setTimeout(r, Math.pow(2, i) * 1000));
        continue;
      }
      throw e;
    }
  }
}

Best practices

  • Batch small requests — if you process many short texts, combine them into a single prompt when possible
  • Use streaming — streaming responses begin faster and reduce perceived latency
  • Cache deterministic outputs — for identical prompts with temperature: 0, cache the response
  • Monitor usage in the dashboard — real-time token consumption per key

Increasing limits

To increase your rate limits, upgrade your plan at tensormachine.ai/pricing or contact enterprise@tensormachine.ai for custom quotas.

On this page