Tensor Machine Docs

Getting Started

Create your account, generate an API key, and make your first API call in under 5 minutes.

1. Create an account

Sign up at tensormachine.ai — the free tier includes 100K tokens/month with no credit card required. Your account comes with India data residency enabled by default.

2. Generate an API key

Navigate to Dashboard → Settings → API Keys and click Create new key.

  • Give it a descriptive name (e.g., my-app-prod)
  • Copy it immediately — it will not be shown again
  • Store it in an environment variable, not in source code
export TENSORMACHINE_API_KEY="tx_live_..."

3. Make your first request

curl https://edge.tensormachine.ai/v1/chat/completions \
  -H "Authorization: Bearer $TENSORMACHINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "z-ai/glm-5.2",
    "messages": [
      { "role": "user", "content": "Hello from India!" }
    ]
  }'

You should receive a response like:

{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "model": "z-ai/glm-5.2",
  "choices": [{
    "message": {
      "role": "assistant",
      "content": "Hello! How can I help you today?"
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 9,
    "total_tokens": 21
  }
}

4. Use the OpenAI SDK

Tensor Machine is fully OpenAI-compatible. If you already use the OpenAI SDK, switch by changing one line:

# Before (OpenAI)
client = OpenAI(api_key="sk-...")

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

Everything else — model calls, streaming, function calling — stays the same.

Next steps

  • Authentication — key types, rotation, and security best practices
  • Quickstart — full code examples in Python, Node.js, and cURL
  • Models — choose the right model for your use case

On this page