Documentation

TokenRex API Docs

30% off all models

One OpenAI-compatible API for chat, images, voice, music, video, embeddings and decisions — with current TokenRex usage prices. Pick a feature on the left, choose a model, copy the code.

Master AI integration guide (Markdown)

Complete TokenRex integration instructions for your AI coding agent, including endpoints, models, features and live pricing.

Download .md

Quickstart

From zero to your first response in three steps.

  1. 1
    Add balance

    Top up your wallet with UPI, cards or netbanking on the Wallet page.

  2. 2
    Create an API key

    Open API Keys and copy your sk-tr-… key (shown once). It is shown only once.

  3. 3
    Make your first call

    Use any OpenAI SDK with the base URL below and a model ID from the Models & Pricing page.

curl https://tokenrex.ai/api/public/v1/chat/completions \
  -H "Authorization: Bearer YOUR_TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6-astra",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Base URL & SDKs

Chat Completions uses the OpenAI-compatible format. Claude’s native features use /messages with the Messages format; GPT Responses uses /responses. Point compatible SDKs at:

https://tokenrex.ai/api/public/v1

Works with the official OpenAI SDKs (Python, Node, Go, Rust), LangChain, LlamaIndex, Vercel AI SDK, Continue.dev, Cursor and any tool that accepts a custom base_url.

Authentication

Send your TokenRex key as a Bearer token on every request:

Authorization: Bearer YOUR_TOKENREX_API_KEY

Create keys on the API Keys page. Each key can be limited to specific models and given a per-minute spending cap.

Thinking Knob

The thinking knob is a request setting that controls how much reasoning effort a supported model can use before answering. Keep the same model ID and change the effort value. Higher effort can use more reasoning tokens and take longer; it does not guarantee a better answer.

Effort valueWhen to choose it
noneAccepted on Gemini 4 Carbon, Hydrogen and Neon; does not guarantee zero reasoning tokens.
minimalThe lightest explicit reasoning setting on Gemini 4 Carbon, Hydrogen and Neon.
lowStart here for straightforward tasks when latency matters.
mediumA balanced starting point for general analysis.
highAllow more reasoning for complex coding, planning or analysis.
xhigh (Extra high)Use on supported models for harder multi-step tasks.
maxDeepest reasoning. On GPT models it requires POST /v1/responses and is not available on their Fast versions, except GPT-6.1 Terra Fast, which accepts max. Verified Claude families (Sonnet 5, Opus 5, Opus 5.5 and Fable 5.1, standard or Fast) accept max through output_config.effort; Sonnet 5.5 and Haiku 5.5 also accept max (adaptive thinking only, no fixed budget); Haiku 4.5 has no Max.

ChatGPT / OpenAI models. On POST /v1/chat/completions, send reasoning_effort: "high". On POST /v1/responses, send reasoning: { effort: "high" }. Change the value for each request; do not append -high or another thinking suffix to the model ID.

# Chat Completions: change high to a supported effort
curl https://tokenrex.ai/api/public/v1/chat/completions \
  -H "Authorization: Bearer $TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6-luna","reasoning_effort":"high","messages":[{"role":"user","content":"Review this code for edge cases."}]}'

# Responses: Max requires this endpoint and an eligible model
curl https://tokenrex.ai/api/public/v1/responses \
  -H "Authorization: Bearer $TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6-luna","reasoning":{"effort":"max"},"store":false,"input":"Review this code for edge cases."}'

Check exact-model support. Read thinking_efforts from GET /v1/models before offering choices in your app. The levels below follow the enabled catalog and shared request validation. GPT Max requires Responses; Gemini 4 Carbon, Hydrogen and Neon accept Max on Chat Completions. Unsupported levels return HTTP 400 rather than being silently ignored.

Enabled modelSupported effort settings
claude-fable-5-1Low, Medium, High, Extra high, Max
claude-haiku-5-5Low, Medium, High, Extra high, Max
claude-opus-5Low, Medium, High, Extra high, Max
claude-opus-5-5Low, Medium, High, Extra high, Max
claude-opus-5-5-fastLow, Medium, High, Extra high, Max
claude-opus-5-fastLow, Medium, High, Extra high, Max
claude-sonnet-5Low, Medium, High, Extra high, Max
claude-sonnet-5-5Low, Medium, High, Extra high, Max
gemini-3.1-flash-liteLow, Medium, High
gemini-3.1-flash-lite-fastLow, Medium, High
gemini-3.5-flashLow, Medium, High
gemini-3.7-flashLow, Medium, High
gemini-3.8-flashLow, Medium, High
gemini-4-argonLow, Medium, High
gemini-4-carbonNone, Minimal, Low, Medium, High, Extra high, Max
gemini-4-hydrogenNone, Minimal, Low, Medium, High, Extra high, Max
gemini-4-neonNone, Minimal, Low, Medium, High, Extra high, Max
gpt-5Low, Medium, High
gpt-5-fastLow, Medium, High
gpt-5-miniLow, Medium, High
gpt-5-mini-fastLow, Medium, High
gpt-5-nanoLow, Medium, High
gpt-5.2Low, Medium, High, Extra high
gpt-5.2-fastLow, Medium, High, Extra high
gpt-5.4Low, Medium, High, Extra high
gpt-5.4-fastLow, Medium, High, Extra high
gpt-5.4-miniLow, Medium, High, Extra high
gpt-5.4-mini-fastLow, Medium, High, Extra high
gpt-5.4-nanoLow, Medium, High, Extra high
gpt-5.4-proMedium, High, Extra high
gpt-5.5Low, Medium, High, Extra high
gpt-5.5-fastLow, Medium, High, Extra high
gpt-5.5-proMedium, High, Extra high
gpt-5.6-lunaLow, Medium, High, Extra high, Max
gpt-5.6-luna-fastLow, Medium, High, Extra high
gpt-5.6-solLow, Medium, High, Extra high, Max
gpt-5.6-sol-fastLow, Medium, High, Extra high
gpt-5.6-terraLow, Medium, High, Extra high, Max
gpt-5.6-terra-fastLow, Medium, High, Extra high
gpt-6-astraLow, Medium, High, Extra high, Max
gpt-6-astra-fastLow, Medium, High, Extra high
gpt-6-lunaLow, Medium, High, Extra high, Max
gpt-6-luna-fastLow, Medium, High, Extra high
gpt-6-solLow, Medium, High, Extra high, Max
gpt-6-sol-fastLow, Medium, High, Extra high
gpt-6.1-solLow, Medium, High, Extra high, Max
gpt-6.1-sol-fastLow, Medium, High, Extra high
gpt-6.1-terraLow, Medium, High, Extra high, Max
gpt-6.1-terra-fastLow, Medium, High, Extra high, Max
gpt-6.2-astraLow, Medium, High, Extra high, Max
gpt-6.2-astra-fastLow, Medium, High, Extra high
gpt-6.2-solLow, Medium, High, Extra high, Max
gpt-6.2-sol-fastLow, Medium, High, Extra high

Max thinking (Responses only). GPT-6 Astra, GPT-6 Sol, GPT-6.1 Sol, GPT-6 Luna, GPT-5.6 Sol, GPT-5.6 Terra and GPT-5.6 Luna support Max through POST /v1/responses, using the same model ID. Chat Completions rejects Max. Token rates are unchanged; more reasoning tokens can increase the total bill.

Gemini / Google

Gemini 3.1 Flash Lite, 3.5–3.8 Flash and 4 Argon support Low, Medium and High through POST /v1/chat/completions with reasoning_effort. Gemini 4 Carbon, Hydrogen and Neon support None, Minimal, Low, Medium, High, Extra high and Max on that same endpoint; None does not guarantee zero reasoning tokens. Keep the same Gemini model ID and change the effort per request. Adjustable thinking on other Gemini families remains unverified and is not offered. These are TokenRex OpenAI-compatible controls; Google-native thinking budgets and endpoints are not exposed.

curl https://tokenrex.ai/api/public/v1/chat/completions \
  -H "Authorization: Bearer $TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gemini-3.8-flash","reasoning_effort":"low","messages":[{"role":"user","content":"Review this code for edge cases."}]}'

Claude / Anthropic

For adaptive thinking on supported Claude models, use POST /v1/messages with thinking.type: "adaptive" and output_config.effort. Raise or lower the supported effort without changing the model ID. Sonnet 5.5 and Haiku 5.5 support adaptive thinking only, with low, medium, high, xhigh or max effort; a fixed budget_tokens, temperature or top_p, and Fast mode are refused. Haiku 4.5 is retired; use Haiku 5.5 instead.

# Adaptive thinking: adjust output_config.effort
curl https://tokenrex.ai/api/public/v1/messages \
  -H "Authorization: Bearer $TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-5","thinking":{"type":"adaptive"},"output_config":{"effort":"high"},"max_tokens":8192,"messages":[{"role":"user","content":"Review this code for edge cases."}]}'

# Haiku 5.5: adaptive thinking with a supported effort
curl https://tokenrex.ai/api/public/v1/messages \
  -H "Authorization: Bearer $TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-haiku-5-5","thinking":{"type":"adaptive"},"output_config":{"effort":"high"},"max_tokens":8192,"messages":[{"role":"user","content":"Review this code for edge cases."}]}'

