runaiicloud
ModelsAppsGPUsServerless GPUPricingReserveDocsConnectCompareEnterprise
Log inGet started
Home/Cookbook

Cookbook

Copy. Run. Ship.

Streaming chat

Token-by-token SSE with the OpenAI SDK.

from openai import OpenAI
client = OpenAI(api_key="$RUNAII_API_KEY",
                base_url="https://api.runaii.cloud/v1")
for chunk in client.chat.completions.create(
    model="runaii/glm-5.3",
    messages=[{"role": "user", "content": "Hello!"}],
    stream=True):
    print(chunk.choices[0].delta.content or "", end="")

Function calling

Tools schema works on fn-calling models (e.g. glm-5.3).

resp = client.chat.completions.create(
    model="runaii/glm-5.3",
    messages=[{"role": "user", "content": "What GPUs are cheapest?"}],
    tools=[{"type": "function",
            "function": {"name": "get_pricing",
                         "parameters": {"type": "object",
                                        "properties": {}}}},
    tool_choice="auto")

RAG: embed + rerank

Qwen3 embeddings + cross-encoder rerank — endpoints not live yet.

# Not yet available — /v1/embeddings and /v1/rerank
# do not exist today (both 404). The models are listed in
# the catalog but have no served endpoint yet; dedicated
# endpoints are rolling out. Until then, do retrieval
# client-side and call the chat models directly.

Async batch jobs

Simulated console demo today — jobs are not processed or billed.

# console → Batch API → submit job
# demo only: jobs are simulated, nothing is processed,
# no results are produced, and nothing is billed.
# A production batch path (and any batch pricing)
# is not live yet.

Spend guardrails

Never wake up to a surprise bill.

# console → Settings
# hard spend limit ($) → over-limit calls get 402
# low-credit alerts via email + webhook (credit.low)

Verify webhooks

HMAC-SHA256 over the raw body.

import hmac
sig = hmac.new(WHSEC.encode(), raw_body, "sha256").hexdigest()
assert hmac.compare_digest("sha256=" + sig,
                           headers["X-Runaii-Signature"])
Full docs →Try live →
runaiicloud

Serverless inference, dedicated GPUs, and training for open models. OpenAI- and Anthropic-compatible APIs.

© 2026 runaii

Platform

Model libraryAppsGPUsServerless GPUPricingToken-Max coding plansCompare providersDocs

Developers

ConnectCookbookCLIAgents / MCPUse casesTutorialsBlogFAQ

Company

EnterpriseStartupsAboutCareersTrust centerStatusSupportTermsPrivacyData policySubprocessorsSitemap