API documentation / Quickstart

One key. One endpoint. Your existing code.

TokenRoc exposes an OpenAI-compatible API. Keep the SDK and request format you already use, then replace the API key and base URL.

Base URLhttps://api.tokenroc.com/v1

01 / Setup

Send your first request

Create an account, generate a key, and choose a model from the live pricing catalog. Never expose an API key in browser or mobile client code.

STEP 02

Generate a key

Open API Keys, create a token, and store it in a server-side secret.

02 / cURL

Chat completions request

Set your key as an environment variable and send the same JSON shape used by OpenAI-compatible clients.

terminalPOST /v1/chat/completions
curl https://api.tokenroc.com/v1/chat/completions \
  -H "Authorization: Bearer $TOKENROC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v3.2",
    "messages": [
      {"role": "user", "content": "Say hello in one sentence."}
    ]
  }'
Model availability changes over time. Copy the model identifier from the live pricing page instead of hard-coding a display name.

03 / Python

Use the OpenAI SDK

Only the credentials and base URL are TokenRoc-specific. The client call remains OpenAI-compatible.

app.pyPython
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["TOKENROC_API_KEY"],
    base_url="https://api.tokenroc.com/v1",
)

response = client.chat.completions.create(
    model="deepseek-v3.2",
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
)

print(response.choices[0].message.content)

04 / Reference

Core endpoints

Support varies by model and upstream provider. Start with the model catalog, then use the endpoint supported by that model.

MethodEndpointPurpose
GET/v1/modelsList models available to the current API key.
POST/v1/chat/completionsCreate a standard or streaming chat completion.
POST/v1/responsesUse the Responses-compatible request format where supported.

05 / Troubleshooting

Common HTTP responses

StatusMeaningWhat to check
401Authentication failedConfirm the Bearer token is present, active, and copied without spaces.
403Access or balance rejectedCheck wallet balance, key permissions, and model access.
429Rate or quota limitReduce concurrency, apply backoff, or review token limits.
5xxGateway or upstream failureRetry with exponential backoff and check the status page.

06 / Next

Continue in the console

Model pricing

Compare the current input and output rates before choosing a model.

OPEN PRICING ->

API keys

Create separate keys for each environment and revoke them independently.

MANAGE KEYS ->

Service status

Check whether the website and API gateway are responding.

VIEW STATUS ->