Serverless endpoints
Run inference on GPUs that start when you need them
An endpoint is one HTTPS address for your server. We run it on as many GPU workers as your traffic needs, between a minimum and a maximum you set.
How an endpoint works
- 01
Choose a GPU and a worker template
Two worker templates are ready to use: vLLM (OpenAI-compatible) and Text Generation Inference. Set the model in their environment variables.
- 02
Set the limits
Choose the minimum and maximum number of workers, an idle timeout and an optional spending cap per hour.
- 03
Call it with an API key
Send requests to the endpoint address. Answers stream back as your server sends them.
How it scales, honestly
Workers are ordinary servers, so the same rules apply to them.
Scale to zero
With a minimum of zero workers, nothing is billed once the idle timeout has released the workers. The price is a cold start on the next request.
Cold starts take minutes
A new worker must find a machine, pull the image and load the model. We measured about 3.5 minutes for a small image and about 9.5 minutes for a model server. The first request after an idle period may get a 503 with a Retry-After header: retry, use async jobs, or keep one worker warm.
Warm workers
Keep a worker running, or a pool of stopped workers with their disks, so most requests skip the cold start. A pool shortens cold starts but does not guarantee any.
Spending cap and safety stops
Set a cap per hour. An endpoint pauses itself and emails you when your balance would last less than an hour, or when three worker requests in a row fail.
OpenAI-compatible route
With the vLLM worker template, point an OpenAI client library at the endpoint's OpenAI base URL and use your API key. Chat requests need a model that includes a chat template.
Async jobs for long work
One request lasts at most 300 seconds. Send longer work as a job and fetch the answer later: up to 280 seconds by default, up to an hour with our worker kit.
Billing: no per-request price
Every worker is billed like a server you deploy by hand: by the second at the hourly price of its GPU and disk, from when its server is running until it is released, including while it loads the model. Finding a machine and pulling the image are not billed. A stopped warm worker pays for its disk only, model cache included. During a rolling update the new and the old worker both run, and both are billed. Your balance must cover at least an hour of a new worker.
For an OpenAI-compatible server such as the vLLM template, point your OpenAI client at the endpoint. Only the base URL, the key and the model name change. Chat requests need a model that includes a chat template.
from openai import OpenAI
client = OpenAI(
base_url="https://apidly.com/api/v1/endpoints/EPN_ID/openai/v1",
api_key="YOUR_API_KEY",
)
reply = client.chat.completions.create(
model="YOUR_MODEL",
messages=[{"role": "user", "content": "Hello"}],
)Guides and ready-made templates
Step-by-step write-ups, and templates that start with the software already installed.
Serverless questions
Is there a price per request?
No. Each worker is billed like a server: by the second at the hourly price of its GPU and disk, from when it starts until it is released, including while it loads the model.
Why did my first request get a 503?
No worker was running, so one had to start, find a machine and load the model, which can take several minutes. The answer carries a Retry-After header: wait that long and send the request again.
How do I avoid cold starts?
Set a minimum of one worker to keep it running; you then pay for it all the time. A pool of stopped workers with their disks shortens cold starts but does not guarantee that none happen.
How do I stop paying for an idle endpoint?
With a minimum of zero workers, workers are released after the idle timeout and nothing is billed until the next request. Pause releases every worker and refuses requests. Avoid Stop for a long break: stopped workers keep their disks, and disks are billed.