Call inference API
Call the inference API using the URL shown on the endpoint details page and an API key connected to that endpoint.
Prerequisites
- Verify that the endpoint state is
Active. - Create an API key and connect it to the endpoint to call.
- To apply usage limits to the API key, select a tier for the endpoint connection.
- Check the API schema configured in the model revision.
Check endpoint information
- Go to AI Service > Advanced AI Space.
- Click Endpoints.
- Click the name of the endpoint to call.
- In Details, check and copy the Endpoint URL.
- In Credentials > API keys, check the Connected endpoint count for the API key to use.
- Click [Endpoint settings] in the API key's more options menu and verify that the target endpoint is connected.
Prepare request information
Check the HTTP method, request path, headers, and request body format in API Schema (endpoint) configured in the model revision. The following values are required.
| Variable | Description |
|---|---|
{HTTP_METHOD} | HTTP method defined in the API schema |
{ENDPOINT_URL} | URL shown on the endpoint details page |
{REQUEST_PATH} | Request path defined in the API schema |
{API_KEY_HEADER} | HTTP header name used to pass the API key |
{API_KEY} | API key connected to the endpoint |
{REQUEST_BODY} | JSON request body that follows the API schema |
Send request
Substitute the values you checked into the following request format. The HTTP method, request path, authentication header, and request body may vary by the model's API schema.
curl --request {HTTP_METHOD} \
--url "{ENDPOINT_URL}{REQUEST_PATH}" \
--header "{API_KEY_HEADER}: {API_KEY}" \
--header "Content-Type: application/json" \
--data '{REQUEST_BODY}'
Check call result
- If authentication fails, check the API key expiration and endpoint connection.
- If the request is rejected, check the tier applied to the API key connection and current quota utilization.
- If the endpoint does not respond, verify that its state is
Active. - Check model server logs in the endpoint's View logs tab.
- Check request counts and token usage in the Request/token usage tab.