What you need
Every request enters through the job’s central server. It checks the key, so a missing or wrong key gets 401 before any GPU sees the request, then routes the call to a worker running your model.
vLLM runtimes: the OpenAI protocol
Point any OpenAI client at <endpoint>/v1. The model field is the model_id from your serve_module.py.
from openai import OpenAI
client = OpenAI(
base_url=f"{ENDPOINT}/v1",
api_key=PREDICT_KEY, # the client requires a value
default_headers={"X-API-Key": PREDICT_KEY}, # the platform reads this one
)
reply = client.chat.completions.create(
model="assistant",
messages=[{"role": "user", "content": "Summarize this ticket in one line."}],
max_tokens=256,
)
print(reply.choices[0].message.content)
for chunk in client.chat.completions.create(model="assistant", messages=[...], stream=True):
print(chunk.choices[0].delta.content or "", end="")curl "$ENDPOINT/v1/chat/completions" \
-H "X-API-Key: $PREDICT_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "assistant", "messages": [{"role": "user", "content": "Hello"}], "max_tokens": 64}'- One endpoint can serve several models: each
LLMConfiggets its ownmodel_id. - An answer that runs past 300 s is cut. Cap
max_tokensfor long generations. - A prompt longer than
max_model_lengets 400; other requests are unaffected.
Custom runtimes: /predict
Your class’s predict(data: bytes) always receives bytes. The Content-Type header tells the platform how to get them from your request:
Any other Content-Type gets 400 before your code runs.
url or data_b64 only; any other field is rejected. To send your own JSON (an image plus parameters, say), post it as application/octet-stream and json.loads(data) inside predict. The SDK’s predict_json() does this for you.# a file
curl -X POST "$ENDPOINT" -H "X-API-Key: $PREDICT_KEY" \
-H "Content-Type: image/jpeg" --data-binary @cat.jpg
# your own JSON: octet-stream, not application/json
curl -X POST "$ENDPOINT" -H "X-API-Key: $PREDICT_KEY" \
-H "Content-Type: application/octet-stream" \
-d '{"prompt": "a red bicycle", "steps": 30}'
# let the platform fetch a large input
curl -X POST "$ENDPOINT" -H "X-API-Key: $PREDICT_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/scan.tiff"}'From Python
from resontech import InferenceClient
client = InferenceClient(url=ENDPOINT, api_key=PREDICT_KEY)
client.predict_file("cat.jpg") # reads the file, guesses the type
client.predict(img_bytes, content_type="image/png") # bytes in memory
client.predict_url("https://example.com/scan.tiff") # the platform fetches it
client.predict_json({"image_b64": b64, "threshold": 0.7})
client.predict_many(files, concurrency=8) # N requests in flightKeep concurrency at or below max_ongoing_requests × workers; higher values only wait in the central server’s queue. Each response carries an X-Request-Id; quote it when you ask Support about a call.
Limits and errors
The second line in each Status cell is the exception the Python client raises.
The Python client retries 502, 503 and 504 with backoff and never retries a 4xx. What happens as load grows, stage by stage: Choosing hardware → Under load.
Callbacks
A custom runtime can also post each result to your server after it answers. Set a job-wide callback URL in the wizard, or send X-Callback-Url on a single request.
Next
- Request shapes for real models: vLLM examples and custom model examples, where each folder ships a predict.py.
- The runtime page has a playground that calls your endpoint from the browser.