Costs and privacy. Per-token prices do not change when you turn the knob. Actual reasoning usage can increase the bill. An effort setting is not a request to reveal private chain-of-thought; only supported returned summaries are available. Keep your API key server-side.

Jev Armour (Beta)

TokenRex now offers Jev Armour (Beta), automatic thinking-level selection powered by TypeSafe's Jev decision model. You send only a model ID and your messages; Jev reads the task and picks how hard the model should think — low, medium, high, xhigh or max — before the request runs. Jev never rewrites your prompt, never changes your model or Fast choice, and only chooses among the thinking levels your selected model actually supports.

Read the complete Jev Armour guide: how it works, use cases and limitations.

StepWhat happens
1. You sendModel ID + messages + "armour": true. No thinking setting needed.
2. Jev decidesJev judges the task's difficulty and picks the smallest thinking level that can answer it well.
3. Model answersYour chosen model runs at Jev's selected level. Simple chat stays cheap; hard problems get deep reasoning automatically.

Enable it. Add "armour": true to POST /v1/chat/completions or POST /v1/responses. It is off by default; existing requests are untouched. An explicit thinking setting (reasoning_effort, reasoning.effort or a legacy suffix) always wins over the automatic pick.

curl https://tokenrex.ai/api/public/v1/chat/completions \
  -H "Authorization: Bearer $TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6-astra","armour":true,"messages":[{"role":"user","content":"Debug this race condition in my Go worker pool."}]}'

The armour response block. Every Armour request returns an armour object so your app can see the decision:

"armour": {
  "status": "ok",       // ok | unavailable
  "thinking": "high",   // the thinking level in use
  "auto": true,         // true when Jev picked it (absent when you set it)
  "beta": true
}

The same level is also sent in the x-tokenrex-armour response header, for example thinking-high.

Use it now. Turn Armour on for mixed workloads — support chats, coding assistants and agent pipelines — where some messages are trivial and others need deep reasoning. Simple messages automatically stay on cheaper, faster levels; hard ones get the thinking they need. Jev only judges the task text; it does not inspect raw image or PDF contents.

Speed and cost. One fast Jev decision runs before the model (typically well under a second). Because Jev picks the smallest sufficient level, easy prompts avoid paying for deep reasoning they don't need. Armour checks are free during beta; you only pay the normal model tokens at the selected level.

Playground. Enable "Jev Armour (Beta)" in the + menu under Tools. Your choice is saved, and thinking becomes automatic for every message while it is on — the effort slider is overridden by Jev's pick.

Beta limits. Jev chooses only among the thinking levels your model supports (Max is never picked on Chat Completions for GPT models — use POST /v1/responses for Max). The decision reads the newest 8,000 characters of the conversation. If Jev is unreachable, the request proceeds at the default medium level with armour.status: "unavailable" — Armour never silently blocks a request. Models without adjustable thinking are answered directly with no Jev call.

Seedance 2.5, Seedream 5 Pro and Starlight Fast 2

These three models use their own native controls. Send them inside input (preferred) or flat beside model — never both. Unknown or unsupported fields are refused with a 400, never silently ignored, and nothing is charged.

ByteDance logoCreate a Seedance 2.5 video seedance-2.5

Made by ByteDance

  • prompt — up to 25,000 characters; optional when reference media is sent (one of them is required).
  • duration — whole seconds 4–30, or -1 for Auto. For edits use -1; to extend, describe the continuation and request the new seconds.
  • resolution — 480p or 720p (no 1080p). aspect_ratio — 16:9, 4:3, 1:1, 3:4, 9:16, 21:9 or adaptive.
  • image (first frame) and last_frame_image (needs image) — public URL or base64 data URL; first/last-frame jobs use the adaptive shape.
  • reference_images (≤30, ordered), reference_videos (≤10 public HTTPS URLs, 30 s combined), reference_audios (≤10, 30 s combined).
  • generate_audio, watermark — booleans. fps is fixed at 24 and output_format at mp4. seed is accepted but does not guarantee the same video.
  • camera_fixed is accepted but has no effect. use_virtual_avatar does not bypass real-person or deepfake rules.
curl https://tokenrex.ai/api/public/v1/videos \
  -H "Authorization: Bearer $TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "seedance-2.5",
  "input": {
    "prompt": "A ceramic teacup on a table. Slow cinematic push-in, gentle steam.",
    "duration": 4,
    "resolution": "480p",
    "aspect_ratio": "16:9",
    "generate_audio": true,
    "fps": 24,
    "output_format": "mp4",
    "watermark": false
  },
  "stream": false
}'

Pricing: cost = seconds × rate. Requests with reference videos use the reference-video rate instead of (not on top of) the generation rate. Auto length holds 30 seconds and settles on the real length reported.

ByteDance logoCreate a Seedream 5 Pro image seedream-5-pro

Made by ByteDance

  • prompt — required.
  • image — one URL/data URL or an ordered list of 1–10; all are kept in order. Editing requires at least one.
  • size — 1K, 2K or WIDTHxHEIGHT (for example 1536x864). watermark — boolean.
  • Always one JPEG (n omitted or 1). Not supported: quality, masks, transparency, output format, GIF/SVG, seed, negative prompt.
  • POST /v1/images/edits accepts the same JSON or multipart (model, prompt, size, watermark, repeated image[] files).
curl https://tokenrex.ai/api/public/v1/images/generations \
  -H "Authorization: Bearer $TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "seedream-5-pro",
  "input": {
    "prompt": "An editorial tea poster. Exact headline: TIFFIN TEA.",
    "size": "2K",
    "watermark": false
  },
  "stream": false
}'

Edit with ordered references (send to /images/generations or /images/edits). The image is in data[0].b64_json.

{
  "model": "seedream-5-pro",
  "input": {
    "prompt": "Keep the layout. Change the headline colour to teal.",
    "image": [
      "https://example.com/poster.jpg",
      "https://example.com/palette.png"
    ],
    "size": "2K",
    "watermark": false
  },
  "stream": false
}

Pricing: cost = $0.045 + $0.03 × reference images (text only $0.045, one reference $0.075, ten $0.345). Same price for 1K and 2K; no token, size or watermark fees.

Topaz Labs logoRestore a video with Starlight Fast 2 starlight-fast-2

Made by Topaz Labs

  • All fields are required and must describe the real file: video_uri (public HTTPS), source_container, source_width, source_height, frame_count, frame_rate.
  • start_index and end_index — zero-based, inclusive, end ≥ start. Source up to 600 seconds.
  • target_resolution — 1920x1080 or 3840x2160 tier; shape and frame rate are kept (768×512 at 8 fps → 1920×1280 or 3240×2160). upscaling_factor — 1 only.
  • Restoration only: no prompt, sound, new scenes or frame interpolation.
curl https://tokenrex.ai/api/public/v1/videos \
  -H "Authorization: Bearer $TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "starlight-fast-2",
  "input": {
    "video_uri": "https://YOUR_PUBLIC_MEDIA_HOST/source.mp4",
    "source_container": "mp4",
    "source_width": 768,
    "source_height": 512,
    "frame_count": 16,
    "frame_rate": 8,
    "start_index": 0,
    "end_index": 15,
    "target_resolution": "1920x1080",
    "upscaling_factor": 1
  },
  "stream": false
}'

Pricing: frames = end_index − start_index + 1; units = ceil(frames ÷ frames per unit); cost = units × $0.12 (300 frames: $0.72 at 1080p, $1.56 at 4K). Units reported by the provider take precedence.

Polling, download and long jobs

# 1. Check the job (free — polling never charges)
curl https://tokenrex.ai/api/public/v1/videos/VIDEO_ID \
  -H "Authorization: Bearer $TOKENREX_API_KEY"
# → {"id":"video_…","status":"queued|in_progress|completed|failed","progress":40,"created_at":…,"expires_at":…}

# 2. When status is "completed", download the MP4
curl -L -o result.mp4 https://tokenrex.ai/api/public/v1/videos/VIDEO_ID/content \
  -H "Authorization: Bearer $TOKENREX_API_KEY"
  • Save the returned id as soon as POST /v1/videos answers; the job keeps running if your app or browser closes.
  • Poll GET /v1/videos/{id} every 5–30 seconds with the same API key. Seedance usually needs minutes; Starlight restoration can take hours.
  • Polling and downloads never charge again — the job is settled once, when it first reports completed or failed.
  • Do not resend a create request after a timeout: a second request is a second paid job.

Errors

  • 400 invalid_request_error — A control is missing, out of range or not supported (unknown fields are refused, never ignored). Nothing is charged.
  • 402 insufficient_balance — Your wallet cannot cover the hold. Nothing is sent to the model.
  • status "failed" (for example moderation_blocked) — The model refused or could not finish. The hold is released and nothing is charged.
  • 409 job_failed on /content — The job failed, so there is no file to download.
  • 410 expired — The result passed its expires_at time and can no longer be downloaded. Save files before then.
  • 502 outcome_unknown — The connection broke while creating the job, so TokenRex cannot tell whether it started. It is never retried automatically; check your wallet history before sending again.

