FROM API KEYTO PRODUCTIONREQUEST.
A directly usable integration guide. Examples share one base URL, while the endpoint index stays contract-checked against the relay OpenAPI file in this repository.
01 / START
Quickstart
- Create an API key in the console.
- Copy a model ID from the public model catalog.
- Keep the key in a server-side environment variable and send the first request.
02 / AUTH
Authentication & base URL
Protected endpoints use a Bearer token. Never place API keys in browser code, public repositories, logs, or screenshots.
https://tokenboat.com/v1Authorization: Bearer $TOKEN_BOAT_API_KEY03 / CALL
Three ways to call
Curl
export TOKEN_BOAT_API_KEY="your_api_key"
export MODEL_ID="choose_from_the_model_catalog"
curl https://tokenboat.com/v1/chat/completions \
-H "Authorization: Bearer $TOKEN_BOAT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "'"$MODEL_ID"'",
"messages": [{"role": "user", "content": "Hello from Token Boat"}]
}'Python
from openai import OpenAI
import os
client = OpenAI(
api_key=os.environ["TOKEN_BOAT_API_KEY"],
base_url="https://tokenboat.com/v1",
)
response = client.chat.completions.create(
model=os.environ["MODEL_ID"],
messages=[{"role": "user", "content": "Hello from Token Boat"}],
)
print(response.choices[0].message.content)JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.TOKEN_BOAT_API_KEY,
baseURL: "https://tokenboat.com/v1",
});
const response = await client.chat.completions.create({
model: process.env.MODEL_ID,
messages: [{ role: "user", content: "Hello from Token Boat" }],
});
console.log(response.choices[0].message.content);04 / STREAM
Streaming
Set stream: true for models that support streaming and consume the Server-Sent Events incrementally. Clients should handle disconnects and an incomplete final chunk.
const stream = await client.chat.completions.create({
model: process.env.MODEL_ID,
messages: [{ role: "user", content: "Stream a short answer" }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}05 / RECOVER
Errors & retries
Error responses include an HTTP status and message. Record request time, endpoint, model ID, and status—but never the full key or sensitive prompt content.
| Status | Meaning | Action |
|---|---|---|
| 400 | Invalid request field or model parameter | Correct the request before retrying |
| 401 | Missing, invalid, or expired API key | Check the Authorization header and key status |
| 403 | Account or model access is not allowed | Check account access and model availability |
| 429 | Request or token limit reached | Respect Retry-After; use exponential backoff with jitter |
| 5xx | Gateway or upstream temporarily unavailable | Use limited retries only for safe, replayable requests |
06 / LIMITS
Rate limits
RPM, TPM, and concurrency limits vary by account, model, and current policy, so this page does not hard-code a number that may become inaccurate. For a 429 response, use its headers and the account console as the source of truth.
- Bound concurrency and configure client timeouts.
- Use exponential backoff with jitter for 429 and temporary 5xx responses.
- Do not blindly replay generation tasks; query task state first.
- Use the support center when a production workload needs a higher limit.
07 / REFERENCE
Core endpoints
These are the main public endpoints. Check each model detail for the endpoint types actually supported by that model.
| Method | Path | Purpose |
|---|---|---|
| GET | /v1/models | List models available to the API key |
| POST | /v1/responses | Responses API for tools and multi-turn workflows |
| POST | /v1/chat/completions | OpenAI-compatible chat completions |
| POST | /v1/messages | Anthropic Messages-compatible endpoint |
| POST | /v1/embeddings | Create text embeddings |
| POST | /v1/images/generations | Submit an image generation request |
| POST | /v1/audio/speech | Text to speech |
| POST | /v1/audio/transcriptions | Audio transcription |
| POST | /v1/videos | Submit a video generation task |
API contract source: docs/openapi/relay.json