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

  1. Create an account and add credit.
  2. Create a key on API keys, and set PYM_API_KEY to it in your shell.
  3. Run one of the snippets.

curl

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

Python · openai SDK
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

Pym's endpoints
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.

GET /v1/models fields
FieldMeaning
createdThe model's current catalog version's publish time (Unix seconds).
pym_availabilityavailable, unavailable, unknown (no fresh snapshot), or requires_deployment (a dedicated-only model: see 400 model_requires_deployment).
pym_availability_checked_atThe snapshot's fetch time (Unix seconds), or null for unknown and requires_deployment.
pym_license / pym_commercial_useThe model's licence id and whether it permits commercial use (the "Development only" badge's machine form).
pym_capabilitiesA 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, assistant and tool; 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: true adds per-token log probabilities to the response; top_logprobs (0 to 5) adds that many alternatives per token, and requires logprobs: 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": true there is no such limit.
curl example
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
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

Python · openai SDK
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

Example stream (abbreviated)
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.

Error event
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 error event instead of data: [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 error event. 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 example
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".

Example stream (abbreviated)
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 example
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 name matches ^[A-Za-z0-9_-]{1,64}$ and is unique; description is 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; arguments at most 32 KiB; tool_call_id at most 64 printable characters.
parallel_tool_calls
Always allowed; an explicit false is 400 unsupported_parameter rather 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 example
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.

Image tokens per page for qwen3-vl-8b-instruct (each image also adds 2)
Pagelow (up to 0.8 MP)auto (up to 2.4 MP)high (up to 6.3 MP)
US Letter, 200 DPI7442,3103,657
US Letter, 150 DPI7442,0802,080
A4, 200 DPI7592,2803,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

Per-request image limits by model
ModelImages per requestPer imageWhole request
qwen3-vl-8b-instruct5 6 MiB decoded41 MiB
qwen3-vl-8b-instruct-fp85 6 MiB decoded41 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
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

Python · openai SDK
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
curl https://app.pymlabs.ai/v1/files \
  -H "Authorization: Bearer $PYM_API_KEY" \
  -F purpose=fine-tune \
  -F "file=@train.jsonl"

Python

Python · openai SDK
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.

train.jsonl
{"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": ...} with role one of system, user or assistant, and content a string.
  • Each example has at least one assistant message and ends with one: that's the reply the model learns to give.
  • Not supported yet: tools and tool calls (tools, functions, tool_calls, tool messages), per-message weight, 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_details lists each problem as line N: code (at most 20, one per line, in file order), and pym_errors holds the same as [{"line", "code"}], with secret_type for 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

The format check's error codes
codeWhat's wrong and how to fix it
not_utf8This line isn't UTF-8 text. Save the file as UTF-8, then upload it again.
line_too_longThis line is longer than 1 MiB. Shorten the example or split it into smaller ones.
not_jsonThis 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_keyThis line uses the same key twice in one JSON object. Keep each key once.
not_an_objectThis line is JSON, but not an object. Each line must be one {"messages": [...]} object.
missing_messagesThis line has no "messages" list, or the list is empty. Add a "messages" array with the conversation to train on.
unsupported_keyThis line has a top-level key other than "messages". Remove it: "messages" is the only key supported.
tools_unsupportedThis line defines tools or functions. Training with tools isn't supported yet: remove "tools", "functions" and "tool_choice".
message_not_an_objectA message on this line isn't a JSON object. Write each message as {"role": ..., "content": ...}.
unsupported_message_keyA message on this line has a key other than "role" and "content" (for example "name"). Remove it.
weight_unsupportedA message on this line sets "weight". Per-message weights aren't supported yet: remove it, and every assistant message is trained on.
tool_calls_unsupportedThis line has a tool call, or a tool or function message. Training on tool calls isn't supported yet: remove those messages.
unsupported_roleA message on this line has a role other than system, user or assistant. Use one of those three.
content_not_textA 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_messageThis example has no assistant message, so there is nothing to learn from. Add the reply you want the model to give.
last_message_not_assistantThis example doesn't end with an assistant message. End it with the reply you want the model to give.
secret_detectedThis 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_linesThe file has more than 50,000 lines. Split it into smaller files.
too_few_examplesThe file has fewer than 10 examples. Add more: fine-tuning needs at least 10.
could_not_validatePym 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 (desc or asc), after (a file id, for the next page; has_more says 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

Chat models on this server: features and prices in USD.
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

Embeddings models on this server. Prices in USD.
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

Prices in USD, per model
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.

Hold per request, by model
ModelSmallest 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 error event instead of data: [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 error event. 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.
Worked example for qwen2.5-3b-instruct at current prices, not a live request
35 input tokens × $0.01 / 1M$0.00000035
10 output tokens × $0.02 / 1M$0.0000002 
Charge$0.00000055
Worked example for qwen2.5-1.5b-instruct at current prices, not a live request
35 input tokens × $0.005 / 1M$0.00000018
10 output tokens × $0.01 / 1M$0.0000001 
Charge$0.00000028
Worked example for qwen3-vl-8b-instruct at current prices, not a live request
35 input tokens × $0.01 / 1M$0.00000035
10 output tokens × $0.02 / 1M$0.0000002 
Charge$0.00000055
Worked example for qwen3-vl-8b-instruct-fp8 at current prices, not a live request
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.

Embeddings models on this server. Prices in USD.
Model Input / 1M tokens Largest hold
qwen3-embedding-0.6b $0.002 $0.00013108
Worked example for qwen3-embedding-0.6b: 1,000 input tokens at current prices, not a live request
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_exhausted with a Retry-After header.

Chat completions

Request body
At most 1 MiB.
Context and max_tokens
Per model: see Chat models. max_tokens defaults to 512 and can't exceed the model's max output.
Request time limit
Per model: qwen2.5-3b-instruct 120 s, qwen2.5-1.5b-instruct 120 s, qwen3-vl-8b-instruct 900 s and qwen3-vl-8b-instruct-fp8 900 s. A request running past it is stopped and returns 504 upstream_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 on qwen2.5-1.5b-instruct, 32,128 bytes on qwen3-vl-8b-instruct and 32,128 bytes on qwen3-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.

API error responses
StatuscodeEndpointWhenopenai SDK raisesWhat to do
400invalid_content_lengthAllThe Content-Length header is missing a valid valueBadRequestErrorLet your HTTP client set Content-Length.
400model_requires_deploymentAllmodel resolves to a model that runs only on a dedicated deployment, and the request doesn't address one (param: model)BadRequestErrorCreate a deployment and call model#name. Not charged.
401invalid_api_keyAllThe API key is wrong or revokedAuthenticationErrorCheck PYM_API_KEY. The key may be revoked.
402insufficient_balanceAllYour available balance is less than this request's hold. The message states both, for example "This request holds $…; your available balance is $…."APIStatusErrorAdd 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.
404model_not_foundAllmodel isn't a model this server offers on this endpoint (param: model): an unknown id, or a model sent to another endpointNotFoundErrorUse an id from Models and prices, for example qwen2.5-3b-instruct. Not charged.
404not_foundAllNo such path under /v1NotFoundErrorCheck the URL. Your base URL should end in /v1.
405method_not_allowedAllThe path exists but not with this methodAPIStatusErrorCheck the method: GET /v1/models, or POST to /v1/chat/completions or /v1/embeddings.
413request_too_largeAllThe body is over this endpoint's limit (1 MiB chat/embeddings; with images, the model's own limit in Image caps)APIStatusErrorShrink the request. Nothing was held or charged.
429capacity_exhaustedAllEvery server for this model was busy for the whole waitRateLimitError (retried twice automatically)Retry after the Retry-After seconds. Not charged.
500internal_errorAllPym itself failedInternalServerError (retried twice automatically)Retry. Not charged.
502upstream_errorAllThe model server failed, stopped the request itself, or returned usage Pym can't trustInternalServerError (retried twice automatically)Retry. Not charged.
502 / 504 from the proxynoneAllAn 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.
503model_unavailableAllNo server is available to run this model right nowInternalServerError (retried twice automatically)Retry after Retry-After, or use another model. Your Overview shows each model's status. Not charged.
503inference_unavailableAllPym can't reach its inference serviceInternalServerError (retried twice automatically)Retry after Retry-After. Not charged.
503gpu_bookedAllThe GPU that serves this model is reserved for a scheduled booking (param: model); the message names the models and when they're backInternalServerError (retried twice automatically)Retry after the Retry-After seconds, or use another model. The status page lists every window. Not charged.
503catalog_unavailableAllThe 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 pricedInternalServerError (retried twice automatically)Retry after Retry-After. Not charged.
400context_length_exceededChatMessages plus max_tokens exceed the model's context (param: messages)BadRequestErrorShorten messages or lower max_tokens.
400invalid_requestChatA 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")BadRequestErrorFix the field named in param. See Tools and Parameters. Not charged.
400unsupported_parameterChatparallel_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)BadRequestErrorOmit parallel_tool_calls or send true; for tool_choice, don't stream, or use "auto" or a named tool. Not charged.
400tools_unsupportedChattools, an assistant tool_calls message or a tool message, sent to a model whose Features don't include Tools (param: tools)BadRequestErrorUse a model whose Features include Tools in Chat models. Not charged.
400response_format_unsupportedChatresponse_format sent to a model whose Features don't include Structured output (param: response_format)BadRequestErrorUse a model whose Features include Structured output in Chat models. Not charged.
400tools_too_large / invalid_toolsChattools 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)BadRequestErrorShrink or fix tools. Not charged.
400invalid_image_urlChatAn 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)BadRequestErrorSend the image itself: data:image/png;base64,… (see Images). Not charged.
400unsupported_parameter (images)ChatAn 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)BadRequestErrorUse a Vision model, put images in user messages, and one detail per request. Not charged.
400too_many_imagesChatMore images than the model accepts per request (see Image caps; param: messages)BadRequestErrorSplit the document across requests. Not charged.
400image_too_largeChatAn image is over the model's per-image size before decoding (param: the image's url)BadRequestErrorDownscale or recompress the image. Not charged.
400invalid_imageChatAn 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)BadRequestErrorRe-export the image as a plain PNG or JPEG. Not charged.
400schema_too_large / invalid_response_formatChatresponse_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)BadRequestErrorSimplify the schema. Not charged.
400max_tokens_too_largeChatmax_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".BadRequestErrorLower max_tokens, or stream the response.
408request_timeoutChatA body over 1 MiB (an image request) didn't finish arriving within 120 sAPIStatusError (retried twice automatically)Retry on a faster connection, or send smaller or fewer images. Nothing was held or charged.
422invalid_request_bodyChatAn 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."UnprocessableEntityErrorRemove the parameter, or bring its value into range (see Parameters).
504upstream_timeoutChat, embeddingsThe 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_timeoutChatThe 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.
400too_many_inputsEmbeddingsMore inputs than the model accepts (param: input)BadRequestErrorSplit the request. Not charged.
400input_too_largeEmbeddingsAll inputs together are over the per-request cap (see How inputs are counted)BadRequestErrorShorten the input, or split the request. Not charged.
400context_length_exceededEmbeddingsOne input (param: input[i]) is over its per-input limit (see How inputs are counted)BadRequestErrorShorten the input. Not charged.
400invalid_inputEmbeddingsAn empty string, or input given as token-id arrays or chat messagesBadRequestErrorSend input as a string or an array of strings. Not charged.
400dimensions_unsupportedEmbeddingsdimensions is outside the model's range (param: dimensions)BadRequestErrorFix dimensions (see Embeddings models). Not charged.
422invalid_request_bodyEmbeddingsAn 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."UnprocessableEntityErrorSend input as a string or an array of strings (see Parameters).
400multipart_required / unexpected_fieldFilesThe upload isn't a multipart form with exactly a purpose part and a file part (or a part repeats, or its headers are malformed)BadRequestErrorSend -F purpose=fine-tune -F "file=@train.jsonl" (curl) or client.files.create(file=..., purpose="fine-tune"). Nothing was stored.
400purpose_required / unsupported_purposeFilesNo purpose, or one other than fine-tune (param: purpose)BadRequestErrorSend purpose=fine-tune. Nothing was stored.
400file_required / filename_required / filename_unsupported / file_emptyFilesNo file part, no filename, a filename with control characters or over 255 characters, or an empty file (param: file)BadRequestErrorSend a non-empty JSONL file with a plain filename. Nothing was stored.
400incomplete_uploadFilesThe connection ended before the multipart body was completeBadRequestErrorSend it again. Nothing was stored.
400file_download_unsupportedFilesGET /v1/files/{file_id}/content: fine-tuning files can't be downloadedBadRequestErrorKeep your own copy of the data.
400invalid_requestFilesGET /v1/files with limit outside 1 to 10,000 or order other than asc/descBadRequestErrorFix the parameter named in param.
404file_not_foundFilesNo file with this id belongs to your account: unknown, deleted, or another account's (the same answer for each)NotFoundErrorUse an id from GET /v1/files.
408upload_timeoutFilesThe upload took longer than the server allows for one fileAPIStatusError (retried twice automatically)Upload from a faster connection, or split the file. Nothing was stored.
408upload_too_slowFilesThe upload sent less than 1 MiB in 60 secondsAPIStatusError (retried twice automatically)Upload from a faster connection. Nothing was stored.
413file_too_largeFilesThe file is over 100 MiB (refused before anything is stored, by the server or its proxy)APIStatusErrorSplit it into files of at most 100 MiB and 50,000 lines. Nothing was stored.
413storage_quota_exceeded / too_many_filesFilesStoring this file would pass your account's 10 GiB or 1,000 files. The message says how much you store and the limitAPIStatusErrorDelete files you no longer need, then upload again. Nothing was stored.
429too_many_uploadsFilesYour account already has 2 uploads in progress, or the server is receiving as many uploads as it canRateLimitError (retried twice automatically)Retry after the Retry-After seconds. Nothing was stored.
503files_unavailableFilesThis server doesn't store files, its file storage isn't answering, or uploads are paused for a few minutes while storage is backed upInternalServerError (retried twice automatically)Retry after Retry-After. Nothing was stored.