Endpoints
Read this page to promote a model you tested in Playground to a named production address, issue an endpoint key, and call it from other systems.
How it differs from a test serving
Section titled “How it differs from a test serving”A test serving is started briefly for testing. It stops when unused, and its address goes away. When another program needs an address it can always call, create an endpoint.
| Item | Test serving | Endpoint |
|---|---|---|
| Address | /serve/<serving id>/…, changes every time it starts |
/endpoints/<name>/…, the name is the address |
| Running time | Stops when unused | Always on. Restarted if the engine dies |
| Key | Personal key tied to a person (qgk_…) |
Endpoint key tied to the endpoint (qge_…) |
| Memory | Counted against the person who started it | Always held from the team's GPU memory quota |
Create one
Section titled “Create one”Anyone signed in can create an endpoint under their own team. Admins can create one under any team.
Promote a test serving
Section titled “Promote a test serving”This works for both LLMs and custom inference code. Custom inference code can be promoted only this way.
- In the Deploy › Playground list, open the ⋯ menu on the test serving row and select Deploy as an endpoint. The same button in the API usage view also works.
- Enter a name. The dialog checks at once whether the name is available and previews the
…/endpoints/<name>/v1address. - Pick the team, title and scope. Use the memory bar to check that it fits within the server's always-on reservation limit.
- If you leave Stop the test serving first on (the default), the original test serving stops once the new endpoint is ready.
- The endpoint appears in Deploy › Endpoints as Deploying and becomes Serving when it is ready.
The endpoint is started again from the code and environment pinned when the test serving started, so the workspace can be off. You can promote a test serving that has already ended, as long as its record remains.
Create from a model directly
Section titled “Create from a model directly”For LLMs you can also skip the test serving. Select Create an endpoint in Deploy › Endpoints and pick a model.
Name rules
Section titled “Name rules”- Starts with a lowercase letter and uses lowercase letters, digits and
-, 2 to 31 characters. - Cannot be changed after creation.
- A deleted name cannot be reused for 30 days. This keeps old keys and programs from calling an unrelated new endpoint.
Call it
Section titled “Call it”The address is $BASE/endpoints/<name>/…. The path tails are the same as the test API. LLMs use the OpenAI-compatible /v1 paths, and the model value in requests is the endpoint name. The address and the model value stay the same even when the endpoint is restarted.
BASE="http://<server address>:<web port>"export QGON_KEY="qge_…" # endpoint key
curl "$BASE/endpoints/<name>/v1/chat/completions" \ -H "Authorization: Bearer $QGON_KEY" -H "Content-Type: application/json" \ -d '{"model": "<name>", "messages": [{"role": "user", "content": "Hello"}], "max_tokens": 128}'# pip install openaiimport osfrom openai import OpenAI
BASE = "http://<server address>:<web port>"client = OpenAI(base_url=f"{BASE}/endpoints/<name>/v1", api_key=os.environ["QGON_KEY"])r = client.chat.completions.create( model="<name>", messages=[{"role": "user", "content": "Hello"}], max_tokens=128,)print(r.choices[0].message.content)BASE="http://<server address>:<web port>"export QGON_KEY="qge_…"
curl "$BASE/endpoints/<name>/predict" -H "Authorization: Bearer $QGON_KEY" \ -F image=@photo.jpg -F 'params={"threshold": 0.5}'An endpoint running custom inference code uses predict, info and cancel, with the same input and response shapes as predict on the test API. Both kinds report their state at …/health. The Overview tab of the endpoint details also shows code for calling it.
Code inside a workspace or training job calls the in-server address http://qdix-gateway:82/endpoints/<name>/…. A workspace key cannot call it, so use an endpoint key or a personal key.
Endpoint keys
Section titled “Endpoint keys”An endpoint key (qge_…) is tied to one endpoint. Because it is not tied to a person, it keeps working even if the account that issued it is deleted. Put this key in production programs.
- From the same LAN as the server, open the Keys tab of the endpoint details. Keys can be issued only from the LAN.
- Select Issue a key and set a name, an expiry (30 days, 90 days, 1 year or never) and a per-minute request cap. Leave the cap empty to use the server default.
- Copy the key value right away. It is shown only once.
- An endpoint can hold up to 20 keys.
- To revoke a key you type its name. A revoked key is blocked at once.
- Requests are counted per key per minute. Going over the cap returns 429
rate_limitedwith aRetry-Afterheader.
To issue one through the API, send {"name": "batch server", "expires_days": 90, "rpm_limit": 600} to POST /qgon-api/endpoints/<name>/keys. "expires_days": null means no expiry, and leaving it out means one year. See REST API for how to get a token.
An endpoint key can call its endpoint whatever the scope. The scope decides who can call it with a personal key or a signed-in session.
| Scope | Who can call with a personal key or sign-in |
|---|---|
| Team (default) | People in that team and admins |
| Whole server | Anyone on the server |
| Keys only | No one. Only endpoint keys work |
Widening the scope asks for confirmation. Endpoints that another team opened to the whole server show only their address, state and how to call them.
Call from outside the server
Section titled “Call from outside the server”To call an endpoint from outside the LAN, both of these must hold.
- The admin set the server's external access level to Full access.
- Allow calls from outside is on in that endpoint's Settings.
From outside, viewing endpoints works from the Read-only level. Stop, start again and key revocation work at the Read + basic actions level when the admin allowed the Stop · start/stop group, and the team lead and admins are notified. Issuing keys and changing server settings work only from the LAN, at any level. The rules for each level are in Security and access.
Operate
Section titled “Operate”Who manages it
Section titled “Who manages it”Admins, the team's lead and the person who created the endpoint can stop, start again, delete, change settings, and issue or revoke keys. Start again, Stop and Delete are in the ⋯ menu at the top right of the details page. Stop and delete go ahead only after you type the endpoint name. Deleting stops the endpoint, revokes all its keys, and reserves the name for 30 days.
Automatic recovery
Section titled “Automatic recovery”If the engine dies, it is started again at growing intervals. After several failures in a row, automatic recovery halts and the team lead and admins are notified.
- If the memory guard stopped it because the server ran low on memory, it waits for memory to free up and then starts again. If this happens several times in a short period, it halts.
- When the server restarts, endpoints come back one by one in creation order once startup conditions are met.
- If the model, environment or code bundle has been deleted and it cannot start again, it halts at once.
For a halted endpoint, fix the cause and select Start again.
Memory
Section titled “Memory”A running endpoint always holds its reserved memory. That share comes out of the team's GPU memory quota and stays held while the engine restarts, so training jobs cannot take its place. The server-wide cap on always-on reservations and the number of endpoints are admin settings. When memory runs short and something has to stop, the memory guard stops endpoints last. A new version that has never finished getting ready, and an endpoint whose measured GPU memory exceeds 1.2 times its reservation (the default), are treated like ordinary serving (Server resources and the GPU floor map).
If you must run a large training job, Stop the endpoint to release its reservation, and Start again after the job ends. Team quotas are covered in Teams and quotas.
What is protected from deletion
Section titled “What is protected from deletion”The model, environment image and code bundle an endpoint uses cannot be deleted and are skipped by cleanup. Deleting the output models of the experiment that made that model is also blocked.
Response codes
Section titled “Response codes”Endpoint errors use the OpenAI shape {"error": {"message", "type", "code"}}.
| Status | code |
Meaning | What to do |
|---|---|---|---|
| 401 | unauthorized |
The key is missing or wrong | Check the key and the Authorization: Bearer header |
| 403 | forbidden |
Outside the scope | Use an endpoint key or check the scope |
| 403 | external_denied |
It cannot be called from outside the server | Check the conditions in Call from outside the server |
| 404 | not_found |
No such endpoint | Check the name |
| 429 | rate_limited |
The key went over its per-minute cap | Wait for Retry-After, then retry |
| 503 | not_ready, recovering |
Deploying or restarting | Wait for Retry-After, then retry |
| 503 | halted, stopped |
Automatic recovery halted, or it was stopped | Tell the people who manage it |
predict on a custom inference code endpoint can also return the same errors as the test API.