DEVELOPER DOCUMENTATION
Connect models. Build your AI application.
From your first API call to cloud agents: model APIs, SDKs, streaming, tools, files and usage management guides.
One gateway, three familiar protocols
Base URLs
OpenAI-compatible https://api.token4ai.cloud/v1
Anthropic https://api.token4ai.cloud
Gemini REST https://api.token4ai.cloud/v1beta/models/{model}:generateContentQuery the catalog with your key, then select a model that supports your protocol and task. Capabilities, permissions and prices depend on the current group.
Get started
Quickstart: your first model requestCreate an API key, discover an available model, send a request and verify usage in Token4AI Cloud.Authentication, API keys and billing groupsConfigure Bearer, Anthropic and Gemini credentials; understand key rotation, scopes and billing groups.Python, JavaScript and developer toolsConnect official SDKs, custom base URLs, Codex and Claude Code to Token4AI Cloud.Token4AI CLI and agent automationAuthorize the CLI in your browser and automate wallet, key, usage and asset operations with JSON output.
Model APIs
Models and capability discoveryList models visible to your key and choose the appropriate model id, protocol and capabilities.Chat CompletionsUse the OpenAI-compatible chat endpoint for messages, conversation context, output controls and streaming.Responses and conversation stateUse the Responses API and understand input, stream, store, previous_response_id, retrieval and deletion.Anthropic Messages and token estimatesConfigure Anthropic-native requests, system instructions, content blocks, streaming and count_tokens.Gemini native content generationUse generateContent and streamGenerateContent with contents, parts and generationConfig.Streaming and connection handlingImplement SSE parsing, cancellation, timeouts and recovery without duplicate generation or false success states.Tool calling and structured outputBuild tool-call turns, validate function arguments and use JSON Schema for verifiable model output.Embeddings and rerankingBuild retrieval-augmented generation with embeddings and reranking, including input, dimensions and relevance scores.Vision input and image generationDistinguish vision understanding from generation, using image_url content parts and images/generations.Audio transcription, translation and speechUse audio/transcriptions, audio/translations and audio/speech with multipart uploads and binary output.Files API and file lifecycleUpload, list, retrieve, download and delete files; distinguish Files API objects, static assets and model input.Errors, 429 responses and retry policyDistinguish credential, validation, model, rate-limit and upstream errors, with bounded retries and request ids.
Agents & collaboration
Create and run cloud agentsConfigure Codex, Claude Code, Pi, OpenClaw and Hermes with models, execution environments and tasks.Room conversations and recurring tasksTrigger tasks with @Agent, schedule minute or hour loops and stop recurring execution from a Room.Task details, event logs and project boardsInspect execution state, event duration and failures, and relate agent results to project completion criteria.Private runtimes and cloud executionConnect a private device for agent execution and understand availability, project access and harness compatibility.
Console & support
Wallet, billing groups and recharge ordersUnderstand USD balances, group pricing, token settlement, recharge credit and order troubleshooting.Overview, usage history and cost analysisRead daily spend, total tokens, streaming requests and errors, then investigate usage per request.Static assets and foldersUpload, preview, download and organize assets in Vega, including size and access constraints.Account security and data regionsManage sign-in, passkeys, profile and data region settings, including credential and privacy boundaries.Support, evidence attachments and incident reportsReport issues through support chat or tickets, attach images/files and provide actionable request or order identifiers.
Token4AI Cloud connects model APIs with Agent Cloud workflows and shared token usage management. These guides take you from your first request to reliable task execution.