Nestor docs
Inference

Call an Endpoint

A READY model Endpoint serves an OpenAI-compatible chat completions API. Use any OpenAI client, the Nestor CLI or SDK, or plain HTTP.

URL and credential

The Endpoint's Connect section in the Console shows its base URL:

https://api.nestor.software/v1/organizations/ORG_ID/projects/PROJECT_ID/endpoints/ENDPOINT_ID/inference/v1

Requests go to BASE_URL/chat/completions. The URL stays the same for the life of the Endpoint, across every update.

Authenticate with an invocation key as the bearer token. A signed-in person can also call an Endpoint they have access to. Service account management keys manage resources and cannot call Endpoints.

curl "$BASE_URL/chat/completions" \
  -H "Authorization: Bearer $NESTOR_INFERENCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "ENDPOINT_ID", "messages": [{"role": "user", "content": "Hello"}], "max_tokens": 128}'

With the OpenAI SDK

from openai import OpenAI

client = OpenAI(base_url=BASE_URL, api_key=NESTOR_INFERENCE_KEY)
completion = client.chat.completions.create(
    model="ENDPOINT_ID",
    messages=[{"role": "user", "content": "Hello"}],
)
print(completion.choices[0].message.content)

Any client that lets you set a base URL and an API key works the same way.

With the Nestor CLI and SDK

nestor inference endpoints chat endp_… "Write a limerick" --stream --key "$NESTOR_INFERENCE_KEY"
nestor inference endpoints url endp_…        # prints the base URL
from nestor import Nestor

client = Nestor()
endpoint = client.inference.endpoints.get("endp_…")
reply = client.inference.endpoints.chat(endpoint, "Write a limerick", key=NESTOR_INFERENCE_KEY)
print(reply.text, reply.usage, reply.request_id)

stream = client.inference.endpoints.chat(endpoint, "Count to five", stream=True, key=NESTOR_INFERENCE_KEY)
for chunk in stream:
    print(chunk.text, end="")

Request

FieldNotes
modelThe Endpoint ID or name, or the served repository name.
messagessystem, user and assistant messages with text content. Tools and images are not supported.
streamtrue for server-sent events.
max_tokens, temperatureStandard sampling options.

Send an Idempotency-Key header to make a non-streamed request safe to retry: repeating it returns the same response and counts usage once.

Response

A standard chat.completion object with choices[0].message.content and usage. The X-Nestor-Request-Id header identifies the request in the Endpoint's logs; include it when you contact support.

With "stream": true the response is text/event-stream with chat.completion.chunk events ending in data: [DONE]. The chunk that finishes the answer carries finish_reason in its choice. A separate final chunk carries usage with an empty choices array, so do not assume every chunk has a choice. If serving fails mid-stream, the stream ends with an event: error event. A stream that ends without [DONE] is incomplete; do not treat it as a full answer.

Errors

StatusMeaning
400 INVALID_ARGUMENTMalformed request or unsupported field.
401 UNAUTHENTICATEDMissing, expired or revoked credential.
403 PERMISSION_DENIEDThe key is bound to another Endpoint, or the caller cannot invoke it.
404 NOT_FOUNDNo such Endpoint in this project.
409 FAILED_PRECONDITIONThe Endpoint is not serving, for example while it is being deleted.
429 RESOURCE_EXHAUSTEDAn invocation limit is reached.
503 UNAVAILABLENo replica is serving right now. Retry with backoff.

Privacy

Prompts and generated text are never written to logs, events, metrics, audit records or usage. The only copy Nestor keeps is the stored response of a non-streamed request sent with an Idempotency-Key, so that a retry returns the same answer.

Documentation source ad860f2fd0ba

On this page