API reference and examples
Choose a protocol supported by your model and channel. The examples below use complete request URLs; console pages are not API endpoints.
| Protocol | Full endpoint |
|---|---|
| Chat Completions | POST /v1/chat/completions |
| Responses | POST /v1/responses |
| Anthropic Messages | POST /v1/messages |
Chat Completions
curl https://tokensclub.top/v1/chat/completions \
-H "Authorization: Bearer $TOKENSCLUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"YOUR_ENABLED_MODEL","messages":[{"role":"user","content":"Reply only OK"}]}' Responses
curl https://tokensclub.top/v1/responses \
-H "Authorization: Bearer $TOKENSCLUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_ENABLED_MODEL",
"input": "Hello, TokensClub."
}'Image generation (1K)
GPT image models have been tested with the size=1024x1024 (1K) request setting and are charged per successfully returned image. Actual output dimensions may differ; inspect the image if exact dimensions are required. Use a GPT-group API key. Other size or quality settings have not been verified.
curl https://tokensclub.top/v1/images/generations -H "Authorization: Bearer $TOKENSCLUB_API_KEY" -H "Content-Type: application/json" -d '{"model":"gpt-image-1","prompt":"A blue circle on white","n":1,"size":"1024x1024"}'Image generation API
Create a TokensClub API key in the image generation group. Use https://tokensclub.top/v1 as the Base URL, POST /v1/images/generations for generation and POST /v1/images/edits for reference editing. Supply the exact model ID from the price table.
Create a TokensClub API key · View models, prices and reference limits
Supply a size from the table below. The requested size selects the billing tier; returned pixels do not change it. n must be an integer from 1 to 15 and defaults to 1. Use non-streaming requests, automatic quality and PNG output. response_format may be url or b64_json. Unsupported parameters are explicitly rejected.
Sizes for the other image models
| Aspect ratio | 1K | 2K | 4K |
|---|---|---|---|
| 1:1 | 1024x1024 | 2048x2048 | 3840x3840 |
| 16:9 | 1280x720 | 2560x1440 | 3840x2160 |
| 9:16 | 720x1280 | 1440x2560 | 2160x3840 |
| 3:2 | 1536x1024 | 3072x2048 | 3840x2560 |
| 2:3 | 1024x1536 | 2048x3072 | 2560x3840 |
| 4:3 | 1344x1008 | 2688x2016 | 3840x2880 |
| 3:4 | 1008x1344 | 2016x2688 | 2880x3840 |
| 5:4 | 1280x1024 | 2560x2048 | 3840x3072 |
| 4:5 | 1024x1280 | 2048x2560 | 3072x3840 |
| 21:9 | 1792x768 | 3136x1344 | 4032x1728 |
Model limits still apply: -fb models support 1:1, 4:3, 3:4, 2:3, 9:16 and 16:9 at 1K, only 16:9 at 2K / 4K, and no reference edits. Lite supports only 1K; Firefly has no 4K tier.
curl https://tokensclub.top/v1/images/generations \
-H "Authorization: Bearer $TOKENSCLUB_API_KEY" \
-H "Content-Type: application/json" \
--data '{"model": "gpt-image-2", "prompt": "A blue circle on white", "size": "1024x1024", "n": 1, "quality": "auto"}'Reference edits use multipart/form-data with PNG, JPEG or WebP files in image or image[]. Follow the model reference limit; the complete request must be at most 64 MiB.
curl https://tokensclub.top/v1/images/edits \
-H "Authorization: Bearer $TOKENSCLUB_API_KEY" \
-F model=gpt-image-2 \
-F prompt="Use a clean studio background" \
-F size=2048x2048 \
-F n=1 \
-F "image=@/absolute/path/reference.png"gpt-image-2.6
Only the sizes listed below are supported. Billing follows the TokensClub size tier and successful image count. The 4K square is 4096×4096. Reference editing accepts up to 5 images per request.
| Tier | Aspect ratio | size |
|---|---|---|
| 1K | 1:1 | 1024x1024 |
| 1K | 3:2 | 1536x1024 |
| 1K | 2:3 | 1024x1536 |
| 1K | 3:4 | 1008x1344 |
| 1K | 9:16 | 720x1280 |
| 1K | 16:9 | 1280x720 |
| 2K | 1:1 | 2048x2048 |
| 2K | 16:9 | 2560x1440 |
| 4K | 1:1 | 4096x4096 |
| 4K | 16:9 | 3840x2160 |
curl https://tokensclub.top/v1/images/generations \
-H "Authorization: Bearer $TOKENSCLUB_API_KEY" \
-H "Content-Type: application/json" \
--data '{"model": "gpt-image-2.6", "prompt": "A red cube on a white table", "size": "1024x1024", "n": 1, "quality": "auto", "output_format": "png"}'curl https://tokensclub.top/v1/images/edits \
-H "Authorization: Bearer $TOKENSCLUB_API_KEY" \
-F model=gpt-image-2.6 \
-F prompt="make the cube blue" \
-F size=1024x1024 \
-F n=1 \
-F quality=auto \
-F output_format=png \
-F "image=@/absolute/path/reference.png"JavaScript: server-side request
const response = await fetch("https://tokensclub.top/v1/responses", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TOKENSCLUB_API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ model: "YOUR_ENABLED_MODEL", input: "Reply only OK" })
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());Streaming & retries
For streaming, pass stream: true and parse incremental events with an SSE parser. After a disconnect or timeout, check usage before retrying; a retry may incur a separate charge.
Support for images, tools, caching and long contexts depends on the model and channel. A successful text request does not verify these features.