Pym API docs
Pym's HTTP API: OpenAI-compatible chat completions and embeddings. Every value on this page comes from this server's configuration.
Get started
Quickstart
- Create an account and add credit.
- Create a key on API keys, and set
PYM_API_KEYto it in your shell. - Run one of the snippets.
curl
curl https://app.pymlabs.ai/v1/chat/completions \
-H "Authorization: Bearer $PYM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "qwen2.5-3b-instruct",
"messages": [{"role": "user", "content": "Say hello in five words."}],
"max_tokens": 64}'
Python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://app.pymlabs.ai/v1",
api_key=os.environ["PYM_API_KEY"],
)
response = client.chat.completions.create(
model="qwen2.5-3b-instruct",
messages=[{"role": "user", "content": "Say hello in five words."}],
max_tokens=64,
)
print(response.choices[0].message.content)
print(response.usage) # the tokens you were charged for
The examples use qwen2.5-3b-instruct. Any chat model in Chat models works: change model.
Pym accepts max_tokens but not max_completion_tokens today.
Tip: OPENAI_BASE_URL=https://app.pymlabs.ai/v1 lets existing code switch without edits.
For embeddings or invoke, see Which API to use.
Authentication
Send Authorization: Bearer pym_… with every request. Keys are shown once, when you create them, and revoking a key takes effect immediately.
Which API to use
| You want to | Endpoint | Client | Details |
|---|---|---|---|
| Generate text, call tools, get JSON back | POST /v1/chat/completions |
openai SDK, curl | Chat completions |
| Turn text into vectors for search or clustering | POST /v1/embeddings |
openai SDK, curl | Embeddings |
| List the models on this server | GET /v1/models |
openai SDK, curl | Models and prices |
A model serves one endpoint only. Sending its id to another endpoint returns 404 model_not_found and isn't
charged. GET /v1/models lists every model without saying which endpoint it serves. Use the tables in
Models and prices.
List models
GET /v1/models returns the OpenAI fields plus these pym_* ones. The openai SDK keeps unknown fields
(model.model_extra / model.pym_availability in openai-python), so existing clients don't break.
| Field | Meaning |
|---|---|
created | The model's current catalog version's publish time (Unix seconds). |
pym_availability | available, unavailable, unknown (no fresh snapshot), or requires_deployment (a dedicated-only model: see 400 model_requires_deployment). |
pym_availability_checked_at | The snapshot's fetch time (Unix seconds), or null for unknown and requires_deployment. |
pym_license / pym_commercial_use | The model's licence id and whether it permits commercial use (the "Development only" badge's machine form). |
pym_capabilities | A list from chat, vision, tools, json_schema, embeddings, required_tool_choice_streaming: exactly what the API accepts on this model. |
pym_availability is a snapshot, not a promise. A model can become unavailable between this call and your next request, which then returns 503 model_unavailable.
Chat completions
POST /v1/chat/completions works as in OpenAI's API, streamed or not. Every chat model streams.
Tools and structured output work on the models whose Features list them in
Chat models.
Parameters
- messages
- Roles
system,user,assistantandtool; string content. - max_tokens
- Defaults to 512 and can't exceed the model's max output (see Chat models); there is no fixed server-wide cap.
- temperature
- 0 to 2.
- stream
- See Streaming.
- stream_options
- Only
include_usage. - tools, tool_choice
- On models that support them; see Tools.
- response_format
- On models that support it; see Structured output.
- seed
- Integer, 0 to 2^63−1. Same seed and params usually reproduce the same output; not guaranteed across model updates. Does not change price.
- top_p
- 0 (exclusive) to 1. Does not change price.
- top_k
- -1 (disabled) or 1 to 1,000. Does not change price.
- min_p
- 0 to 1. Does not change price.
- stop
- A string, or up to 4 strings, each 1 to 64 bytes. Stops generation before the match; shortens output, so it can only lower a charge. Does not raise price.
- repetition_penalty
- 1.0 (no penalty) to 1.2. Does not change price.
- logprobs, top_logprobs
logprobs: trueadds per-token log probabilities to the response;top_logprobs(0 to 5) adds that many alternatives per token, and requireslogprobs: true. Log probabilities are not billed as tokens and do not change price. Without streaming,max_tokens× (1 +top_logprobs) can be at most 8,192, so the whole response fits in one body; with"stream": truethere is no such limit.
curl https://app.pymlabs.ai/v1/chat/completions \
-H "Authorization: Bearer $PYM_API_KEY" -H "Content-Type: application/json" \
-d '{"model":"qwen2.5-3b-instruct","messages":[{"role":"user","content":"List three colors."}],
"seed":42,"top_p":0.9,"top_k":40,"min_p":0.0,"stop":["\n\n"],
"repetition_penalty":1.05,"logprobs":true,"top_logprobs":3}'
Any other parameter, or any other stream_options field, returns 422 invalid_request_body.
Streaming
Set "stream": true to receive the reply as server-sent events while the model generates it. Each event is a
chat.completion.chunk, as in OpenAI's API, and a stream that completes ends with data: [DONE]. Treat [DONE] as the only sign that the reply is complete.
Add "stream_options": {"include_usage": true} to get one last chunk with the token counts.
curl
curl -N https://app.pymlabs.ai/v1/chat/completions \
-H "Authorization: Bearer $PYM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "qwen2.5-3b-instruct",
"messages": [{"role": "user", "content": "Count from 1 to 5."}],
"max_tokens": 64,
"stream": true,
"stream_options": {"include_usage": true}}'
Python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://app.pymlabs.ai/v1",
api_key=os.environ["PYM_API_KEY"],
)
stream = client.chat.completions.create(
model="qwen2.5-3b-instruct",
messages=[{"role": "user", "content": "Count from 1 to 5."}],
max_tokens=64,
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
if chunk.usage: # the last chunk: no choices, only token counts
print("\n", chunk.usage) # the tokens you were charged for
What the stream looks like
data: {"id":"chatcmpl-8f2c…","object":"chat.completion.chunk","created":1790000000,"model":"qwen2.5-3b-instruct","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
data: {"id":"chatcmpl-8f2c…","object":"chat.completion.chunk","created":1790000000,"model":"qwen2.5-3b-instruct","choices":[{"index":0,"delta":{"content":"1"},"finish_reason":null}]}
…
data: {"id":"chatcmpl-8f2c…","object":"chat.completion.chunk","created":1790000000,"model":"qwen2.5-3b-instruct","choices":[],"usage":{"prompt_tokens":33,"completion_tokens":12,"total_tokens":45}}
data: [DONE]
finish_reason is stop, length (the reply hit max_tokens), or tool_calls.
It can also be null on the last choice, which means the model stopped for another reason, for example repetition detection.
That reply is a real answer and is charged for the tokens it used.
If something goes wrong
Errors found before the stream starts (unknown model, insufficient balance, capacity, model unavailable) come back as ordinary JSON errors with the status codes under Errors. Nothing is streamed and nothing is charged.
If the stream fails after it starts, you get one event like the one below, and the stream closes without data: [DONE].
This covers the model server stopping, going silent, sending something unusable, or ending the request itself.
type is always server_error; code is upstream_timeout when the model went silent and upstream_error otherwise.
You may already have received some text. It is an incomplete answer, so discard it or mark it as cut off before you retry.
Nothing is charged for a stream that ends this way, including text you already received.
If the connection closes with neither [DONE] nor an error event, handle it the same way.
The openai Python SDK raises APIError while you iterate.
data: {"error": {"message": "The inference engine stopped sending", "type": "server_error", "param": null, "code": "upstream_timeout"}}
How streaming is billed
Streaming costs the same as a normal request: the same prices and the same hold.
- If your client closes the stream early, you're charged for your prompt and the output tokens sent to your client before it closed, never more. Tokens the model generates after that aren't charged.
- If the stream fails on our side (the model stops or ends the request, times out, or sends something malformed), you're charged nothing. The stream ends with an
errorevent instead ofdata: [DONE]. - If the stream finishes normally, you're charged for the token counts the model reports, exactly as without streaming.
- If Pym itself restarts mid-stream, the connection just closes, with no
errorevent. Nothing is charged: the request's hold stays under "Held, not yet settled" on your Billing page until it expires, then it is released and nothing is billed.
Timeouts
If the model sends no text for 30 seconds after the request starts, goes silent for
30 seconds mid-stream, or the whole stream runs longer than 900 seconds,
the stream ends with an upstream_timeout error and you're charged nothing.
While waiting, Pym sends a : keep-alive comment line every 15 seconds.
SDKs and SSE clients ignore it, but curl -N prints it, so you may see : keep-alive lines in curl's output.
Tools
This server accepts OpenAI's tools, tool_choice and response_format on
models whose Features include them; on any other model these fields are 400
tools_unsupported / response_format_unsupported before anything is charged.
tools and tool_choice work on: qwen2.5-3b-instruct, qwen2.5-1.5b-instruct.
See Chat models for the full list. tool_choice accepts "none", "auto",
"required", or {"type": "function", "function": {"name": "..."}} to force one
tool.
Assistant messages may set tool_calls instead of content (or both), and a
following tool message replies with its result via tool_call_id.
curl https://app.pymlabs.ai/v1/chat/completions \
-H "Authorization: Bearer $PYM_API_KEY" -H "Content-Type: application/json" \
-d '{
"model": "qwen2.5-3b-instruct",
"messages": [{"role": "user", "content": "What is the weather in Lisbon?"}],
"tools": [{"type": "function", "function": {
"name": "get_weather", "description": "Get the current weather for a city",
"parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}
}}],
"tool_choice": "auto"
}'
The reply's first choice carries "finish_reason": "tool_calls", "content": null,
and message.tool_calls: run the function yourself, then send its result back as a
tool message with the same tool_call_id to continue the conversation.
With a named tool_choice the call finishes with "finish_reason": "stop" instead, as OpenAI's API
does, so check message.tool_calls rather than the finish reason alone.
Streamed tool calls
With "stream": true, a tool call arrives as an id and name, then one or more chunks that each
add a fragment of arguments (concatenate them in order to get the full JSON string); the last
carries "finish_reason": "tool_calls".
data: {"id":"chatcmpl-…","object":"chat.completion.chunk","created":1790000000,"model":"qwen2.5-3b-instruct","choices":[{"index":0,"delta":{"role":"assistant","tool_calls":[{"index":0,"id":"call_…","type":"function","function":{"name":"get_weather","arguments":""}}]},"finish_reason":null}]}
data: {"id":"chatcmpl-…","object":"chat.completion.chunk","created":1790000000,"model":"qwen2.5-3b-instruct","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\"city\""}}]},"finish_reason":null}]}
data: {"id":"chatcmpl-…","object":"chat.completion.chunk","created":1790000000,"model":"qwen2.5-3b-instruct","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":": \"Lisbon\"}"}}]},"finish_reason":"tool_calls"}]}
data: [DONE]
Structured output
{"type": "json_object"} asks for a JSON object reply (no schema). {"type":
"json_schema", "json_schema": {"name": "...", "schema": {...}, "strict": true}} constrains the reply to
a schema. strict only changes anything under a required or a named
tool_choice: with "auto" tool choice this server accepts and forwards it, but the
model isn't constrained to follow it exactly.
response_format works on: qwen2.5-3b-instruct, qwen2.5-1.5b-instruct, qwen3-vl-8b-instruct, qwen3-vl-8b-instruct-fp8.
curl https://app.pymlabs.ai/v1/chat/completions \
-H "Authorization: Bearer $PYM_API_KEY" -H "Content-Type: application/json" \
-d '{
"model": "qwen2.5-3b-instruct",
"messages": [{"role": "user", "content": "Name a city and its country."}],
"response_format": {"type": "json_schema", "json_schema": {"name": "city", "strict": true,
"schema": {"type": "object", "properties": {"city": {"type": "string"}, "country": {"type": "string"}},
"required": ["city", "country"], "additionalProperties": false}}},
"max_tokens": 64
}'
JSON Schema support
In tools[].function.parameters and response_format.json_schema.schema, only these
keywords are forwarded: type properties required items enum const anyOf description title
additionalProperties minItems maxItems minimum maximum $defs $ref (a local
#/$defs/... reference only). pattern, patternProperties,
format and a remote $ref are refused with 400 invalid_tools /
invalid_response_format: they're a known way to make a guided decoder run arbitrarily long.
Tool definitions and tool/assistant message text are billed as prompt tokens at the model's input rate, the same as any other message content; there's no separate surcharge. Requests that fail one of the checks above aren't charged.
Tool and schema caps
- Tools
- At most 32 tools per request, at most 32 KiB once serialized. Each function
namematches^[A-Za-z0-9_-]{1,64}$and is unique;descriptionis at most 1,024 characters. - response_format schema
- At most 16 KiB once serialized, 16 levels of nesting, and 512 properties in total.
- tool_calls
- At most 32 per assistant message;
argumentsat most 32 KiB;tool_call_idat most 64 printable characters. - parallel_tool_calls
- Always allowed; an explicit
falseis 400unsupported_parameterrather than silently ignored.
Images
Models whose Features include Vision (qwen3-vl-8b-instruct, qwen3-vl-8b-instruct-fp8) accept images in a user
message. The message's content is then a list of parts: {"type": "text", "text": "..."}
and {"type": "image_url", "image_url": {"url": "data:image/png;base64,...", "detail": "low"}}, in
the order the model should read them.
Only data: URLs are accepted. Image URLs (https://…) return 400
invalid_image_url: this server never fetches a URL on your behalf. Send PNG, JPEG or WebP as base64
(data:image/png;base64,, data:image/jpeg;base64, or data:image/webp;base64,);
a single frame only (no animated PNG or WebP).
detail picks one of the model's size presets: low, auto (the default) or
high. Every image in a request uses the same detail; an image without one follows the
others. System, assistant and tool messages take plain-text content only;
content parts belong in user messages.
Example
Encode a file with base64 -w0 page.png (macOS: base64 -i page.png, which doesn't wrap
lines). This example sends a real 32 × 32 PNG:
curl https://app.pymlabs.ai/v1/chat/completions \
-H "Authorization: Bearer $PYM_API_KEY" -H "Content-Type: application/json" \
-d '{
"model": "qwen3-vl-8b-instruct",
"messages": [{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQEAAAQEMPTvfErw2wqsk9SnqWcCgUAgEAgEAoHgygLH8QM9BsqtpQAAAABJRU5ErkJggg==", "detail": "low"}},
{"type": "text", "text": "What colour is this image?"}]}],
"max_tokens": 32
}'
How images are counted and billed
An image is billed as input tokens, at the model's input price, like message text. Before running the request, Pym resizes the image's dimensions on paper the way the model does: each side is rounded to a multiple of 32 pixels and the image is scaled, keeping its shape, to at least 65,536 pixels and at most the preset's size. The image then costs one token per 32 × 32 pixels, plus 2 around it. That count is checked against the request's hold (Billing and holds) and is the most its images can be billed; the model's reported prompt tokens are charged, up to that.
| Page | low (up to 0.8 MP) | auto (up to 2.4 MP) | high (up to 6.3 MP) |
|---|---|---|---|
| US Letter, 200 DPI | 744 | 2,310 | 3,657 |
| US Letter, 150 DPI | 744 | 2,080 | 2,080 |
| A4, 200 DPI | 759 | 2,280 | 3,796 |
These counts are exact for the model: they were checked against it on every preset. The presets themselves are
placeholders until this server's OCR benchmark sets them, so a preset's size may change; the formula won't. A
5-page document at high is about five times the first row.
Image caps
| Model | Images per request | Per image | Whole request |
|---|---|---|---|
qwen3-vl-8b-instruct | 5 | 6 MiB decoded | 41 MiB |
qwen3-vl-8b-instruct-fp8 | 5 | 6 MiB decoded | 41 MiB |
Each image is also at most 16,384 pixels on a side, at most 40 megapixels decoded, and at most 200 times as long as it is wide. Text outside the images is still limited to 1 MiB per request.
Embeddings
POST /v1/embeddings turns text into vectors, as in OpenAI's API. Only the models below serve it; a chat model's id there (or an embeddings model's id on /v1/chat/completions) returns 404 model_not_found and isn't charged.
Models and prices: Embeddings models.
Parameters
model, input (a string or an array of strings), encoding_format (float or base64; the openai SDK asks for base64 and decodes it for you) and, where the table shows a range, dimensions. Anything else returns 422 invalid_request_body.
How inputs are counted
Pym counts each UTF-8 byte of an input as one token, plus 8 per input. Bytes are counted after Unicode NFC normalization, the form the model receives, so a decomposed accent counts as its composed character. No input can tokenize to more than this count. It's used for the limits below and for the hold, never for the charge: you're charged the input tokens the model reports.
- Per input
- 8,192 tokens (about 8,184 bytes of text on
qwen3-embedding-0.6b; see the table for each model). - Inputs per request
- 256 (see the table for each model).
- Per request
- 65,536 tokens (see the table for each model).
Empty strings, token-id arrays and chat messages as input aren't accepted.
Example
curl
curl https://app.pymlabs.ai/v1/embeddings \
-H "Authorization: Bearer $PYM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "qwen3-embedding-0.6b", "input": ["The first text to embed.", "The second one."]}'
Python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://app.pymlabs.ai/v1",
api_key=os.environ["PYM_API_KEY"],
)
result = client.embeddings.create(
model="qwen3-embedding-0.6b",
input=["The first text to embed.", "The second one."],
)
print(len(result.data[0].embedding), "dimensions;", result.usage.prompt_tokens, "input tokens billed")
Files for fine-tuning
Upload training data for fine-tuning as a JSONL file with POST /v1/files and purpose=fine-tune. Pym stores it, checks its format within seconds, and keeps it until you delete it or 30 days after it was last used. Storing files is free.
There's no fine-tuning job API yet. You can upload files and see whether they pass the format check now; the jobs that train on them come next.
Upload a file
A multipart form with two parts: purpose (fine-tune) and file. The answer is the file object with status uploaded; poll GET /v1/files/{file_id} until it is processed or error.
curl
curl https://app.pymlabs.ai/v1/files \
-H "Authorization: Bearer $PYM_API_KEY" \
-F purpose=fine-tune \
-F "file=@train.jsonl"
Python
import os
import time
from openai import OpenAI
client = OpenAI(
base_url="https://app.pymlabs.ai/v1",
api_key=os.environ["PYM_API_KEY"],
)
with open("train.jsonl", "rb") as f:
uploaded = client.files.create(file=f, purpose="fine-tune")
print(uploaded.id, uploaded.status) # "uploaded": the check runs next
while uploaded.status == "uploaded":
time.sleep(2)
uploaded = client.files.retrieve(uploaded.id)
print(uploaded.status, uploaded.status_details or "") # "processed", or "error" with line numbers and codes
The file format
OpenAI's chat format: one JSON object per line, each a conversation to learn from. Text only.
{"messages": [{"role": "system", "content": "You answer in one word."}, {"role": "user", "content": "Capital of France?"}, {"role": "assistant", "content": "Paris"}]}
{"messages": [{"role": "user", "content": "2 + 2?"}, {"role": "assistant", "content": "4"}]}
- Each line is
{"messages": [...]}and nothing else. Each message is{"role": ..., "content": ...}withroleone ofsystem,userorassistant, andcontenta string. - Each example has at least one
assistantmessage and ends with one: that's the reply the model learns to give. - Not supported yet: tools and tool calls (
tools,functions,tool_calls,toolmessages), per-messageweight,name, and content that isn't a string (images, arrays of parts). - UTF-8 text. Blank lines are skipped. Windows line ends and a byte-order mark at the start are fine.
- A file that contains a credential is refused: a Pym API key, an AWS access key ID, or a private key (a PEM block). The check names the line and the kind of credential, never the text.
Limits
- Per file
- At most 100 MiB, 50,000 lines, and 1 MiB per line; at least 10 examples. A larger body is refused with 413 before anything is stored.
- Per account
- At most 10 GiB of files and 1,000 files. An upload that would pass either is refused with 413; the message says how much you store and the limit. Deleting a file frees its space at once.
- Example length
- At most 4,096 tokens per example after the chat template. Longer examples are refused, never cut short. This is checked when a fine-tuning job starts, not at upload.
- Kept for
- Until you delete it, or 30 days after it was last used (uploaded, or used by a fine-tuning job).
Statuses
uploaded- Stored; the format check runs next, usually within seconds.
processed- The file passed the check.
error- The file failed the check.
status_detailslists each problem asline N: code(at most 20, one per line, in file order), andpym_errorsholds the same as[{"line", "code"}], withsecret_typefor a credential. A file that fails is never kept: its contents are deleted, and only this record stays until you delete it. Fix the lines and upload the file again.
File contents can't be downloaded: GET /v1/files/{file_id}/content answers 400 file_download_unsupported. Keep your own copy.
Check errors and how to fix them
code | What's wrong and how to fix it |
|---|---|
not_utf8 | This line isn't UTF-8 text. Save the file as UTF-8, then upload it again. |
line_too_long | This line is longer than 1 MiB. Shorten the example or split it into smaller ones. |
not_json | This line isn't one complete JSON object. Look for a missing quote, comma or brace, or an example split across lines: each example must be on a single line. |
duplicate_key | This line uses the same key twice in one JSON object. Keep each key once. |
not_an_object | This line is JSON, but not an object. Each line must be one {"messages": [...]} object. |
missing_messages | This line has no "messages" list, or the list is empty. Add a "messages" array with the conversation to train on. |
unsupported_key | This line has a top-level key other than "messages". Remove it: "messages" is the only key supported. |
tools_unsupported | This line defines tools or functions. Training with tools isn't supported yet: remove "tools", "functions" and "tool_choice". |
message_not_an_object | A message on this line isn't a JSON object. Write each message as {"role": ..., "content": ...}. |
unsupported_message_key | A message on this line has a key other than "role" and "content" (for example "name"). Remove it. |
weight_unsupported | A message on this line sets "weight". Per-message weights aren't supported yet: remove it, and every assistant message is trained on. |
tool_calls_unsupported | This line has a tool call, or a tool or function message. Training on tool calls isn't supported yet: remove those messages. |
unsupported_role | A message on this line has a role other than system, user or assistant. Use one of those three. |
content_not_text | A message on this line has content that isn't a string (an array of parts, an image or null). Use plain text content. |
no_assistant_message | This example has no assistant message, so there is nothing to learn from. Add the reply you want the model to give. |
last_message_not_assistant | This example doesn't end with an assistant message. End it with the reply you want the model to give. |
secret_detected | This line looks like it contains a credential. Remove it from the example, then upload the file again. secret_type is one of pym_api_key (a Pym API key), pym_callback_key (a Pym callback signing key), aws_access_key_id (an AWS access key ID), private_key (a private key (a PEM block)). |
too_many_lines | The file has more than 50,000 lines. Split it into smaller files. |
too_few_examples | The file has fewer than 10 examples. Add more: fine-tuning needs at least 10. |
could_not_validate | Pym couldn't check this file. Upload it again; if that keeps happening, contact support. |
The files API
POST /v1/files- Upload (above). Any API key.
GET /v1/files- Your files, newest first:
limit(1 to 10,000),order(descorasc),after(a file id, for the next page;has_moresays if there is one),purpose. GET /v1/files/{file_id}- One file:
id,bytes,created_at,expires_at,filename,purpose,status,status_details,pym_errors. DELETE /v1/files/{file_id}- Deletes the file; it stops counting toward your storage at once. Answers
{"id", "object": "file", "deleted": true}.
Another account's file id gets the same 404 file_not_found as an id that doesn't exist. Your files are also listed on the Files page.
GPU bookings
This server's GPU can be booked for a slot: a booking reserves the whole card for that time, so the shared models it serves pause during the slot and come back after it. The status page lists every scheduled window, in your local time and UTC, and a notice appears on every page from 24 hours before one starts. During a window, requests to the models on the booked GPU return 503 gpu_booked with a Retry-After header that ends when the models are back, and they aren't charged. A window starts 10 minutes before the slot, while running requests finish, and ends when the models have restarted, about 10 minutes after it. Requests to other models are unaffected.
Models and prices
Prices in USD. These tables show what this server offers, not whether each model is running right now.
Signed in, your Overview shows each model's current status. When a model has no server available,
requests to it return 503 model_unavailable and aren't charged. Each model's licence, limits, prices and price history are
on Models.
Chat models
| Model | Features | Input / 1M tokens | Output / 1M tokens | Context | Max output |
|---|---|---|---|---|---|
qwen2.5-3b-instruct
Qwen2.5 3B Instruct |
Streaming, tools, structured output | $0.01 | $0.02 | 8,192 tokens | 2,048 tokens |
qwen2.5-1.5b-instruct
Qwen2.5 1.5B Instruct |
Streaming, tools, structured output | $0.005 | $0.01 | 8,192 tokens | 2,048 tokens |
qwen3-vl-8b-instruct
Qwen3-VL 8B Instruct |
Streaming, structured output, vision | $0.01 | $0.02 | 32,768 tokens | 8,192 tokens |
qwen3-vl-8b-instruct-fp8
Qwen3-VL 8B Instruct (FP8) |
Streaming, structured output, vision | $0.01 | $0.02 | 32,768 tokens | 8,192 tokens |
Embeddings models
| Model | Input / 1M tokens | Inputs per request | Per input | Per request | Dimensions |
|---|---|---|---|---|---|
qwen3-embedding-0.6b
Qwen3 Embedding 0.6B |
$0.002 | 256 | 8,192 tokens | 65,536 tokens | 1,024 (32 to 1,024) |
GET /v1/models returns every model above, without saying which endpoint serves it.
Billing and holds
Every request holds the most it could cost before it runs. When it finishes, the hold is released and you're
charged for what it used. Each meter (input tokens, output tokens) is charged on its own, rounded up to the
nearest $0.00000001, and the request's charge is their sum. If your available balance is below a request's hold,
it fails with 402 insufficient_balance and nothing is charged.
Chat completions
| Model | Input / 1M tokens | Output / 1M tokens | Context | Max output |
|---|---|---|---|---|
qwen2.5-3b-instruct
Qwen2.5 3B Instruct |
$0.01 | $0.02 | 8,192 tokens | 2,048 tokens |
qwen2.5-1.5b-instruct
Qwen2.5 1.5B Instruct |
$0.005 | $0.01 | 8,192 tokens | 2,048 tokens |
qwen3-vl-8b-instruct
Qwen3-VL 8B Instruct |
$0.01 | $0.02 | 32,768 tokens | 8,192 tokens |
qwen3-vl-8b-instruct-fp8
Qwen3-VL 8B Instruct (FP8) |
$0.01 | $0.02 | 32,768 tokens | 8,192 tokens |
Before a request runs, Pym holds the most it could cost at that model's prices: your prompt allowance (the model's context − max_tokens) at the input rate, however short your prompt is, plus max_tokens at the output rate. When the response finishes, the hold is released and you're charged only for the tokens the model reports. Streaming requests hold the same amount.
An image counts as input tokens, priced the same as text input tokens. Pym computes the token count from the image's pixel dimensions and detail level before running the request (see Images). The hold itself doesn't change — it's already your full prompt allowance above — but this count is the most the image can be charged for.
| Model | Smallest hold | At default max_tokens (512) | Largest hold |
|---|---|---|---|
qwen2.5-3b-instruct |
$0.00008193 | $0.00008704 | $0.0001024 |
qwen2.5-1.5b-instruct |
$0.00004097 | $0.00004352 | $0.0000512 |
qwen3-vl-8b-instruct |
$0.00032769 | $0.0003328 | $0.0004096 |
qwen3-vl-8b-instruct-fp8 |
$0.00032769 | $0.0003328 | $0.0004096 |
Any other max_tokens holds an amount between the smallest and largest. To fit a smaller balance, use a model with a smaller hold in this table: the hold depends on each model's context as well as its prices, so a cheaper model doesn't always hold less.
Streaming
Streaming costs the same as a normal request: the same prices and the same hold.
- If your client closes the stream early, you're charged for your prompt and the output tokens sent to your client before it closed, never more. Tokens the model generates after that aren't charged.
- If the stream fails on our side (the model stops or ends the request, times out, or sends something malformed), you're charged nothing. The stream ends with an
errorevent instead ofdata: [DONE]. - If the stream finishes normally, you're charged for the token counts the model reports, exactly as without streaming.
- If Pym itself restarts mid-stream, the connection just closes, with no
errorevent. Nothing is charged: the request's hold stays under "Held, not yet settled" on your Billing page until it expires, then it is released and nothing is billed.
| 35 input tokens × $0.01 / 1M | $0.00000035 |
|---|---|
| 10 output tokens × $0.02 / 1M | $0.0000002 |
| Charge | $0.00000055 |
| 35 input tokens × $0.005 / 1M | $0.00000018 |
|---|---|
| 10 output tokens × $0.01 / 1M | $0.0000001 |
| Charge | $0.00000028 |
| 35 input tokens × $0.01 / 1M | $0.00000035 |
|---|---|
| 10 output tokens × $0.02 / 1M | $0.0000002 |
| Charge | $0.00000055 |
| 35 input tokens × $0.01 / 1M | $0.00000035 |
|---|---|
| 10 output tokens × $0.02 / 1M | $0.0000002 |
| Charge | $0.00000055 |
Embeddings
Billed on input tokens only, at the model's input price, as the model reports them. The hold is the request's counted size (how inputs are counted) at that price, and it can't be larger than the "Largest hold" below. Only the reported tokens are charged. The rest of the hold is released at once.
| Model | Input / 1M tokens | Largest hold |
|---|---|---|
qwen3-embedding-0.6b |
$0.002 | $0.00013108 |
| 1,000 input tokens × $0.002 / 1M | $0.000002 |
|---|---|
| Charge | $0.000002 |
Limits
Every endpoint
- Capacity
- Each model has a limited number of requests it can run at once. When they're all busy, a request waits briefly, then gets 429
capacity_exhaustedwith aRetry-Afterheader.
Chat completions
- Request body
- At most 1 MiB.
- Context and max_tokens
- Per model: see Chat models.
max_tokensdefaults to 512 and can't exceed the model's max output. - Request time limit
- Per model:
qwen2.5-3b-instruct120 s,qwen2.5-1.5b-instruct120 s,qwen3-vl-8b-instruct900 s andqwen3-vl-8b-instruct-fp8900 s. A request running past it is stopped and returns 504upstream_timeout, not charged. - Prompt size check
- Pym counts each byte of message text as one token when checking the context limit, which is stricter than the model's real tokenizer.
With the default max_tokens, messages can total about 7,552 bytes on
qwen2.5-3b-instruct, 7,552 bytes onqwen2.5-1.5b-instruct, 32,128 bytes onqwen3-vl-8b-instructand 32,128 bytes onqwen3-vl-8b-instruct-fp8, minus the bytes of the role names.
Embeddings
- Request body
- At most 1 MiB.
- Per input, inputs per request and per request
- See How inputs are counted and Embeddings models.
Errors
These are the responses this server sends. Bodies use OpenAI's shape: {"error": {"message", "type", "param", "code"}}. Check code in your error handling, not message. param names the request field at fault, or is null. Requests that fail aren't charged unless the row says otherwise. The openai SDK retries 429 and 5xx responses twice by default (max_retries=2), so a failure you see may already be the third attempt.
| Status | code | Endpoint | When | openai SDK raises | What to do |
|---|---|---|---|---|---|
| 400 | invalid_content_length | All | The Content-Length header is missing a valid value | BadRequestError | Let your HTTP client set Content-Length. |
| 400 | model_requires_deployment | All | model resolves to a model that runs only on a dedicated deployment, and the request doesn't address one (param: model) | BadRequestError | Create a deployment and call model#name. Not charged. |
| 401 | invalid_api_key | All | The API key is wrong or revoked | AuthenticationError | Check PYM_API_KEY. The key may be revoked. |
| 402 | insufficient_balance | All | Your available balance is less than this request's hold. The message states both, for example "This request holds $…; your available balance is $…." | APIStatusError | Add credit. Chat: or use a model with a smaller hold (see the hold table); lowering max_tokens helps only on models where output costs more than input and only down to the smallest hold. |
| 404 | model_not_found | All | model isn't a model this server offers on this endpoint (param: model): an unknown id, or a model sent to another endpoint | NotFoundError | Use an id from Models and prices, for example qwen2.5-3b-instruct. Not charged. |
| 404 | not_found | All | No such path under /v1 | NotFoundError | Check the URL. Your base URL should end in /v1. |
| 405 | method_not_allowed | All | The path exists but not with this method | APIStatusError | Check the method: GET /v1/models, or POST to /v1/chat/completions or /v1/embeddings. |
| 413 | request_too_large | All | The body is over this endpoint's limit (1 MiB chat/embeddings; with images, the model's own limit in Image caps) | APIStatusError | Shrink the request. Nothing was held or charged. |
| 429 | capacity_exhausted | All | Every server for this model was busy for the whole wait | RateLimitError (retried twice automatically) | Retry after the Retry-After seconds. Not charged. |
| 500 | internal_error | All | Pym itself failed | InternalServerError (retried twice automatically) | Retry. Not charged. |
| 502 | upstream_error | All | The model server failed, stopped the request itself, or returned usage Pym can't trust | InternalServerError (retried twice automatically) | Retry. Not charged. |
| 502 / 504 from the proxy | none | All | An HTML error page from the proxy, not {"error"} JSON (upstream unreachable, or over the proxy's 180 s read timeout) | InternalServerError (retried twice automatically) | Retry later. Parse errors defensively: this body isn't JSON. |
| 503 | model_unavailable | All | No server is available to run this model right now | InternalServerError (retried twice automatically) | Retry after Retry-After, or use another model. Your Overview shows each model's status. Not charged. |
| 503 | inference_unavailable | All | Pym can't reach its inference service | InternalServerError (retried twice automatically) | Retry after Retry-After. Not charged. |
| 503 | gpu_booked | All | The GPU that serves this model is reserved for a scheduled booking (param: model); the message names the models and when they're back | InternalServerError (retried twice automatically) | Retry after the Retry-After seconds, or use another model. The status page lists every window. Not charged. |
| 503 | catalog_unavailable | All | The server has just started and can't read its list of models yet, or the model's price or version changed while your request was being priced | InternalServerError (retried twice automatically) | Retry after Retry-After. Not charged. |
| 400 | context_length_exceeded | Chat | Messages plus max_tokens exceed the model's context (param: messages) | BadRequestError | Shorten messages or lower max_tokens. |
| 400 | invalid_request | Chat | A combination of fields, none invalid on its own: tool_choice without tools, a named tool_choice not in tools, response_format of type json_schema with a required or named tool_choice, a tool message whose tool_call_id doesn't match an earlier assistant tool call, or top_logprobs without logprobs: true (param: top_logprobs; the message reads "top_logprobs requires logprobs: true") | BadRequestError | Fix the field named in param. See Tools and Parameters. Not charged. |
| 400 | unsupported_parameter | Chat | parallel_tool_calls: false (param: parallel_tool_calls); this server always allows parallel calls. Or tool_choice: "required" with "stream": true on a model whose engine can't stream it (param: tool_choice; see Tools) | BadRequestError | Omit parallel_tool_calls or send true; for tool_choice, don't stream, or use "auto" or a named tool. Not charged. |
| 400 | tools_unsupported | Chat | tools, an assistant tool_calls message or a tool message, sent to a model whose Features don't include Tools (param: tools) | BadRequestError | Use a model whose Features include Tools in Chat models. Not charged. |
| 400 | response_format_unsupported | Chat | response_format sent to a model whose Features don't include Structured output (param: response_format) | BadRequestError | Use a model whose Features include Structured output in Chat models. Not charged. |
| 400 | tools_too_large / invalid_tools | Chat | tools is over the per-request caps (see Tool and schema caps: at most 32 tools, 32 KiB serialized), or a tool's name, description or JSON Schema keywords are invalid (param: tools) | BadRequestError | Shrink or fix tools. Not charged. |
| 400 | invalid_image_url | Chat | An image's url isn't a base64 data: URL of a PNG, JPEG or WebP image; https:// image URLs are never fetched (param: the image's url) | BadRequestError | Send the image itself: data:image/png;base64,… (see Images). Not charged. |
| 400 | unsupported_parameter (images) | Chat | An image sent to a model whose Features don't include Vision; content parts in a system, assistant or tool message; or two different detail values in one request (param names which) | BadRequestError | Use a Vision model, put images in user messages, and one detail per request. Not charged. |
| 400 | too_many_images | Chat | More images than the model accepts per request (see Image caps; param: messages) | BadRequestError | Split the document across requests. Not charged. |
| 400 | image_too_large | Chat | An image is over the model's per-image size before decoding (param: the image's url) | BadRequestError | Downscale or recompress the image. Not charged. |
| 400 | invalid_image | Chat | An image that can't be read as a single-frame PNG, JPEG or WebP of its declared type, or is over the pixel limits (each side at most 16,384 px, at most 40 megapixels, at most 200:1) | BadRequestError | Re-export the image as a plain PNG or JPEG. Not charged. |
| 400 | schema_too_large / invalid_response_format | Chat | response_format.json_schema.schema is over the per-request caps (16 KiB serialized, 16 levels deep, 512 properties), or uses a JSON Schema keyword this server doesn't forward (param: response_format) | BadRequestError | Simplify the schema. Not charged. |
| 400 | max_tokens_too_large | Chat | max_tokens is above the model's max output (param: max_tokens). On this server: qwen2.5-3b-instruct allows 2,048, qwen2.5-1.5b-instruct allows 2,048, qwen3-vl-8b-instruct allows 8,192, qwen3-vl-8b-instruct-fp8 allows 8,192. The message reads "max_tokens exceeds configured limit of N". Also logprobs: true without streaming where max_tokens × (1 + top_logprobs) is above 8,192; that message reads "With logprobs and without streaming, max_tokens x (1 + top_logprobs) must be at most 8192; send "stream": true or lower max_tokens". | BadRequestError | Lower max_tokens, or stream the response. |
| 408 | request_timeout | Chat | A body over 1 MiB (an image request) didn't finish arriving within 120 s | APIStatusError (retried twice automatically) | Retry on a faster connection, or send smaller or fewer images. Nothing was held or charged. |
| 422 | invalid_request_body | Chat | An unsupported parameter or stream_options field, or a sampling parameter outside its range (see Parameters). The message reads "Unsupported parameter or value in the request body." | UnprocessableEntityError | Remove the parameter, or bring its value into range (see Parameters). |
| 504 | upstream_timeout | Chat, embeddings | The model server took too long, or the model's request time limit (see Limits). | InternalServerError (retried twice automatically) | Retry. Not charged. Chat: lowering max_tokens can help. |
| 200 (stream already started) | upstream_error / upstream_timeout | Chat | The stream failed after it started: an SSE error event, and no [DONE] | APIError (not retried) | Retry. Not charged. Discard any text already received. See Streaming. |
| 400 | too_many_inputs | Embeddings | More inputs than the model accepts (param: input) | BadRequestError | Split the request. Not charged. |
| 400 | input_too_large | Embeddings | All inputs together are over the per-request cap (see How inputs are counted) | BadRequestError | Shorten the input, or split the request. Not charged. |
| 400 | context_length_exceeded | Embeddings | One input (param: input[i]) is over its per-input limit (see How inputs are counted) | BadRequestError | Shorten the input. Not charged. |
| 400 | invalid_input | Embeddings | An empty string, or input given as token-id arrays or chat messages | BadRequestError | Send input as a string or an array of strings. Not charged. |
| 400 | dimensions_unsupported | Embeddings | dimensions is outside the model's range (param: dimensions) | BadRequestError | Fix dimensions (see Embeddings models). Not charged. |
| 422 | invalid_request_body | Embeddings | An unsupported parameter, an encoding_format other than float or base64, or input given as token-id arrays or chat messages. The message reads "Unsupported parameter or value in the request body." | UnprocessableEntityError | Send input as a string or an array of strings (see Parameters). |
| 400 | multipart_required / unexpected_field | Files | The upload isn't a multipart form with exactly a purpose part and a file part (or a part repeats, or its headers are malformed) | BadRequestError | Send -F purpose=fine-tune -F "file=@train.jsonl" (curl) or client.files.create(file=..., purpose="fine-tune"). Nothing was stored. |
| 400 | purpose_required / unsupported_purpose | Files | No purpose, or one other than fine-tune (param: purpose) | BadRequestError | Send purpose=fine-tune. Nothing was stored. |
| 400 | file_required / filename_required / filename_unsupported / file_empty | Files | No file part, no filename, a filename with control characters or over 255 characters, or an empty file (param: file) | BadRequestError | Send a non-empty JSONL file with a plain filename. Nothing was stored. |
| 400 | incomplete_upload | Files | The connection ended before the multipart body was complete | BadRequestError | Send it again. Nothing was stored. |
| 400 | file_download_unsupported | Files | GET /v1/files/{file_id}/content: fine-tuning files can't be downloaded | BadRequestError | Keep your own copy of the data. |
| 400 | invalid_request | Files | GET /v1/files with limit outside 1 to 10,000 or order other than asc/desc | BadRequestError | Fix the parameter named in param. |
| 404 | file_not_found | Files | No file with this id belongs to your account: unknown, deleted, or another account's (the same answer for each) | NotFoundError | Use an id from GET /v1/files. |
| 408 | upload_timeout | Files | The upload took longer than the server allows for one file | APIStatusError (retried twice automatically) | Upload from a faster connection, or split the file. Nothing was stored. |
| 408 | upload_too_slow | Files | The upload sent less than 1 MiB in 60 seconds | APIStatusError (retried twice automatically) | Upload from a faster connection. Nothing was stored. |
| 413 | file_too_large | Files | The file is over 100 MiB (refused before anything is stored, by the server or its proxy) | APIStatusError | Split it into files of at most 100 MiB and 50,000 lines. Nothing was stored. |
| 413 | storage_quota_exceeded / too_many_files | Files | Storing this file would pass your account's 10 GiB or 1,000 files. The message says how much you store and the limit | APIStatusError | Delete files you no longer need, then upload again. Nothing was stored. |
| 429 | too_many_uploads | Files | Your account already has 2 uploads in progress, or the server is receiving as many uploads as it can | RateLimitError (retried twice automatically) | Retry after the Retry-After seconds. Nothing was stored. |
| 503 | files_unavailable | Files | This server doesn't store files, its file storage isn't answering, or uploads are paused for a few minutes while storage is backed up | InternalServerError (retried twice automatically) | Retry after Retry-After. Nothing was stored. |