API reference

One key. Every model.

The TokenlyPro proxy is wire-compatible with the OpenAI SDK. Point at our base URL, swap in your buyer key, and ship.

Authentication

Every request must include your TokenlyPro buyer key in the Authorization header. Generate one from your buyer dashboard after purchasing an access token.

bash# Base URL for all requests: BASE_URL="https://api.tokenlypro.com/v1" # Include your buyer key in the Authorization header: curl $BASE_URL/models \ -H "Authorization: Bearer tk_live_…"

Buyer keys start with tk_live_. You get one when you purchase an access token from the marketplace. Each key is scoped to your account.

Quickstart

The TokenlyPro proxy is wire-compatible with the OpenAI SDK — you only need to change the base URL and key. No new SDKs, no changes to your existing code structure.

pythonfrom openai import OpenAI client = OpenAI(
base_url="https://api.tokenlypro.com/v1",
api_key="tk_live_…",
) response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "user", "content": "Summarize TokenlyPro in one line."}
],
) print(response.choices[0].message.content)

List available models

Returns all models your buyer key has active access to, along with current pricing and remaining token balance.

httpGET https://api.tokenlypro.com/v1/models Authorization: Bearer tk_live_… // Response { "data": [ { "id": "gpt-4o-mini", "provider": "openai", "context_window": 128000, "price_per_1m": 0.42, "available_tokens": 4800000 }, { "id": "gpt-4o", "provider": "openai", "context_window": 128000, "price_per_1m": 2.50, "available_tokens": 1900000 } ] }

Only models with an active access token on your account are returned. Purchase access tokens from the marketplace.

Chat completions

Fully OpenAI-compatible chat completions endpoint. Pass the model ID exactly as returned by GET /models — your active access token is matched automatically.

bashcurl https://api.tokenlypro.com/v1/chat/completions \ -H "Authorization: Bearer $TOKENLYPRO_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hi!"}]}'

The response is a standard OpenAI ChatCompletion object. Token usage is recorded and deducted from your access token allocation in real time.

Supported providers: OpenAI (GPT-4o, GPT-4o mini), Anthropic (Claude), Google (Gemini), Grok, DeepSeek, Copilot — any model listed on the marketplace.

Usage and balance

Returns token consumption and spend for your active access tokens. Filter by model using the optional ?model= query param.

http// All models: GET https://api.tokenlypro.com/v1/usage // Filter to a specific model: GET https://api.tokenlypro.com/v1/usage?model=gpt-4o-mini Authorization: Bearer tk_live_… // Response { "model": "gpt-4o-mini", "tokens_used": 2823104, "tokens_remaining": 7176896, "spend_usd": 1.18 }

When no model param is passed, totals are aggregated across all your active access tokens.

Error codes

400
invalid_request
Malformed JSON body or missing required fields.
401
unauthorized
Missing, malformed, or revoked buyer key.
402
balance_exhausted
Token allocation depleted. Purchase a new access token from the marketplace.
404
model_unavailable
No active access token found for this model. Buy access on the marketplace.
429
rate_limited
Per-minute rate limit exceeded; retry with backoff.
502
upstream_error
Underlying provider returned an error. Check the provider's status page.

Ready to ship?

Grab a buyer key, point your SDK at the proxy, and run your first call.

API Docs | TokenlyPro