Market list prices in USD before the TokenRex discount; your wallet is charged in its own currency using TokenRex's standard conversion. A hold is placed before the job starts, settled once when it finishes, and released if it fails. No cache discounts apply.

Gemini 4 Carbon, Hydrogen and Neon

Current compatibility. Live source checks on 28 November 2026 passed Low, Medium, High, Xhigh and Max, streaming, strict JSON and function-tool round trips on all three models. The current source rejects None and Minimal with HTTP 400, despite their inclusion in the supplied contract. Use Low or higher until source compatibility is restored.

These three Gemini 4 models accept text, image, audio and video input and return text. Each has a 1,048,576-token context window, up to 65,536 output tokens and a March 2026 knowledge cutoff. The supplied catalog marks them as zero-retention. Use POST /v1/chat/completions only; Messages and Responses are not available.

Model and best forMarket prices per 1M tokens
gemini-4-carbon — complex coding, finance, legal and science$4 input / $20 output / $0.20 cached input
gemini-4-hydrogen — fast, efficient everyday coding and agents$1.50 input / $7.50 output / $0.075 cached input
gemini-4-neon — low-latency coding, multi-step reasoning and multimodal agents$3 input / $15 output / $0.15 cached input

These are market rates before the current TokenRex discount. Text, image, audio and video input share the same token rate. See each model page for live TokenRex prices.

RuleWhat to send
Reasoningreasoning_effort: none, minimal, low, medium, high, xhigh or max. Max works here on Chat Completions. None is accepted but does not guarantee zero reasoning tokens, especially on Hydrogen and Neon.
Output limitmax_tokens or max_completion_tokens up to 65,536. Reasoning tokens are included in reported completion usage.
Streaming and toolsstream:true ends with data: [DONE]. Customer-defined function tools, tool_choice and tool-result follow-ups are supported.
JSON and samplingStrict response_format json_schema, temperature, top_p and seed are accepted.
Prompt cachingAutomatic for eligible repeated prefixes. Cached reads use the listed cached-input rate. No extra cache-write surcharge; reported write tokens still use the normal input rate.
Not supportedpresence_penalty and frequency_penalty return HTTP 400. TokenRex also rejects web_search_options and hosted non-function tools instead of silently doing nothing. Fast/priority serving, image generation, speech generation and video generation are not exposed.
curl https://tokenrex.ai/api/public/v1/chat/completions \
  -H "Authorization: Bearer $TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gemini-4-carbon","reasoning_effort":"max","stream":true,"messages":[{"role":"user","content":"Review this design for edge cases."}]}'

Limits, prices and multimodal inputs follow the supplied integration contract. Text replies, five reasoning settings, streaming, strict JSON and function-tool follow-ups were rechecked through the saved fuel source on 28 November 2026; multimodal inputs and cache hits were not rechecked. Model pages include exact-version Google, Artificial Analysis and Plotly benchmark results with their own evaluation settings, not inherited Argon scores.

GPT-6.2 Astra and GPT-6.2 Sol

gpt-6.2-astra is OpenAI's frontier model for the hardest reasoning, research and coding. gpt-6.2-sol is the everyday model for coding and agents at a quarter of Astra's token price. Both accept text and images, return text, and have a 1,050,000-token context window with up to 128,000 output tokens. See GPT-6.2 prices and benchmarks.

RuleWhat to send
ReasoningAlways on. low, medium, high or xhigh on both endpoints; max only on POST /v1/responses with the standard model. none and minimal return HTTP 400. Reasoning tokens count toward the output limit.
Output limitmax_completion_tokens on Chat Completions (max_tokens is mapped to it); max_output_tokens on Responses. Up to 128,000.
Samplingtemperature, top_p and logprobs are not accepted by GPT-6.2. TokenRex removes them before forwarding.
Tools and web searchFunction tools and web_search run through Responses. On Chat Completions, a request with tools or web_search_options is routed there automatically. Web search is opt-in per request and billed per search.
Fast (priority)gpt-6.2-astra-fast and gpt-6.2-sol-fast at 2× token rates, only on POST /v1/chat/completions without tools or web search; other combinations return HTTP 400. A reply served on the standard tier is billed at the standard price. Not offered in the Playground.
StateStateless: store is always false. Resend the full history every turn, keeping each tool call together with its result.
Reasoning summariesOn Responses, reasoning.summary can be auto, concise or detailed. These are summaries, not the raw reasoning.
Long contextAbove 272,000 input tokens, the whole request uses double input and cache rates and 1.5× output rates.
# Chat Completions (streamed). Fast: use gpt-6.2-sol-fast here, without tools or web search.
curl https://tokenrex.ai/api/public/v1/chat/completions \
  -H "Authorization: Bearer $TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6.2-sol","stream":true,"reasoning_effort":"medium","max_completion_tokens":4000,"messages":[{"role":"user","content":"Explain this stack trace."}]}'

# Responses with web search and max reasoning (standard model only)
curl https://tokenrex.ai/api/public/v1/responses \
  -H "Authorization: Bearer $TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6.2-astra","stream":true,"store":false,"reasoning":{"effort":"max","summary":"auto"},"tools":[{"type":"web_search"}],"max_output_tokens":16000,"input":"What changed in the latest Python release? Cite sources."}'

Claude & remote MCP

POST /v1/messages

Connect an authorized remote MCP service through native Claude Messages. Examples need your real HTTPS server, its credentials and a verified read-only tool name. Availability depends on the selected model and remote service; no live MCP connection is claimed by these examples.

Claude featureHow to use / restrictions
Remote MCPNative /v1/messages: mcp_servers plus mcp_toolset. Supply your own remote HTTPS server and its authorization; local stdio servers cannot be reached directly.
Custom function toolsDefine name, description and input_schema. Your app validates and executes tool_use, then returns matching tool_result blocks.
Web searchAdd a web_search tool; max_uses is capped at 10. Actual searches are billed at $10 per 1,000 at market rate, less the current TokenRex discount, plus model tokens.
Web fetchAdd web_fetch_20250910. TokenRex adds no separate fetch fee; fetched content uses input tokens.
Images and PDFsUse native image/document content blocks with URL or base64 sources on eligible models. These are inputs, not generated images or files.
Thinking and FastKeep one standard or Fast model ID. Native adaptive thinking uses thinking.type=adaptive and output_config.effort; Sonnet 5, Opus 5, Opus 5.5 and Fable 5.1 (standard or Fast) accept effort max, while Haiku 4.5 uses thinking.type=enabled with budget_tokens below max_tokens and has no Max. Fast alone is a separate listed model. Fable 5.1 and Opus 5.5 accept only auto tool choice.
Structured outputUse output_config.format with type json_schema and a schema on eligible models. Sampling and thinking options remain model-specific.
CompactionNative context_management.edits with type compact_20260112 and compact-2026-01-12 beta. Eligibility is model-specific; preserve returned conversation blocks.
Long contextcontext-1m-2025-08-07 is an accepted beta header, not a promise that every Claude model has 1M context. Check exact-model limits and current availability.
US servinginference_geo accepts us or global. Reported US serving applies a 1.1× factor to input, output, cache reads and both cache-write lifetimes for Fable 5.1, Haiku 5.5, Opus 5/5.5 and Sonnet 5/5.5, including listed Fast versions. A requested geography alone is not proof of US serving.
Fast modeOpus 5 and Opus 5.5 accept Anthropic's own fast switch: keep the normal model id, send speed: "fast" and the anthropic-beta header fast-mode-2026-02-01. It bills exactly like the separate -fast id (for example claude-opus-5-5-fast); replies not served fast bill at the standard price. Without the switch the model stays standard.
Prompt cachingMark stable blocks with cache_control. Read live exact-model read/write rates; ttl: 1h uses the listed 1-hour write rate (2× normal input), not the 5-minute rate.
Not includedNo hosted file search, computer use or unrestricted code execution. Remote MCP in the API is not a Playground connection manager or a TokenRex MCP server.

MCP has no additional TokenRex connector fee, but tool definitions, tool results and model output consume tokens. The remote service may charge separately. Web search adds its actual search fee; web fetch does not add a search fee. Cache reads and writes use the exact model’s live rates; cached output is not offered. Fast and reported US serving can change token costs. Wallet charges are rounded up to whole paise; repeated model/tool rounds are separate billable requests.

This connects Claude to your remote service through the API. Playground does not currently offer a general MCP connection manager. OAuth must be completed with the remote service separately; never use an app-session token or your TokenRex key as that service’s credential.

