Quick Start
Run your first agent. New API accounts get $1 test credit on one model — no card and no OAuth required.
1. Install
pip install -U "m8tes>=4.8"2. Create your account
Already registered? Get your key from the Developer dashboard.
import m8tes
account = m8tes.signup("you@example.com", "yourpassword", "yourname")
print(account.api_key)Set the key in your terminal:
export M8TES_API_KEY=m8_your_key_here3. Run your first agent
Try the API with $1 test credit
API signups get $1 promotional prepaid credit. Spend it on deepseek-v4-1-flash only. Other gateway models need a top-up or a connected provider. One in-flight run at a time on the test balance.
from m8tes import M8tes
client = M8tes() # reads M8TES_API_KEY
# $1 API test credit — this model only until you top up or connect a provider
for chunk in client.runs.stream_text(
message="Draft a warm reply to a customer asking to cancel.",
user_id="hello_world",
model="deepseek-v4-1-flash",
raise_on_error=True,
):
print(chunk, end="", flush=True)Develop on your model subscription
Prefer your own Claude, OpenAI/Codex, xAI, or Gemini plan for personal development (Hobby). Connect the provider, then run a matching model — that path does not spend prepaid credit.
- Open Account → Model connections.
- Connect Claude, OpenAI / Codex, Grok / xAI, or Gemini and finish sign-in on the provider page.
- Wait for Connected, then run with a matching model (example below uses Grok).
Connecting activates Hobby on eligible trial/inactive accounts. Your provider's limits and Hobby's run allowance still apply.
Using a different provider? Follow provider setup and choose a matching model.
Example: connect xAI in Python or TypeScript
Run this once. Open the printed URL, enter the code, and leave the script running until it prints Connected.
import time
from m8tes import M8tes
client = M8tes()
auth = client.model_connections.authorize("xai")
print("Open:", auth.authorization_url)
print("Enter code:", auth.user_code)
deadline = time.monotonic() + 600
while auth.status == "pending":
if time.monotonic() >= deadline:
raise TimeoutError("Connection timed out. Run this script again.")
time.sleep(max(auth.interval_seconds, 1))
auth = client.model_connections.authorization_status("xai", auth.state)
if auth.status != "connected":
raise RuntimeError("Connection failed: " + auth.status)
print("Connected. Run the Grok example below.")from m8tes import M8tes
client = M8tes() # reads M8TES_API_KEY
# Personal development only: this disables strict user_id checks account-wide.
# This persists. For customer-facing apps, keep strict mode on and pass user_id.
client.settings.update(require_end_user_id=False)
# Connect a model plan first: https://m8tes.ai/account
for chunk in client.runs.stream_text(
message="Draft a warm reply to a customer asking to cancel.",
model="grok-4.6", # match whatever provider you connected
raise_on_error=True,
):
print(chunk, end="", flush=True)Keep user_id out of personal development runs. Billing details.
Production embeds use prepaid
Each customer gets a user_id. These runs debit the prepaid wallet. New API accounts include $1 test credit on deepseek-v4-1-flash; top up for the full catalog and sustained traffic.
from m8tes import M8tes
client = M8tes() # reads M8TES_API_KEY
# user_id isolates each of your end users. This path bills the prepaid wallet.
for chunk in client.runs.stream_text(
message="A customer emailed asking to cancel. Draft a warm reply that offers to pause instead.",
user_id="customer_123",
model="deepseek-v4-1-flash",
raise_on_error=True,
):
print(chunk, end="", flush=True)HTTP equivalent
curl -X POST https://api.m8tes.ai/api/v2/signup \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com", "password": "yourpassword", "first_name": "yourname"}'curl -X POST https://api.m8tes.ai/api/v2/runs \
-H "Authorization: Bearer $M8TES_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message": "Draft a warm cancellation reply.", "user_id": "hello_world", "model": "deepseek-v4-1-flash", "stream": false}'Next: Agents · Runs · Multi-tenancy · Testing · Community