Call your endpoint
Send requests to a deployed inference endpoint over HTTP.
Once an endpoint is running, you can send inference requests to it over HTTP. For the full request and response reference, see [Inference API](https://docs.zettabyte.com/docs/zcloud/inference-api/inference-api).
Before you begin
- A deployed endpoint that is running: open [**Inference**](https://console.zettabyte.com/task-inference/index) and check that its Scaling shows every replica running, for example `1/1`. See [Deploy a model](https://docs.zettabyte.com/docs/zcloud/deploy-and-serve/deploy-a-model).
- An API key. The key is shown once at creation, so copy it then. See [API keys](https://docs.zettabyte.com/docs/accounts-and-roles/api-keys).
Find your details
You need three things:
- Your API key: in **API Keys**, select **Create API Keys**.
- Your tenant ID, shown with your tenant name in the menu at the bottom left of the sidebar.
- The endpoint's job alias name: open [**Inference**](https://console.zettabyte.com/task-inference/index) and read it from the list.
The tenant ID and job alias name combine into the `Service-Name` header, described below.
Call with cURL
curl https://api.zettabyte.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Service-Name: TENANT_ID.JOB_ALIAS_NAME" \
-d '{
"prompt": "Hello",
"max_tokens": 128,
"temperature": 0.7
}'
Call with Python
import requests
resp = requests.post(
"https://api.zettabyte.com/v1/completions",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY",
"Service-Name": "TENANT_ID.JOB_ALIAS_NAME",
},
json={"prompt": "Hello", "max_tokens": 128, "temperature": 0.7},
)
print(resp.json())
The Service-Name header
The `Service-Name` header routes your request to your specific deployment. It is built as `TENANT_ID.JOB_ALIAS_NAME`: your tenant ID, a dot, then the endpoint's job alias name.
zCLOUD-specific header
`Service-Name` is a zCLOUD-specific (non-standard) header. It is not part of the standard OpenAI-style API, so remember to add it **explicitly in every client**.
Troubleshooting
- `401` or auth error: the API key has expired.
- `404` or wrong service: the `Service-Name` header is malformed. Check that it reads `TENANT_ID.JOB_ALIAS_NAME`.
Next steps
- [Inference API](https://docs.zettabyte.com/docs/zcloud/inference-api/inference-api): the full request and response reference.