Skip to main content

API Requests

This page describes how to send requests to a registered model and receive responses.

API Environment

Models deployed in Elice AI Cloud run on top of BentoML and expose the following API endpoints.

BentoML API Endpoints

  • User-defined APIs
    • Run inference and return results through the APIs defined in your BentoML service.
  • /livez
    • A health check endpoint for Kubernetes. Returns 200 OK when healthy.
  • /readyz
    • When /readyz returns 200 OK, the service is ready to accept traffic. From that point on, Kubernetes uses /livez for periodic health checks.
  • /metrics
    • A Prometheus metrics endpoint. Prometheus can use the values returned from /metrics to scrape service metrics.

Request Authentication

Every ML API call requires API key authentication. Requests without an API key are treated as unauthorized and are not processed.

For how to issue and manage API keys, see Managing API Keys.

Finding the API URL

Find the API URL

You can find the base URL for API requests as follows:

  1. (For Dedicated) Go to the Dedicated endpoints page and click into the API you want to inspect.
  2. The API info section shows the call details.

BentoML API Request Examples

Append the BentoML endpoint path to the API URL to send requests. A few examples follow.

Health Check (/readyz)

  • Append /readyz to the API URL.

    https://api-cloud-function.elice.io/3ed3b4e7-46cb-459f-abd9-e30680e8b11f/readyz

Inference (user-defined endpoint)

  • Append your custom API endpoint path.

    https://api-cloud-function.elice.io/3ed3b4e7-46cb-459f-abd9-e30680e8b11f/generate
  • Using curl, the request looks like this:

    curl -X 'POST' \
    'https://api-cloud-function.elice.io/3ed3b4e7-46cb-459f-abd9-e30680e8b11f/generate' \
    -H 'accept: image/*' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer {{api_key}}' \
    -d '{
    "prompt": "a tiny astronaut hatching from an egg on the moon",
    "height": 512,
    "width": 512,
    "num_inference_steps": 4,
    "guidance_scale": 0
    }'