> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nebius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to call an endpoint

> Call a Serverless AI endpoint over its managed HTTPS or TLS URL and get acquainted with traffic and connection limits.

You can call an endpoint when you want to interact with an AI model hosted in this endpoint; for example, when you want to chat with the model.

Each HTTP port is available through a managed `https://` URL. gRPC also uses the managed HTTPS URL. For TCP ports, use the managed `tls://<host>:443` URL with a TLS client.

Endpoints support managed public URLs, shown in **Public endpoints** as `https://...`. For some previously created endpoints, **Public endpoints** can show `IP:port` instead.

## Prerequisites

> [tab] Web console
>
> Make sure that you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the
> role within your
> .
> You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

> [tab] CLI
>
> * [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI.
>
>   Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration:
>
>   ```bash theme={null}
>   cat ~/.nebius/config.yaml
>   ```
>
> * Install [jq](https://jqlang.org/) to parse JSON output:
>
>   ```bash Ubuntu theme={null}
>   sudo apt-get install jq
>   ```
>
>   ```bash macOS theme={null}
>   brew install jq
>   ```
>
> * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the
>   role within your
>   .
>   You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

> [tab] Go SDK
>
> * [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md).
> * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the
>   role within your
>   .
>   You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

> [tab] Python SDK
>
> * [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md).
> * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the
>   role within your
>   .
>   You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

> [tab] JavaScript SDK
>
> * [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md).
> * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the
>   role within your
>   .
>   You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

> [tab] REST API
>
> * Get an access token to [authenticate to the REST API](https://docs.nebius.com/rest-api/authentication.md).
>
> * Install [jq](https://jqlang.org/) to parse JSON output:
>
>   ```bash Ubuntu theme={null}
>   sudo apt-get install jq
>   ```
>
>   ```bash macOS theme={null}
>   brew install jq
>   ```
>
> * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the
>   role within your
>   .
>   You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

## How to call an endpoint

1. Get the endpoint's managed HTTPS URL:

   > [tab] Web console
   >
   > 1. In the sidebar, go to  **Serverless AI** → **Endpoints**.
   > 2. Open the page of the required endpoint.
   > 3. Wait until the endpoint is running. Then, in the **Network** section, copy the public endpoint from the **Public endpoints** field. Depending on how the endpoint is exposed, this field can show either a managed `https://...` URL or `IP:port`.

   > [tab] CLI
   >
   > 1. To get the endpoint ID, list all endpoints:
   >    ```bash theme={null}
   >    nebius ai endpoint list
   >    ```
   >    In the output, copy the ID of the required endpoint.
   > 2. Get the endpoint's managed HTTPS URL:
   >
   >    ```bash theme={null}
   >    nebius ai endpoint get <endpoint_ID> --format json \
   >      | jq -r '.status.public_endpoints[] | select(startswith("https://"))' | head -1
   >    ```

   > [tab] Go SDK
   >
   > 1. List endpoints:
   >
   >    ```go theme={null}
   >    listEndpointService := sdk.Services().Ai().V1().Endpoint()
   >    endpoints, err := listEndpointService.List(
   >        ctx,
   >        &ai.ListEndpointsRequest{
   >            ParentId: "<project_ID>",
   >        },
   >    )
   >    if err != nil {
   >        return fmt.Errorf("list endpoints: %w", err)
   >    }
   >    fmt.Println(endpoints)
   >    ```
   >
   >    In `ai.ListEndpointsRequest`, set `ParentId` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-go-sdk). In the response, copy the `Metadata.Id` of the required endpoint.
   >
   > 2. Get the endpoint's managed HTTPS URL:
   >
   >    ```go theme={null}
   >    getEndpointService := sdk.Services().Ai().V1().Endpoint()
   >    endpoint, err := getEndpointService.Get(
   >        ctx,
   >        &ai.GetEndpointRequest{
   >            Id: "<endpoint_ID>",
   >        },
   >    )
   >    if err != nil {
   >        return fmt.Errorf("get endpoint: %w", err)
   >    }
   >    for _, address := range endpoint.GetStatus().GetPublicEndpoints() {
   >        if strings.HasPrefix(address, "https://") {
   >            fmt.Println(address)
   >            break
   >        }
   >    }
   >    ```
   >
   >    In `ai.GetEndpointRequest`, set `Id` to the endpoint ID that you copied. The code prints the endpoint's managed HTTPS URL.

   > [tab] Python SDK
   >
   > 1. List endpoints:
   >
   >    ```python theme={null}
   >    list_endpoint_service = EndpointServiceClient(sdk)
   >    endpoints = await list_endpoint_service.list(
   >        ListEndpointsRequest(parent_id="<project_ID>"),
   >    )
   >    print(endpoints)
   >    ```
   >
   >    In `ListEndpointsRequest`, set `parent_id` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-python-sdk). In the response, copy the `metadata.id` of the required endpoint.
   >
   > 2. Get the endpoint's managed HTTPS URL:
   >
   >    ```python theme={null}
   >    get_endpoint_service = EndpointServiceClient(sdk)
   >    endpoint = await get_endpoint_service.get(
   >        GetEndpointRequest(id="<endpoint_ID>"),
   >    )
   >    public_endpoint = next(
   >        (
   >            address
   >            for address in endpoint.status.public_endpoints
   >            if address.startswith("https://")
   >        ),
   >        None,
   >    )
   >    if public_endpoint is not None:
   >        print(public_endpoint)
   >    ```
   >
   >    In `GetEndpointRequest`, set `id` to the endpoint ID that you copied. The code prints the endpoint's managed HTTPS URL.

   > [tab] JavaScript SDK
   >
   > 1. List endpoints:
   >
   >    ```ts theme={null}
   >    const listEndpointService = new EndpointService(sdk);
   >    const endpoints = await listEndpointService.list(
   >      ListEndpointsRequest.create({
   >        parentId: "<project_ID>",
   >      }),
   >    );
   >    console.log(endpoints);
   >    ```
   >
   >    In `ListEndpointsRequest`, set `parentId` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-javascript-sdk). In the response, copy the `metadata.id` of the required endpoint.
   >
   > 2. Get the endpoint's managed HTTPS URL:
   >
   >    ```ts theme={null}
   >    const getEndpointService = new EndpointService(sdk);
   >    const endpoint = await getEndpointService.get(
   >      GetEndpointRequest.create({
   >        id: "<endpoint_ID>",
   >      }),
   >    );
   >    const publicEndpoint = endpoint.status?.publicEndpoints.find(
   >      (address) => address.startsWith("https://"),
   >    );
   >    if (publicEndpoint !== undefined) {
   >      console.log(publicEndpoint);
   >    }
   >    ```
   >
   >    In `GetEndpointRequest`, set `id` to the endpoint ID that you copied. The code prints the endpoint's managed HTTPS URL.

   > [tab] REST API
   >
   > 1. List endpoints:
   >
   >    ```bash theme={null}
   >    curl --request GET \
   >      --url "https://api.nebius.cloud/ai/v1/endpoints?parentId=<project_ID>" \
   >      --header "Authorization: Bearer <access_token>"
   >    ```
   >
   >    In the request, specify:
   >
   >    * Your access token in the `Authorization` header.
   >    * The [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id) in the `parentId` query parameter.
   >
   >    In the response, copy the `metadata.id` of the required endpoint.
   >
   > 2. Get the endpoint's managed HTTPS URL:
   >
   >    ```bash theme={null}
   >    curl --request GET \
   >      --url "https://api.nebius.cloud/ai/v1/endpoints/<endpoint_ID>" \
   >      --header "Authorization: Bearer <access_token>" \
   >      | jq -r '.status.publicEndpoints[] | select(startswith("https://"))' | head -1
   >    ```
   >
   >    In the request, specify:
   >
   >    * Your access token in the `Authorization` header.
   >    * The endpoint ID from `metadata.id`, in the request path.

2. Call the endpoint by using an HTTP client. For example, with `curl`:

   ```bash theme={null}
   curl "<endpoint_URL>/v1/chat/completions" \
      -H "Authorization: Bearer <token>" \
      -H "Content-Type: application/json" \
      -d '{
         "model": "llama-3-70b",
         "messages": [
            {"role": "user", "content": "Tell a joke about AI."}
         ]
      }'
   ```

   In the command, specify the following parameters:

   * `<endpoint_URL>`: Managed HTTPS URL that you copied earlier.
   * `<token>`: Authentication token that you specified when you created the endpoint. If you didn't specify any token, don't use the `Authorization` HTTP header.
   * `model`: AI model that is hosted in the endpoint and that you chat with.
   * `content`: Message that you want to send to the model.

   The response looks like the following:

   ```json theme={null}
   {
     "choices": [
       {
         "message": {
           "role": "assistant",
           "content": "Why did the AI cross the road? Because it learned the optimal path after 10,000 epochs."
         }
       }
     ]
   }
   ```

## Traffic and connection limits

Managed public URLs of `https://` and `tls://` endpoints are served through [Nebius Tunnels](https://docs.nebius.com/tunnels/resources/quotas-limits.md), which means the limits for Tunnels apply to them. The limits for each endpoint are measured separately:

| Limit | Value per endpoint |
| - | - |
| Traffic, inbound and outbound combined | 120 Mbps |
| New client connections | 300 per second |

> [!WARNING]
>
> You cannot change the above limits from the web console.

All endpoints in a project share the [project limit](https://docs.nebius.com/tunnels/resources/quotas-limits.md), and all endpoints and tunnels in a region share the region limit. An endpoint never gets more than its own limit, but it can get less when its project or region is busy. When usage reaches a limit, responses may take longer until usage drops below the limit. Take these limits into account when you plan endpoints that serve high request volumes or large responses, such as audio, video, or long streamed model outputs.
