API Documentation
Ablatehub serves abliterated open-source models behind ready-to-use APIs. Chat is compatible with OpenAI Chat Completions, OpenAI Responses and Anthropic Messages, and images and video have their own endpoints. Point an existing SDK at our base URL, swap in your key, and no local proxy is needed.
Quickstart
- Create an account. After signing in, open API keys in the console and create a key. The key is shown in full only once at creation — save it immediately.
- Enter the base URL for your protocol (see the table below) and use the key as the API key.
- Make sure the account has a balance in the console, then start calling.
- No code required: the console's Creative canvas chains text, image and video into a single workflow and runs it end to end.
| Protocol | Base URL | Path |
|---|---|---|
| OpenAI Chat Completions | https://api.ablatehub.com/v1 | /chat/completions |
| OpenAI Responses | https://api.ablatehub.com/v1 | /responses |
| Anthropic Messages | https://api.ablatehub.com | /v1/messages |
| Image generation | https://api.ablatehub.com/v1 | /images/generations |
| Video generation | https://api.ablatehub.com/v1 | /videos/generations |
curl https://api.ablatehub.com/v1/chat/completions \
-H "Authorization: Bearer $ABLATEHUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "GLM-5.3-Flash-Ablatehub",
"messages": [{"role": "user", "content": "Hello"}]
}'from openai import OpenAI
client = OpenAI(
base_url="https://api.ablatehub.com/v1",
api_key="sk-...", # your Ablatehub key
)
resp = client.chat.completions.create(
model="GLM-5.3-Flash-Ablatehub",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.ablatehub.com/v1",
apiKey: process.env.ABLATEHUB_API_KEY,
});
const resp = await client.chat.completions.create({
model: "GLM-5.3-Flash-Ablatehub",
messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);Authentication
Every request must carry the key in a header:
Authorization: Bearer sk-xxxxxxxxxxxxxxxx- The Anthropic protocol also accepts an
x-api-keyheader; the two forms are equivalent — use either one. - Keys are created in the console, at most 10 per account, and can be disabled or deleted at any time. Once disabled or deleted, requests using that key immediately return
401. - Keep keys in server-side environment variables. Never put them in browser code, mobile apps or public repositories.
- If a key leaks, delete it in the console immediately and create a new one.
Models and pricing
Set model to a name from the table below; names are case-sensitive. The context window and per-request output cap for each model are listed there too. A max_tokens above the cap is rejected by the gateway with 400 before the request reaches the model. Prices are in USD per million tokens and are deducted from your account balance.
Every text model listed here is an uncensored (ablated) build, identified by the -Ablatehub suffix. They are served without an additional content filter, so you are responsible for using them within the usage policy and the laws that apply to you.
| Model | Input | Output | Cached input | Context | Max output |
|---|---|---|---|---|---|
GLM-5.3-Ablatehub | $2.00 | $4.00 | $0.30 | 1M | 128K |
Kimi-K3.1-Pro-Ablatehub | $3.00 | $6.00 | $0.30 | 1M | 128K |
GLM-5.3-Flash-Ablatehub | $0.24 | $1.00 | $0.05 | 1M | 128K |
DeepSeek-V4.1-Flash-1017-Ablatehub | $0.24 | $0.90 | $0.05 | 1M | 128K |
Cost = uncached input tokens × input price + cached input tokens × cached input price + output tokens × output price. Per-call details are available under call logs in the console. Image and video pricing is covered in the next section.
In Anthropic or Responses clients, an unknown model name such as claude-* or gpt-* falls back to the default text model GLM-5.3-Flash-Ablatehub instead of failing. To use another model, pass a name from the table above.
You can also list the currently available models over the API:
curl https://api.ablatehub.com/v1/models \
-H "Authorization: Bearer $ABLATEHUB_API_KEY"Images and video
The image and video endpoints use the same key and the same balance as chat. Both reserve an estimate at task creation; when generation clearly fails or times out, the charge is returned to your balance automatically. If the server cannot confirm whether the task was created, the task enters manual reconciliation — it is never retried blindly or charged twice.
Both creation endpoints accept an optional Idempotency-Key header (8–128 letters, digits or ._~-). When a network result is unclear, retrying with the same key and the same parameters maps to the original task without reserving again; the same key with different parameters returns 409. Without the header, every request is treated as a new task.
Image generation
Model Seedream-V5-Pro-Ablatehub, endpoint POST /v1/images/generations, one image per call; n must be 1.
| Size | Price per image |
|---|---|
1024*1024, 832*1216, 864*1152, 1216*832, 1152*864, 1024*1536, 1536*1024, 1424*800, 800*1424, 1568*672 | $0.10 |
1280*1280, 1440*1440, 1664*2496, 1776*2368, 2496*1664, 2368*1776, 1080*1920, 1920*1080, 1152*2048, 2048*1152, 3136*1344 | $0.20 |
size also accepts aspect ratios such as 16:9, 1:1 and 9:16, which are mapped to the nearest 1K size; for 2K, pass explicit pixel dimensions. Optional parameters: output_format selects jpeg or png (default jpeg); image supplies a reference image as a base64 data URL — PNG or JPEG only, at most 2MB after decoding, and the file must end at the format's terminator (trailing data is rejected); alternatively image_url takes a public https image URL. Reference images are priced the same.
curl https://api.ablatehub.com/v1/images/generations \
-H "Authorization: Bearer $ABLATEHUB_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: image-request-001" \
-d '{"model": "Seedream-V5-Pro-Ablatehub", "prompt": "a red apple on a white table", "size": "1024*1024"}'The response's data[0].url is the image URL, hosted by Ablatehub and directly accessible; links are valid for 7 days from generation, so copy results to your own storage in time. Image generation waits synchronously by default and usually finishes within a minute; a client timeout of 120 seconds is recommended. The synchronous wait lasts up to about 105 seconds: if the task is still unfinished, the endpoint returns 202 with a task id (status is queued or processing) — poll GET /v1/images/tasks/{id}, and a finished task returns the same data[0].url shape. Hitting the wait limit neither fails the task nor charges twice. To avoid holding a long connection, add ?wait=0: the endpoint returns a task id immediately, and you poll it the same way.
Video generation
Create a task with POST /v1/videos/generations and check progress with GET /v1/videos/tasks/{id}. Video is billed per second: the estimate is resolution × duration at creation, and an explicit failure or timeout refunds it automatically. Two video models are available:
| Model | Resolution | Durations | Price per second |
|---|---|---|---|
Seedance-2.5-Ablatehub | 480P / 720P / 1080P | Any integer from 4–30 seconds | $0.25 / $0.50 / $1.20 |
Wan-3.0-Pro-R2v-Ablatehub | 1080P / 2K / 4K | Any integer from 2–30 seconds | $0.40 / $0.45 / $0.50 |
Seedance-2.5-Ablatehub pricing (USD)
| Resolution | Per second | 4 seconds | 10 seconds | 30 seconds |
|---|---|---|---|---|
480P | $0.25 | $1.00 | $2.50 | $7.50 |
720P | $0.50 | $2.00 | $5.00 | $15.00 |
1080P | $1.20 | $4.80 | $12.00 | $36.00 |
Wan-3.0-Pro-R2v-Ablatehub pricing (USD)
| Resolution | Per second | 5 seconds | 10 seconds | 30 seconds |
|---|---|---|---|---|
1080P | $0.40 | $2.00 | $4.00 | $12.00 |
2K | $0.45 | $2.25 | $4.50 | $13.50 |
4K | $0.50 | $2.50 | $5.00 | $15.00 |
When the task finishes, the result URL is in output.video_url. While polling, status moves through queued, processing, succeeded or failed; failed tasks are already refunded. Generation usually takes several minutes, so poll the task instead of waiting on the creation request.
curl https://api.ablatehub.com/v1/videos/generations \
-H "Authorization: Bearer $ABLATEHUB_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: video-request-001" \
-d '{"model": "Seedance-2.5-Ablatehub", "prompt": "a red apple slowly rotating", "resolution": "480P", "duration": 4}'Video input images come in three forms: image_url (first frame), last_frame_url (last frame) and reference_images (an array of references). All three accept only signed /v1/media/ URLs returned by this site's image generation or existing tasks — the gateway resolves them before submitting to the model service, and arbitrary external URLs are rejected. Seedance supports first frame + last frame + references (a last frame requires a first frame; 1–30 references). R2v is a reference-image model with no first or last frame: pass 1–10 character or style references via reference_images (passing image_url is equivalent to a single reference). With a first frame, the output aspect follows the source image and aspect_ratio is overridden. Refer to input images in the prompt with [Image 1], [Image 2] and so on. Media download links are valid for 7 days from generation; save them to your own storage in time.
curl https://api.ablatehub.com/v1/videos/generations \
-H "Authorization: Bearer $ABLATEHUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "Seedance-2.5-Ablatehub", "prompt": "a red apple on a white table, gentle camera push-in", "resolution": "480P", "duration": 4, "image_url": "https://api.ablatehub.com/v1/media/…"}'Optional video parameters (both models)
| Parameter | Type | Description |
|---|---|---|
aspect_ratio | string | Optional. adaptive (default), 16:9, 4:3, 1:1, 3:4, 9:16; Seedance additionally supports 21:9. With a first frame, the output follows the source image. |
audio | boolean | Optional, default false. Whether to generate an audio track in the final video; does not affect price. Supported by both models. |
last_frame_url | string | Optional, Seedance only. Last-frame URL; requires image_url. Only /v1/media/ URLs from this site are accepted. |
reference_images | string[] | Optional. Constrains subject and style: 1–30 images for Seedance, 1–10 for R2v; only /v1/media/ URLs from this site are accepted. |
curl https://api.ablatehub.com/v1/videos/generations \
-H "Authorization: Bearer $ABLATEHUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "Wan-3.0-Pro-R2v-Ablatehub", "prompt": "Image 1 walks through a neon alley at night, slow dolly forward", "resolution": "1080P", "duration": 10, "aspect_ratio": "16:9", "audio": true}'A singular compatibility route is also available: POST /v1/video/generations and GET /v1/video/generations/{id}. The fields are the same as above and also accept seconds, generate_audio, ratio and image_urls; the response additionally carries output.url. Async clients that only accept that shape can connect directly.
Chat completions
POST https://api.ablatehub.com/v1/chat/completions
| Parameter | Type | Description |
|---|---|---|
model | string | Required. Model name from the table above. |
messages | array | Required. Conversation messages; each item has a role (system / user / assistant / tool) and content. Text and images (image_url) are both accepted as input. |
max_tokens | integer | Maximum output tokens; a positive integer no greater than the model cap of 128000. |
temperature, top_p | number | Sampling parameters. |
stop | string / array | Stop generating when one of these strings appears. |
stream | boolean | Whether to stream the response; see below. |
tools | array | Tool (function) definitions the model may call; see below. |
response_format | object | Set to {"type": "json_object"} to request JSON output. |
Example response:
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "GLM-5.3-Flash-Ablatehub",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "Hello! How can I help you today?" },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 14, "completion_tokens": 17, "total_tokens": 31 }
}Some models additionally return reasoning_content (their reasoning trace) inside message. Reasoning also counts as output tokens. Models think before answering by default, so a max_tokens that is too small can be spent entirely on reasoning, leaving content empty and finish_reason set to length — raise the budget accordingly.
Streaming
With "stream": true, the response arrives as Server-Sent Events, one chunk at a time, and ends with data: [DONE]. Adding "stream_options": {"include_usage": true} delivers a final chunk containing usage.
Streaming is recommended for long reasoning. The gateway opens the SSE stream immediately and sends a : keep-alive comment line every 15 seconds so proxies do not time out while the model is silent; these comments are not model output and clients should ignore them. A non-streaming request that waits more than 115 seconds for the first byte returns 503 upstream_timeout (the CDN caps a single request at 125 seconds, and the gateway ends it first so clients do not receive the CDN's own error page).
curl https://api.ablatehub.com/v1/chat/completions \
-H "Authorization: Bearer $ABLATEHUB_API_KEY" \
-H "Content-Type: application/json" \
-N \
-d '{
"model": "GLM-5.3-Flash-Ablatehub",
"messages": [{"role": "user", "content": "Count from 1 to 5"}],
"stream": true,
"stream_options": {"include_usage": true}
}'Each chunk looks like this:
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","model":"GLM-5.3-Flash-Ablatehub","choices":[{"index":0,"delta":{"content":"1"},"finish_reason":null}]}
data: [DONE]Tool calls
Pass function definitions through tools and the model returns tool_calls when needed. Run the function, append the result as a message with role: "tool", and request again. Multiple tool calls can be returned in one response.
{
"model": "GLM-5.3-Flash-Ablatehub",
"messages": [{"role": "user", "content": "What is the weather in Paris today?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Look up the weather for a city",
"parameters": {
"type": "object",
"properties": { "city": { "type": "string" } },
"required": ["city"]
}
}
}]
}The returned message.tool_calls[0].function.arguments is a JSON string, and finish_reason is tool_calls.
Anthropic compatibility
The same text models also serve the Anthropic Messages protocol (POST https://api.ablatehub.com/v1/messages). Clients such as Claude Code only need a base URL change — no local proxy.
export ANTHROPIC_BASE_URL=https://api.ablatehub.com
export ANTHROPIC_AUTH_TOKEN=sk-your-key
export ANTHROPIC_MODEL=GLM-5.3-Flash-Ablatehub
export ANTHROPIC_SMALL_FAST_MODEL=GLM-5.3-Flash-AblatehubBoth authentication headers are accepted: x-api-key (when the client uses ANTHROPIC_API_KEY) and Authorization: Bearer (when it uses ANTHROPIC_AUTH_TOKEN). Use a public model name from the table above; names such as claude-* that we do not serve fall back to the default text model.
Supported:
- Non-streaming and streaming, with the event sequence
message_start→content_block_start→content_block_delta→content_block_stop→message_delta→message_stop system(string or block array), text, and images (base64 and URL)tools,tool_choice,tool_use/tool_resultround-trips and parallel tool callsPOST /v1/messages/count_tokens(local estimate for context-budget hints)
Known differences: cache_control breakpoints are ignored, but the upstream caches by prefix and usage.cache_read_input_tokens is still reported accurately. Reasoning is returned as thinking blocks with an empty signature — ignore it when sending the block back. Errors use the envelope {"type": "error", "error": {"type": "...", "message": "..."}}.
Responses compatibility
The same text models also serve the OpenAI Responses protocol (POST https://api.ablatehub.com/v1/responses). Responses clients likewise only need a base URL and key change — no local proxy.
curl https://api.ablatehub.com/v1/responses \
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{
"model": "GLM-5.3-Flash-Ablatehub",
"instructions": "You are a concise assistant.",
"input": "Introduce yourself in one sentence."
}'Supported:
- Non-streaming and streaming; streaming events are
response.created→response.in_progress→response.output_item.added→ various*.delta→*.done→response.completed(response.incompletewhen truncated) inputas a string or an item array:message,function_call,function_call_output; text and image inputs are both supportedinstructions,tools,tool_choice,parallel_tool_calls,max_output_tokens,temperature,top_p- Structured output via
text.formatwithjson_objectandjson_schema previous_response_idto continue a context: stored per account for 7 days; a request with"store": falseis not stored
Known differences: reasoning is returned as the summary_text of a reasoning item — ignore it when sending items back; call_id is generated by this service, so send it back unchanged in function_call_output. Built-in tools (web_search, file_search, code_interpreter), Files and Vector Stores, and background mode are not supported yet.
Structured output
On the chat endpoint, set "response_format": {"type": "json_object"} and ask for JSON explicitly in the prompt; the model then returns a valid JSON string.
To constrain output by schema, use text.format on the Responses protocol: set type to json_schema and provide the schema; the returned body matches that structure.
Usage and caching
Every response's usage field contains prompt_tokens, completion_tokens and total_tokens. When a request prefix matches recent requests, part of the input hits the cache; the cached amount appears in usage.prompt_tokens_details.cached_tokens and is billed at the lower cached-input price.
- To improve hit rates, put stable content (system prompt, long documents, tool definitions) at the start of
messagesand changing content at the end. - Whether the cache hits depends on recent requests sharing the same prefix; a hit is never guaranteed.
- Call logs in the console show input, cached input, output and cost for each call.
Error codes
Chat, image, video and Responses errors use {"error": {"message": "...", "type": "...", "code": "..."}}; the Anthropic endpoint uses {"type": "error", "error": {"type": "...", "message": "..."}}. HTTP status codes mean the same in both. Retryable 5xx failures such as upstream errors and timeouts are returned as 503 with the reason in code (upstream_timeout for a wait timeout, service_unavailable for temporary unavailability); unexpected gateway exceptions return 500 internal_error.
| HTTP | code | Meaning and handling |
|---|---|---|
| 400 | invalid_request, invalid_json, invalid_parameters, invalid_prompt, invalid_image_url, invalid_aspect_ratio, invalid_idempotency_key, content_policy_violation | A request parameter is invalid, for example a missing messages, a max_tokens above the cap, an unsupported image format, or a malformed Idempotency-Key. Fix the request according to message. |
| 401 | invalid_api_key | The key is missing, wrong, disabled or deleted. |
| 402 | insufficient_quota | Insufficient balance. Top up under Wallet in the console. |
| 404 | model_not_found, not_found, previous_response_not_found | The model name does not exist, the task or media has expired, or the record for previous_response_id has expired (stored for 7 days). |
| 405 | — | Wrong HTTP method, for example a GET on /v1/responses. |
| 409 | idempotency_conflict | The same Idempotency-Key was used with different request parameters. Use a new key or fix the parameters. |
| 413 | — | Request body too large. The limit is 8MB for regular endpoints and 20MB for video. |
| 429 | rate_limit_exceeded | Too many requests. Retry later and increase the interval between retries. |
| 500 | internal_error | Internal service error. Retry; contact us if it persists. |
| 503 | service_unavailable, upstream_timeout | The service is temporarily unavailable, or a non-streaming request waited more than 115 seconds for the first byte. Retry later; use streaming for long reasoning. |
Limits and notes
- Available today: chat (
/v1/chat/completions), Anthropic compatibility (/v1/messages), Responses compatibility (/v1/responses), model list (/v1/models), image generation (/v1/images/generations) and video generation (/v1/videos/generations). Text completions (/v1/completions) and embeddings (/v1/embeddings) are not offered and return404. - Each account can hold at most 10 API keys. Keys can be disabled or deleted at any time; there are no per-key quotas — every call is billed to the account balance.
- Generated image, video and media links are valid for 7 days from generation; generation history in the console is kept for 3 days. Copy results to your own storage in time.
- Responses continuation records are kept for 7 days and only when the request does not set
"store": false. - Non-streaming requests wait up to about 115 seconds, then return
503 upstream_timeout. For longer output, use"stream": true— streaming connections are kept alive by heartbeats and are not subject to that limit. - Individual models may slow down or become temporarily unavailable due to service fluctuations. On
503or a long silence, set a client timeout (for example 60 seconds) and retry. - Please follow the Terms of Service and the Usage Policy.
Getting support
For problems or other requests, contact us on Telegram. If your balance is low, use Wallet in the console and follow the instructions to contact Telegram support for a stablecoin top-up; the balance updates as soon as it is confirmed. When reporting an issue, include the request time, the model used and the error message, but never send your full key.