const body = {
  "model": "claude-sonnet-5",
  "max_tokens": 2048,
  "stream": true,
  "messages": [
    {
      "role": "user",
      "content": "Use the approved read-only tool to summarize my project. Cite the records you used."
    }
  ],
  "mcp_servers": [
    {
      "type": "url",
      "name": "workspace",
      "url": "YOUR_REMOTE_HTTPS_MCP_URL",
      "authorization_token": "YOUR_REMOTE_SERVICE_TOKEN"
    }
  ],
  "tools": [
    {
      "type": "mcp_toolset",
      "mcp_server_name": "workspace",
      "default_config": {
        "enabled": false
      },
      "configs": {
        "approved_read_tool": {
          "enabled": true
        }
      }
    }
  ]
};
body.mcp_servers[0].url = process.env.REMOTE_MCP_URL;
body.mcp_servers[0].authorization_token = process.env.REMOTE_MCP_TOKEN;
// Replace approved_read_tool with a real tool from your server.
const response = await fetch("https://tokenrex.ai/api/public/v1/messages", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.TOKENREX_API_KEY}`,
    "Content-Type": "application/json", "anthropic-beta": "mcp-client-2025-11-20" },
  body: JSON.stringify(body),
});
if (!response.ok) throw new Error(await response.text());
// Forward this SSE body to your streaming parser; read until message_stop.
for await (const chunk of response.body) process.stdout.write(chunk);

Simple chat completion

POST /v1/chat/completions

Basic Q&A / assistant reply — the most common call. Works with every GPT / Gemini text model.

Frontier coding & analysis

$5.00 in / $30.00 out per 1M tokens30% off

$3.50 in / $21.00 out per 1M tokens

Cache Read:
$0.3500
/1M Tokens
Cache Write:
No extra fee; normal input applies
Cache TTL:
Automatic; lifetime not published
Web Search:
$7.00
/1K Searches
Supported settings
  • modelRequired. One standard or Fast model ID; thinking is a separate setting.
  • messagesRequired. System, user and assistant turns; image parts on vision models.
  • streamToken-by-token Server-Sent Events, same format as OpenAI.
  • max_completion_tokensCaps the reply length (up to 128,000).
  • tools / tool_choiceYour own function tools, on models that support them.
  • Thinking depthUse reasoning_effort on chat, reasoning.effort on Responses, or native Claude thinking controls. Same price per token.
  • temperature, top_p, seed, stop, penaltiesModel-specific. Unsupported settings can return 400; omit sampling controls on GPT-6 Astra.
  • response_formatUse a supported strict json_schema for enforced JSON. Native Claude uses output_config.format.
curl https://tokenrex.ai/api/public/v1/chat/completions \
  -H "Authorization: Bearer YOUR_TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.5",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user",   "content": "Explain quantum computing in 2 lines for a 12-year-old."}
    ]
  }'

Live streaming (token-by-token)

POST /v1/chat/completions · stream: true

Type-writer effect — perfect for chatbots. Set `stream: true` and read the SSE data frames.

Frontier coding & analysis

$5.00 in / $30.00 out per 1M tokens30% off

$3.50 in / $21.00 out per 1M tokens

Cache Read:
$0.3500
/1M Tokens
Cache Write:
No extra fee; normal input applies
Cache TTL:
Automatic; lifetime not published
Web Search:
$7.00
/1K Searches
Supported settings
  • modelRequired. One standard or Fast model ID; thinking is a separate setting.
  • messagesRequired. System, user and assistant turns; image parts on vision models.
  • streamToken-by-token Server-Sent Events, same format as OpenAI.
  • max_completion_tokensCaps the reply length (up to 128,000).
  • tools / tool_choiceYour own function tools, on models that support them.
  • Thinking depthUse reasoning_effort on chat, reasoning.effort on Responses, or native Claude thinking controls. Same price per token.
  • temperature, top_p, seed, stop, penaltiesModel-specific. Unsupported settings can return 400; omit sampling controls on GPT-6 Astra.
  • response_formatUse a supported strict json_schema for enforced JSON. Native Claude uses output_config.format.
from openai import OpenAI

client = OpenAI(api_key="YOUR_TOKENREX_API_KEY", base_url="https://tokenrex.ai/api/public/v1")

with client.chat.completions.stream(
    model="gpt-5.5",
    messages=[{"role": "user", "content": "Write a short poem about the ocean."}],
) as stream:
    for event in stream:
        if event.type == "content.delta":
            print(event.delta, end="", flush=True)

Vision — analyse an image

POST /v1/chat/completions

Send an image URL (or base64 data URL) as part of the user message. Use a vision-capable model.

Frontier coding & analysis

$5.00 in / $30.00 out per 1M tokens30% off

$3.50 in / $21.00 out per 1M tokens

Cache Read:
$0.3500
/1M Tokens
Cache Write:
No extra fee; normal input applies
Cache TTL:
Automatic; lifetime not published
Web Search:
$7.00
/1K Searches
Supported settings
  • modelRequired. One standard or Fast model ID; thinking is a separate setting.
  • messagesRequired. System, user and assistant turns; image parts on vision models.
  • streamToken-by-token Server-Sent Events, same format as OpenAI.
  • max_completion_tokensCaps the reply length (up to 128,000).
  • tools / tool_choiceYour own function tools, on models that support them.
  • Thinking depthUse reasoning_effort on chat, reasoning.effort on Responses, or native Claude thinking controls. Same price per token.
  • temperature, top_p, seed, stop, penaltiesModel-specific. Unsupported settings can return 400; omit sampling controls on GPT-6 Astra.
  • response_formatUse a supported strict json_schema for enforced JSON. Native Claude uses output_config.format.
from openai import OpenAI

client = OpenAI(api_key="YOUR_TOKENREX_API_KEY", base_url="https://tokenrex.ai/api/public/v1")

r = client.chat.completions.create(
    model="gpt-5.5",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "What is in this image? Describe it in one paragraph."},
            {"type": "image_url", "image_url": {"url": "https://YOUR_PUBLIC_IMAGE_HOST/photo.jpg"}},
        ],
    }],
)
print(r.choices[0].message.content)

Structured JSON output

POST /v1/chat/completions

Extract structured data with a supported strict json_schema. Prompt-only JSON is not schema-enforced; native Claude uses output_config.format.

Frontier coding & analysis

$5.00 in / $30.00 out per 1M tokens30% off

$3.50 in / $21.00 out per 1M tokens

Cache Read:
$0.3500
/1M Tokens
Cache Write:
No extra fee; normal input applies
Cache TTL:
Automatic; lifetime not published
Web Search:
$7.00
/1K Searches
Supported settings
  • modelRequired. One standard or Fast model ID; thinking is a separate setting.
  • messagesRequired. System, user and assistant turns; image parts on vision models.
  • streamToken-by-token Server-Sent Events, same format as OpenAI.
  • max_completion_tokensCaps the reply length (up to 128,000).
  • tools / tool_choiceYour own function tools, on models that support them.
  • Thinking depthUse reasoning_effort on chat, reasoning.effort on Responses, or native Claude thinking controls. Same price per token.
  • temperature, top_p, seed, stop, penaltiesModel-specific. Unsupported settings can return 400; omit sampling controls on GPT-6 Astra.
  • response_formatUse a supported strict json_schema for enforced JSON. Native Claude uses output_config.format.
from openai import OpenAI
client = OpenAI(api_key="YOUR_TOKENREX_API_KEY", base_url="https://tokenrex.ai/api/public/v1")

r = client.chat.completions.create(
    model="gpt-5.5",
    messages=[
        {"role": "system", "content": "Reply ONLY with JSON: {name,email,city}."},
        {"role": "user",   "content": "Hi, I'm Ravi from Mumbai — ravi@example.com"},
    ],
)
print(r.choices[0].message.content)  # {"name":"Ravi","email":"...","city":"Mumbai"}

Image generation

POST /v1/images/generations · /v1/images/edits

Text → image. Returns a base64 image or URL you can save/display.

gpt-image-2.6-sunburst
Full model details

Quality-first image generation and editing with complexity, markup and animated GIF controls

$5.00 text in / $30.00 image out / $8.00 image in per 1M tokens30% off

$3.50 text in / $21.00 image out / $5.60 image in per 1M tokens

Cache Read:
No separate rate listed
Cache Write:
Not applicable
Supported settings
  • promptRequired. Describe the image.
  • sizeOpenAI models: 1024x1024, 1024x1536, 1536x1024 and more. Gemini: pick the -2k / -4k model ID.
  • qualityOpenAI models: low, medium, high (some add xhigh, max). Priced by tokens used.
  • output_format / backgroundPNG, JPEG, WebP; GPT Image 2.6 also animated GIF and transparent PNG/WebP/GIF. SVG is not exposed.
  • Image editingSend ordered references to /v1/images/edits; 2.6 supports mask or markup, never both.
  • 2.6 complexityLow, medium or high planning effort, separate from six quality levels.
  • Animated GIF2.6: 2–16 frames, 20–2,000 ms per frame. Playground uses saved jobs; no streaming, mask or compression.
curl https://tokenrex.ai/api/public/v1/images/generations \
  -H "Authorization: Bearer YOUR_TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.6-sunburst",
    "prompt": "A cinematic sunset over the Himalayas, ultra-detailed, 4k",
    "size": "1024x1024"
  }'

Image quality, resolution, pricing and editing

Prices below use the live catalog and current offer. Billing uses ₹96 per US dollar and rounds each charge up to whole paise. OpenAI image models are billed by the tokens the request actually uses, so Low quality costs far less than Max. Gemini image models are billed per image, and each resolution has its own model ID.

ModelQualitySize / resolutionAspect ratioFormatsTransparentEditingPrice
gpt-image-2.6-sunburst
Auto / Low / Medium / High / XHigh / MaxAuto or custom WIDTHxHEIGHTRaster 1:3 to 3:1PNG / JPEG / WebP / animated GIFYesYes (references, mask or markup)
$3.50 text in / $21.00 image out / $5.60 image in per 1M tokens · $5.60 image input / 1M
Quality-first. Complexity Low / Medium / High. GIF: 2–16 frames, 20–2,000 ms each. SVG unavailable. Provider cache rates are $1.25 text / $2 image per 1M; TokenRex does not currently apply a separate cached-input discount for these models.
gpt-image-2.6-flare
Auto / Low / Medium / High / XHigh / MaxAuto or custom WIDTHxHEIGHTRaster 1:3 to 3:1PNG / JPEG / WebP / animated GIFYesYes (references, mask or markup)
$3.50 text in / $21.00 image out / $5.60 image in per 1M tokens · $5.60 image input / 1M
Latency-first. Complexity Low / Medium / High. GIF: 2–16 frames, 20–2,000 ms each. SVG unavailable. Provider cache rates are $1.25 text / $2 image per 1M; TokenRex does not currently apply a separate cached-input discount for these models.
gpt-image-2.5-sunburst
Low / Medium / High / XHigh / MaxFlexible (size param)Flexible (1:3 to 3:1)PNG / JPEG / WebPYesYes (multiple references, mask)
$3.50 text in / $21.00 image out / $5.60 image in per 1M tokens · $5.60 image input / 1M
At 1024×1024: Low ≈ ₹0.36, Medium ≈ ₹0.8, High ≈ ₹3.16, XHigh ≈ ₹5.62, Max ≈ ₹12.65 per image. Larger sizes use more tokens.
gpt-image-2.5-flare
Low / Medium / High / XHigh / MaxFlexible (size param)Flexible (1:3 to 3:1)PNG / JPEG / WebPYesYes (multiple references, mask)
$3.50 text in / $21.00 image out / $5.60 image in per 1M tokens · $5.60 image input / 1M
Same token rates as Sunburst; tuned for speed. At 1024×1024: Low ≈ ₹0.36, Medium ≈ ₹0.8, High ≈ ₹3.16, Max ≈ ₹12.65.
gpt-image-2
Low / Medium / HighFlexible (size param)Flexible (1:3 to 3:1)PNG / JPEG / WebPNoYes (multiple references, mask)
$3.50 text in / $21.00 image out / $5.60 image in per 1M tokens · $5.60 image input / 1M
At 1024×1024: Low ≈ ₹0.36, Medium ≈ ₹3.16, High ≈ ₹12.65. $15/M is OpenAI Batch pricing, which does not apply to live requests.
gpt-image-1-mini
Low / Medium / High1024² / 1024×1536 / 1536×1024LimitedPNG / JPEG / WebPNoYes
Current rate unavailable
Being retired upstream — choose GPT Image 2.5 Flare for new work.
gemini-3-pro-image
Fixed1K (default) · 2K · 4K versions10 ratios (image_config.aspect_ratio)PNGNoYes (multiple references)
$0.0938 per image
Use gemini-3-pro-image-2k or -4k for higher resolution.
gemini-3.1-flash-image
Fixed1K (default) · 2K · 4K versions14 ratios (image_config.aspect_ratio)PNGNoYes (multiple references)
$0.047 per image
Use gemini-3.1-flash-image-2k or -4k. 0.5K is not available through the gateway.
gemini-3.1-flash-lite-image
Fixed1K onlyDefault onlyPNG / JPEGNoYes
$0.0236 per image
2K is rejected by the provider; no higher-resolution versions.

How to use each control

  • Quality (OpenAI): send quality as low, medium or high. GPT Image 2.5 and 2.6 Flare and Sunburst also accept xhigh and max. If you leave it out, high is used.
  • Size (OpenAI): send size such as 1024x1024, 1536x1024 or 1024x1536. Custom sizes must be multiples of 16, between 1:3 and 3:1, up to 3840 px per side. Bigger images use more tokens and cost more.
  • File format: output_format = png, jpeg or webp, with optional output_compression 0–100.
  • Transparent background: GPT Image 2.5 and 2.6 Flare and Sunburst accept background: "transparent" with PNG or WebP. Tested: Sunburst Max returned a real transparent PNG.
  • Resolution (Gemini): pick the model ID — gemini-3.1-flash-image (1K), -2k or -4k; same for gemini-3-pro-image. Tested: 1K returned 1024×1024, 2K returned 2048×2048, 4K returned 4096×4096. Lite and 2.5 Flash are 1K only.
  • Aspect ratio (Gemini 3 Pro / 3.1 Flash): send "image_config": {"aspect_ratio": "16:9"}. Tested: 3.1 Flash 4K at 16:9 returned 5504×3072. Gemini does not accept OpenAI quality, size, format or background fields.
  • Editing: POST /v1/images/edits with one image or several image[] files, in order. OpenAI models also accept a PNG mask. Gemini makes one image per request (n=1).
  • Charges: you only pay for images actually returned. A failed request is refunded. The exact charge is in the x-tokenrex-cost-paise response header.

GPT Image 2.6: animation and precise edits

complexity accepts low, medium or high (default high), independently of quality. It has no separate fee; actual tokens determine the bill.

output_format: gif produces a complete animation. Set frame_count to 2–16 (default 9) and frame_duration_ms to 20–2,000 (default 200, rounded by the provider to 10 ms). Prefer size auto: frames must fit an unpublished pixel budget. In our live tests auto (512×512 frames) and 768×768 worked, while 1024×1024 frames were refused even at 2 frames. Transparent GIF is supported; GIF has binary transparency rather than PNG’s full alpha.

GIF does not accept streaming, partial_images, mask or output_compression. The Playground creates a saved, private job through POST /v1/images/jobs; GET /v1/images/jobs?id=JOB_ID&model=MODEL_ID checks it. Reopening never regenerates it. Direct API generation and edits return completed base64 JSON.

For edits, upload ordered image or image[] files and an optional transparent PNG markup overlay matching the original dimensions. Markup supplies visible instructions; a PNG mask identifies editable regions. Never combine both. Reuse the previous output for iterative edits and restate what must remain unchanged; perfect consistency is not guaranteed.

Official upstream cache rates are $1.25 text input and $2 image input per 1M tokens. TokenRex does not currently offer verified cache discounts for this model, so TokenRex uses normal input rates. Cached output is not offered.

OpenAI describes SVG output, but our current image service does not expose SVG. PNG, JPEG, WebP and GIF are the supported output choices. No exact 2.6 benchmark ranking was independently verified; functional tests are not benchmark scores.

Tested token usage at 1024×1024

Image-output tokens from real requests (one image each). Use this model’s live image-output rate above; these measurements apply only to the listed older models.

gpt-image-2
Low 196 · Medium 1,756 · High 7,024
gpt-image-2.5-flare
Low 196 · Medium 439 · High 1,756 · XHigh 3,122 · Max 7,024
gpt-image-2.5-sunburst
Low 196 · Medium 439 · High 1,756 · XHigh 3,122 · Max 7,024

OpenAI pricing · Gemini pricing · OpenAI image controls · Gemini image controls

curl https://tokenrex.ai/api/public/v1/images/generations -H "Authorization: Bearer $TOKENREX_API_KEY" -H "Content-Type: application/json" -d '{"model":"gpt-image-2.6-flare","prompt":"A blue bird waving in a seamless loop","quality":"medium","complexity":"low","output_format":"gif","background":"transparent","frame_count":9,"frame_duration_ms":200,"size":"auto"}'

Text-to-Speech (TTS)

POST /v1/audio/speech

Text → MP3 audio. Download the file, or add "stream_format": "sse" (OpenAI models) to get audio chunks live as they are made — playback can start in under a second. ElevenLabs models (eleven-v3, eleven-multilingual-v2, eleven-flash-v2.5) take text + voice_id (one of 22 licensed voices, default Darian), optional voice_settings (stability, similarity_boost, style 0–1, speed 0.7–1.2, use_speaker_boost), language_code, seed, apply_text_normalization and output_format; they return raw audio (no stream_format) and are billed per 1,000 characters. Eleven v3 follows audio tags like [laughs] and [whispers].

gpt-4o-mini-tts
Full model details

OpenAI streaming TTS

$0.015 per 1k chars30% off

$0.0105 per 1k chars

Supported settings
  • inputRequired. The text to speak.
  • voiceOpenAI and Gemini each have their own voice list (use the picker).
curl https://tokenrex.ai/api/public/v1/audio/speech \
  -H "Authorization: Bearer YOUR_TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini-tts","text":"[laughs] Arre wah!","voice_id":"Bella","language_code":"hi",
       "voice_settings":{"stability":0.5,"similarity_boost":0.75,"speed":1.0}}' \
  -o out.mp3

Speech-to-Text (STT)

POST /v1/audio/transcriptions

Audio file → transcript. Upload MP3/WAV/M4A and get plain text, or send stream=true to receive the words live as transcript.text.delta events. Hindi and Hinglish work.

gpt-transcribe
Full model details

Latest OpenAI speech-to-text — context, keyword and language hints for names & specialist words

$0.00458 per audio minute30% off

$0.00321 per audio minute

Supported settings
  • fileRequired. Audio file upload (multipart).
  • languageOptional hint; auto-detected when omitted.
curl https://tokenrex.ai/api/public/v1/audio/transcriptions \
  -H "Authorization: Bearer YOUR_TOKENREX_API_KEY" \
  -F file="@hello.mp3" \
  -F model="gpt-transcribe"

Music generation (Lyria 3 and Eleven Music v2)

POST /v1/music

Text (or an image) → 48 kHz stereo MP3 music. Lyria 3 Clip makes 30-second clips and loops ($0.04/clip); Lyria 3 Pro makes full songs up to ~3 minutes with verses, choruses, bridges and timed lyrics ($0.08/song) at market price. Control genre, BPM, key/scale, mood, instruments, vocals and arrangement through the prompt; supply custom lyrics with [Verse]/[Chorus] tags.

lyria-3-clip-preview
Full model details

30-second music clips, loops and previews — vocals or instrumentals, from text or an image

$0.04 per clip30% off

$0.028 per clip

Supported settings
  • Text promptGenre, BPM, key, mood, instruments, vocals and lyrics all go in the prompt.
  • Image inspirationOptional inline image to set the mood.
  • stream / backgroundNot supported — one call returns one MP3 track.
curl https://tokenrex.ai/api/public/v1/music \
  -H "Authorization: Bearer YOUR_TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"lyria-3-clip-preview","prompt":"calm lo-fi piano","music_length_ms":10000,"force_instrumental":true}' \
  -o song.mp3

Video generation (Veo 3.1)

POST /v1/videos · GET /v1/videos/{id}

Text → video. Start a job with POST /v1/videos, then poll GET /v1/videos/{id} until it's ready.

Highest-quality Veo video

$0.40 per second30% off

$0.28 per second

Supported settings
  • promptRequired. Describe the scene.
  • resolution720p, 1080p or 4k depending on the model.
  • duration_seconds4, 6 or 8 seconds. Billed per second.
  • PollingStart the job, then poll GET /v1/videos/{id} (free) until done.
# 1) create the job (wallet is charged per second up-front)
curl https://tokenrex.ai/api/public/v1/videos \
  -H "Authorization: Bearer YOUR_TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "veo-3.1",
    "prompt": "A cinematic drone shot over the Himalayas at golden hour",
    "duration_seconds": 6,
    "resolution": "720p"
  }'

# 2) poll until status = completed (polling is free)
curl https://tokenrex.ai/api/public/v1/videos/VIDEO_ID \
  -H "Authorization: Bearer YOUR_TOKENREX_API_KEY"

Live voice & tools (GPT Live 1 and 1.1)

WSS /v1/live

GPT Live 1 and GPT Live 1.1 power two-way audio conversation; 1.1 has more accurate transcription and steadier accents and uses the same protocol (connect with ?model=gpt-live-1.1). TokenRex also builds Voice (TTS, Beta) and Transcribe (STT) modes on each model (gpt-live-1.1-voice, gpt-live-1.1-transcribe); they are not separately trained OpenAI models. All use live per-second session billing with a 15-second minimum, including silence. Read current prices and minute equivalents on each model page. Customer-authorized conversation tools are billed separately.

Real-time two-way voice with interruptions and app tools; more accurate transcription and steadier accents than GPT Live 1

$0.00083 per second30% off

$0.00058 per second

Supported settings
  • Voice in / voice outFull duplex with interruptions. Billed per second.
  • Function toolsYour own tools; their usage is billed at normal prices.
  • Image / video inputGPT Live is audio-only.
// 1) microphone + WebRTC offer
const mic = await navigator.mediaDevices.getUserMedia({ audio: true });
const pc = new RTCPeerConnection();
mic.getTracks().forEach((t) => pc.addTrack(t, mic));
pc.createDataChannel("oai-events");
const audio = new Audio(); audio.autoplay = true;
pc.ontrack = (e) => (audio.srcObject = e.streams[0]);
await pc.setLocalDescription(await pc.createOffer());
await new Promise((r) => pc.iceGatheringState === "complete" ? r() :
  pc.addEventListener("icegatheringstatechange", () => pc.iceGatheringState === "complete" && r()));

// 2) connect to TokenRex (use a server-side proxy in production to hide your key)
const ws = new WebSocket("wss://tokenrex.ai/api/public/v1/live?model=gpt-live-1&key=YOUR_TOKENREX_API_KEY");
ws.onopen = () => ws.send(JSON.stringify({
  type: "session.start",
  session: {
    instructions: "You are a friendly assistant. Use customer tools when needed and ask for confirmation before sensitive actions.",
    audio: { output: { voice: "marin" } },
  },
  tools: [
    { name: "get_weather", description: "Current weather from my app's weather service" },
    { name: "web_search", description: "Current web results from my app's search service" },
    { name: "browser_action", description: "A user-approved browser action executed by my app" },
  ],
  transport: { type: "webrtc", sdp: pc.localDescription.sdp },
}));

// 3) apply the answer + send a heartbeat every second (call ends after 5s without one)
let hb;
ws.onmessage = async (m) => {
  const ev = JSON.parse(m.data);
  if (ev.type === "gateway.session.created") {
    await pc.setRemoteDescription({ type: "answer", sdp: ev.transport.sdp });
    hb = setInterval(() => ws.send(JSON.stringify({ type: "gateway.heartbeat" })), 1000);
  }
  if (ev.type === "session.usage.updated") console.log("seconds:", ev.usage.seconds);
  // Your app chooses and executes the right tool. TokenRex never controls
  // the computer or calls third-party APIs without your app's permission.
  if (ev.type === "tokenrex.tool.request") {
    const result = await runMyApprovedTool(ev.transcript); // weather/search/browser/etc.
    ws.send(JSON.stringify({
      type: "tokenrex.tool.result",
      call_id: ev.call_id,
      name: result.name,
      output: result.output,
    }));
  }
  if (ev.type === "tokenrex.error") console.error(ev.error.message);
};

// 4) Camera or screen vision uses a separate TokenRex vision request.
// Capture only after the user grants permission and clicks your visible control.
async function shareVisualContext(dataUrl, source = "screen") {
  const vision = await fetch("https://tokenrex.ai/api/public/v1/chat/completions", {
    method: "POST",
    headers: { Authorization: "Bearer YOUR_TOKENREX_API_KEY", "Content-Type": "application/json" },
    body: JSON.stringify({
      model: "gpt-live-1.1",
      messages: [{ role: "user", content: [
        { type: "text", text: "Describe visible text, controls and objects accurately. Do not guess hidden details." },
        { type: "image_url", image_url: { url: dataUrl } },
      ] }],
    }),
  }).then((r) => r.json());
  ws.send(JSON.stringify({
    type: "tokenrex.context.append",
    source,
    content: vision.choices[0].message.content,
  }));
}

// 5) hang up
function endCall() {
  clearInterval(hb);
  ws.send(JSON.stringify({ type: "session.close" }));
  mic.getTracks().forEach((t) => t.stop());
  pc.close();
}

GPT Live 1 — conversation, Voice and Transcribe

GPT Live 1 is the underlying OpenAI live audio model. TokenRex also offers Voice for text reading and Transcribe for microphone transcription, using the same live session with mode-specific instructions.

Voice and Transcribe are modified modes made by TokenRex, not separately trained OpenAI models or native standalone TTS/STT endpoints. The underlying GPT Live 1 model still runs. Only Voice carries the Beta label. Reading may skip or change words, and transcription may produce attempted responses; exact reading, permanent silence and instant speech are not guaranteed.

Pricing — billed per second, not per character

Current TokenRex rate: $0.00058 per second, equivalent to $0.0349 per minute. The minimum is 15 seconds per session ($0.00875). A minute is an equivalent, not a billing block. All connected time, including silence and waiting between readings, is billable. Muting playback does not lower the rate. Any separately requested reasoning or tool usage has its own charges.

Session durationEstimated charge
15-second minimum$0.00875
20 seconds$0.0117
1 minute$0.0349
10 minutes$0.349
1 hour$2.09

Voices, languages and accents

Discover sourced voice IDs through GET /api/public/v1/models → this model → live.voices. Use session.audio.output.voice (default marin); voice selection is fixed for the call. Languages and accents are instruction preferences, not native speed controls. The first 22 voices were session-tested; additional documented voices have not been individually auditioned. Transcribe does not need a spoken output voice.

VoiceAccentCharacter
Marin (marin)Neutral (default)Feminine
Cedar (cedar)NeutralMasculine
Alloy (alloy)NeutralNeutral
Ash (ash)NeutralMasculine
Ballad (ballad)NeutralMasculine
Coral (coral)NeutralFeminine
Echo (echo)NeutralMasculine
Sage (sage)NeutralFeminine
Shimmer (shimmer)NeutralFeminine
Verse (verse)NeutralMasculine
Quartz (quartz)English / AustralianFeminine
Ripple (ripple)English / AustralianMasculine
Vesper (vesper)English / BritishMasculine
Willow (willow)English / IrishFeminine
Stone (stone)English / IrishMasculine
Gleam (gleam)English / North AmericanFeminine
Meridian (meridian)English / North AmericanMasculine
Bossa (bossa)Portuguese / BrazilianFeminine
Tempo (tempo)Portuguese / BrazilianMasculine
Beacon (beacon)English / FilipinoMasculine
Delta (delta)English / Southern USFeminine
Cinder (cinder)English / Southern USMasculine
Nuri (nuri)GermanFeminine
Juni (juni)GermanFeminine
Flitz (flitz)GermanMasculine
Brise (brise)FrenchFeminine
Sillage (sillage)FrenchMasculine
Nira (nira)HindiFeminine
Harema (harema)JapaneseFeminine
Noeul (noeul)KoreanFeminine

Conversation capabilities

Speech input (microphone)Yes
Speech output (natural voice)Yes
Real-time two-way conversationYes
Full duplex — listens while speakingYes
User interruption / barge-inYes
Silence handlingYes
Background-noise handlingYes
Native speech transcriptYes
Response text alongside audioYes
Multilingual conversationYes
TranslationYes (via your backend setup)
Function calling (your tools)Yes
Backend model delegationYes
Web / tool useYes (through delegated backend)
Phone calls / telephony (SIP)Yes
WebRTCYes
WebSocketYes
Long conversationsYes
Image input directlyNo
Video input directlyNo
Image generation directlyNo
Video generation directlyNo
Fine-tuningNo
Structured outputsNo

Conversation tools must be authorized, validated and executed by your own application. Direct image and video input are not supported by this live audio model.

Embeddings (vector search)

POST /v1/embeddings

Text → number array. Store in Postgres / Pinecone for semantic search.

text-embedding-3-small
Full model details

Lightweight embeddings

$0.02 per 1M tokens30% off

$0.014 per 1M tokens

Cache Read:
Not applicable
Cache Write:
Not applicable
Supported settings
  • inputA string or an array of strings. Billed per input token.
from openai import OpenAI
client = OpenAI(api_key="YOUR_TOKENREX_API_KEY", base_url="https://tokenrex.ai/api/public/v1")

r = client.embeddings.create(
    model="text-embedding-3-small",
    input=["hello world", "TokenRex rocks"],
)
print(len(r.data[0].embedding))  # 1536

Typed decisions (classify / score / route)

POST /v1/decisions

Text in → typed answers with probabilities. Perfect for moderation, ticket routing and ranking.

Typed decisions with probabilities — classification, scoring and routing

$0.0421 per 1M tokens30% off

$0.0295 per 1M tokens

Cache Read:
Not applicable
Cache Write:
Not applicable
Supported settings
  • questionsTyped questions (choice, score, yes/no) answered with probabilities.
curl https://tokenrex.ai/api/public/v1/decisions \
  -H "Authorization: Bearer YOUR_TOKENREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jev-1.13",
    "state": "Customer says: my order never arrived and I want a refund.",
    "questions": {
      "category": {
        "type": "choice",
        "instructions": "Classify the support ticket.",
        "criteria": {
          "refund": "Wants money back",
          "shipping": "Delivery problem",
          "technical": "Product not working",
          "other": "Anything else"
        }
      },
      "urgent": {
        "type": "noul",
        "instructions": "Is this urgent?",
        "criteria": { "true": "Needs action today", "false": "Can wait" }
      },
      "severity": {
        "type": "score",
        "instructions": "Rate severity.",
        "criteria": ["Minor annoyance", "Moderate issue", "Severe issue"]
      }
    }
  }'

Check wallet balance

GET /v1/balance

Read your remaining TokenRex wallet balance in real-time.

curl https://tokenrex.ai/api/public/v1/balance \
  -H "Authorization: Bearer YOUR_TOKENREX_API_KEY"

Pricing & billing

Every model uses its listed TokenRex rate after the current model discount (converted at ₹96 per US dollar). Charges are taken from your wallet in paise when a request completes:

  • Chat and embeddings — by input and output tokens.
  • OpenAI images — by text-input, image-input and image-output tokens.
  • Gemini images, music — per image or per track. Video and live voice — per second.
  • ElevenLabs speech — per 1,000 text characters. Eleven Music v2 — per generated second.

Prompt caching. Eligible repeated input prefixes can be charged at this model’s cached-input rate when the gateway reports a cache hit. Cache creation uses the listed cache-write rate where applicable. Output is always billed at the standard output rate. See Prompt caching & rates for every chat model’s live rates, usage fields and request examples.

Fast versions are the only separate chat variants: select an enabled -fast ID and read its live price. Thinking settings do not create another model. Billing follows the serving tier actually used; standard-tier replies use standard prices.

Reasoning uses the same token rates; adjust it in the Thinking Knob section.

Each response includes an x-tokenrex-cost-paise header with the exact charge. Your Dashboard shows what you spent next to the market price.

Smallest charge. Each request’s total is rounded up to the next whole paisa (₹0.01, about $0.0001). A very small request therefore costs 1 paisa even when its token cost is lower: embedding a two-token string, for example, is charged 1 paisa. When indexing many short chunks, send them together as an array in one /v1/embeddings request so the rounding applies once per request rather than once per chunk.

Prompt caching & rates

Cached input reuses an eligible unchanged prompt prefix. A cache hit depends on the model, prefix length and cache lifetime, and is not guaranteed.

Token typeHow it is billed
Fresh inputNormal input rate for tokens not read from or written to cache.
Cached inputThis exact model’s cached-input rate when the gateway reports a cache read. If no separate rate is listed, the normal input rate applies.
Cache writeThe listed write rate when the gateway reports cache creation; otherwise no separate write fee.
Cached outputNot offered. Generated output uses the standard output rate.

OpenAI and Gemini use eligible prompt prefixes automatically. Claude requests on /v1/chat/completions receive cache markers automatically, so the first long request is billed at the cache-write rate (about 1.25× input) and later identical prefixes at the much lower cached rate. The serving provider may also cache long Claude prompts on its own, so a single long request can show cache-write tokens in usage; the charge always follows the reported usage. For native Claude Messages, mark stable content with cache_control. Keep the reusable prefix unchanged and put the new question last.

// Native Claude Messages: mark a reusable system block
"system": [{ "type": "text", "text": "Your long reusable instructions…",
  "cache_control": { "type": "ephemeral" } }]

// Inspect actual cache use in response usage:
// Chat: usage.prompt_tokens_details.cached_tokens
// Responses: usage.input_tokens_details.cached_tokens
// Claude: usage.cache_read_input_tokens / cache_creation_input_tokens

Rates below come from the live enabled-model list and include each standard and Fast model, with the current model discount applied. Cache eligibility remains model-specific.

ModelsDefault lifetime / write priceExtended lifetime / write price
Claude Fable 5.1, Haiku 5.5, Opus 5/5.5, Sonnet 5/5.5 and listed Opus Fast models5 minutes: write 1.25× input1 hour: write 2× input; cache_control on native Messages
GPT-6 Astra and GPT-6.1 Sol, standard/Fast30 minutes: write 1.25× input12 hours is not offered
GPT-6.1 Terra, standard/Fast; GPT-6.2 Astra/Sol standard30 minutes: write 1.25× input12 hours: write 2.5× input; prompt_cache_options on Responses
GPT-6.2 Astra/Sol Fast30 minutes: automatic writes at the Fast rateExtended tariff is reference only; selectable TTL is not verified on its Chat-Completions-only route
Other GPT models, Chat Latest, and Gemini models with cache-read pricingAutomatic; lifetime not publishedNo selectable TTL verified; no extra write surcharge, reported input still costs normal input

Longer TTL increases the write price, not the read price. Cache hits and survival for the full lifetime are not guaranteed. A request setting alone is not evidence of stored lifetime; billing uses reported usage.

GPT-6 Astra, GPT-6.1 Sol/Terra and GPT-6.2 Astra/Sol can report cache writes automatically: the first eligible long request can cost 1.25× normal input even without a cache option.

GPT-5.5 Pro has no cache-read discount: cached input costs the normal input rate. Gemini has no extra write surcharge; any reported writes still use normal input prices.

Haiku 5.5: above 100,000 total input tokens, every token rate is 5×. Terra and GPT-6.2: above 272,000 total input tokens, the whole request uses 2× input/cache and 1.5× output. All six current Claude models add 10% only when US serving is reported, including cache reads and both write lifetimes.

Fast prices apply only when Fast/priority was actually served. Output always uses standard output pricing for the served tier; no cached-output discount exists. prompt_cache_key identifies a prefix, not its lifetime.

// Native Claude Messages: 5-minute default
"system": [{"type":"text","text":"Your long reusable reference…",
  "cache_control":{"type":"ephemeral"}}]

// Native Claude Messages: optional 1 hour
"system": [{"type":"text","text":"Your long reusable reference…",
  "cache_control":{"type":"ephemeral","ttl":"1h"}}]

// GPT-6.1 Terra or standard GPT-6.2 on Responses: 30-minute default
{"model":"gpt-6.2-sol","input":"Your long reusable reference…"}

// Same supported models: optional 12 hours
{"model":"gpt-6.2-sol","input":"Your long reusable reference…",
 "prompt_cache_options":{"ttl":"12h"}}

// Claude usage: cache_read_input_tokens, cache_creation_input_tokens,
// cache_creation.ephemeral_5m_input_tokens / ephemeral_1h_input_tokens
// GPT usage: input_tokens_details.cached_tokens / cache_write_tokens,
// input_tokens_details.cache_write_tokens_details.ttl_30m_tokens / ttl_12h_tokens
// Bridged Chat usage exposes corresponding prompt_tokens_details fields.
// Short example text illustrates the shape only; it does not guarantee caching.
Exact modelCached input / 1MDefault write / 1M1-hour write / 1M12-hour write / 1MDefault TTLCached output
chat-latest$0.35No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
claude-fable-5-1$0.175$8.75$14.00Not offered5 minutesNot offered
claude-haiku-5-5$0.007$0.0875$0.14Not offered5 minutesNot offered
claude-opus-5$0.35$4.38$7.00Not offered5 minutesNot offered
claude-opus-5-5$0.14$3.50$5.60Not offered5 minutesNot offered
claude-opus-5-5-fast$0.28$7.00$11.20Not offered5 minutesNot offered
claude-opus-5-fast$0.70$8.75$14.00Not offered5 minutesNot offered
claude-sonnet-5$0.14$1.75$2.80Not offered5 minutesNot offered
claude-sonnet-5-5$0.07$1.75$2.80Not offered5 minutesNot offered
gemini-3-flash-preview$0.035No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gemini-3.1-flash-lite$0.0175No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gemini-3.1-flash-lite-fast$0.0315No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gemini-3.1-pro-preview$0.14No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gemini-3.5-flash$0.105No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gemini-3.7-flash$0.0525No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gemini-3.8-flash$0.0525No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gemini-4-argon$0.14No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gemini-4-carbon$0.14No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gemini-4-hydrogen$0.0525No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gemini-4-neon$0.105No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5$0.0875No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5-fast$0.175No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5-mini$0.0175No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5-mini-fast$0.0315No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5-nano$0.0035No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.2$0.123No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.2-fast$0.245No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.4$0.175No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.4-fast$0.35No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.4-mini$0.0525No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.4-mini-fast$0.105No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.4-nano$0.014No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.4-pro$2.10No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.5$0.35No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.5-fast$0.875No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.5-pro$21.00No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.6-luna$0.014No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.6-luna-fast$0.028No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.6-sol$0.28No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.6-sol-fast$0.56No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.6-terra$0.14No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-5.6-terra-fast$0.28No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-6-astra$0.70$8.75Not offeredNot offered30 minutesNot offered
gpt-6-astra-fast$1.40$17.50Not offeredNot offered30 minutesNot offered
gpt-6-luna$0.007No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-6-luna-fast$0.014No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-6-sol$0.14No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-6-sol-fast$0.28No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gpt-6.1-sol$0.07$1.75Not offeredNot offered30 minutesNot offered
gpt-6.1-sol-fast$0.14$3.50Not offeredNot offered30 minutesNot offered
gpt-6.1-terra$0.035$0.875Not offered$1.7530 minutesNot offered
gpt-6.1-terra-fast$0.07$1.75Not offered$3.5030 minutesNot offered
gpt-6.2-astra$0.28$7.00Not offered$14.0030 minutesNot offered
gpt-6.2-astra-fast$0.56$14.00Not offered$28.00 (tariff only; TTL not selectable)30 minutesNot offered
gpt-6.2-sol$0.07$1.75Not offered$3.5030 minutesNot offered
gpt-6.2-sol-fast$0.14$3.50Not offered$7.00 (tariff only; TTL not selectable)30 minutesNot offered
gemini-3-pro-image$0.14No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gemini-3.1-flash-image$0.035No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered
gemini-3.1-flash-lite-image$0.0175No extra write fee; normal input appliesNot offeredNot offeredAutomatic; lifetime not publishedNot offered

Advanced options

JSON answers and sampling. /v1/chat/completions accepts response_format (json_object or strict json_schema) on GPT, Gemini and Claude, plus temperature, top_p, stop, seed, n, logprobs, penalties, prompt_cache_key and a specific tool_choice. If a model does not accept a setting (GPT-6 Astra rejects temperature; Gemini 4 Carbon, Hydrogen and Neon reject both penalties), you get a clear 400 instead of a silent change. GPT models served through Responses, and any GPT request with web search, reject stop, seed, n above 1, logprobs and penalties with a 400.

More controls. Embeddings accept dimensions and encoding_format. Transcriptions accept language, prompt, response_format and timestamp_granularities[], depending on the model. OpenAI speech accepts speed, instructions and response_format. OpenAI image edits accept a PNG mask (transparent areas are edited); Gemini image edits do not take masks. Claude on /v1/messages accepts document blocks with citations: { enabled: true }. /v1/responses accepts prompt_cache_key. Unsupported values return the model’s 400.

curl https://tokenrex.ai/api/public/v1/chat/completions \
  -H "Authorization: Bearer $TOKENREX_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3-flash",
    "temperature": 0.2,
    "response_format": { "type": "json_schema", "json_schema": { "name": "city", "strict": true,
      "schema": { "type": "object", "properties": { "city": { "type": "string" } },
                  "required": ["city"], "additionalProperties": false } } },
    "messages": [{ "role": "user", "content": "Capital of France?" }]
  }'

Claude extras. See Claude & remote MCP for native connection examples, feature restrictions, costs and AI implementation instructions. Long context and compaction depend on the exact model; the US premium applies only to verified models when US serving is actually reported.

Responses API. POST /v1/responses serves GPT models for Codex-style tools, with the same wallet billing. Storage is off, so resend history instead of previous_response_id.

Media. Gemini Omni video takes up to 10 reference images, and a video with task: "edit" or "extend" (extensions bill only new seconds). Gemini speech supports all 30 Gemini voices. Lyria music lyrics and length go inside input; Eleven Music v2 instead accepts prompt or composition_plan and music_length_ms. Image seed, negative_prompt and streamed partial images are not available yet.

Rate limits

Each key has a per-minute spending cap you set yourself. Go over it and the API returns 429 with a message like "Please wait 8s". There is no tokens-per-minute limit.

Error codes

CodeMeaning
400A setting this model does not accept (e.g. an unsupported size or quality)
401Invalid or revoked API key
402Wallet balance too low — top up on the Wallet page
403This key is not allowed to use this model
429Per-minute spending cap reached — wait the number of seconds shown
5xxUpstream provider error — failed requests are not charged

Security

Keys are stored hashed — only the prefix (sk-tr-abcd…) is shown after creation. Keys issued before the rename start with sk-tb- and keep working. Revoke a key on the API Keys page and it stops working immediately.

All endpoints

EndpointWhat it does
POST /v1/messagesNative Claude: streaming, remote MCP, function tools, web fetch, search and caching
POST /v1/responsesNative GPT Responses: stateless history, reasoning and supported tools
POST /v1/chat/completionsChat, streaming, vision and function tools
POST /v1/images/generationsImage generation
POST /v1/images/editsImage editing
POST /v1/audio/speechText-to-speech
POST /v1/audio/transcriptionsSpeech-to-text
POST /v1/musicMusic generation (Lyria 3), MP3 out, billed per track
POST /v1/embeddingsVector embeddings
POST /v1/decisionsTyped decisions (classify, score, route) with probabilities
POST /v1/videosStart a video job: Veo, Gemini Omni, Seedance 2.5 or Starlight Fast 2 restoration
GET /v1/videos/{id}Poll a video job (free)
GET /v1/videos/{id}/contentDownload a finished video (free)
WSS /v1/liveGPT Live 1 conversation, TokenRex Voice (TTS Beta) and Transcribe (STT); billed per connected second
GET /v1/modelsList all available models and prices
GET /v1/balanceRemaining wallet balance (paise)

Model catalog

102 models. Call GET /v1/models for the live list or browse Models & Pricing. Send the exact short model ID without a provider prefix — variants such as -2k, -4k or -high are separate IDs.

Chat & reasoning56 models

OpenAI-compatible /v1/chat/completions with live token streaming.

Image generation14 models

/v1/images/generations and /v1/images/edits.

Text-to-speech8 models

/v1/audio/speech — MP3/WAV audio out.

Speech-to-text4 models

/v1/audio/transcriptions — audio file in, text out.

Embeddings4 models

/v1/embeddings for search, RAG and clustering.

Video generation6 models

POST /v1/videos to start a job, GET /v1/videos/{id} to poll.

Typed decisions1 models

POST /v1/decisions — classification, scoring and routing with probabilities.

Live voice6 models

WebSocket wss://tokenrex.ai/api/public/v1/live — real-time voice calls, billed per second.

Music generation3 models

POST /v1/music — text or image in, MP3 music out.

Coding tools & BYOK

Use your TokenRex key inside Claude Code, Codex, Xcode, Cursor, VS Code extensions and other bring-your-own-key apps. Each tool has a step-by-step guide.

Browse all integration guides

Are we missing something?

Need another example, a clearer explanation or a new guide? Send a suggestion.

Need help? Ask in our Discord.