Skip to content

Ask AI

Powered by Blaze

Answers come from E2E Cloud documentation. AI can make mistakes.

Call the API with REST

View as Markdown

Call any GenAI API model directly over HTTP. REST works for every model of every kind, because the OpenAI SDK and the TIR SDK make the same call underneath. Use it when you want full control over the request, or for a model outside the eight the TIR SDK knows.

In GenAI API, select a model to open its page, then open Get Code. Its HTTP tab has the REST request for that model, with your project and the model’s endpoint already filled in. Copy it into an HTTP client, such as curl or Postman.

Every request needs the Auth Token of your Personal Access Token, which you can create as in Get started with TIR GenAI API. It goes in the Authorization header as a Bearer token:

Authorization: Bearer <your-auth-token>

A text or embedding model’s endpoint carries the model’s own name: https://infer.e2enetworks.net/project/<your-project-id>/genai/<model-name>/v1. The request body still names the model, matching the name already in the URL. This example calls Llama 4 Scout 17B 16E Instruct, whose API name is llama_4_scout_17b_16e_instruct:

curl https://infer.e2enetworks.net/project/<your-project-id>/genai/llama_4_scout_17b_16e_instruct/v1/chat/completions \
-H "Authorization: Bearer <your-auth-token>" \
-H "Content-Type: application/json" \
-d '{
"model": "llama_4_scout_17b_16e_instruct",
"messages": [{"role": "user", "content": "<your prompt>"}]
}'

<your-project-id> is the project your token belongs to. Llama 4 Scout 17B 16E Instruct is only an example, and you can call any model that is available in the GenAI API list. See Is a model on GenAI API guaranteed to stay available?.

Call a model that takes its name in the request body

Section titled “Call a model that takes its name in the request body”

Speech, image, and translation models share one endpoint, https://infer.e2enetworks.net/project/<your-project-id>/genai/v1. Their request body holds the model name and the inputs that model needs, and both differ from model to model. Copy the body from that model’s own Get Code > HTTP tab.

The response body holds the model’s reply. If a request fails, the error text comes from the model’s own service, and Troubleshooting TIR GenAI API explains what to do.

For a ready-made Python client for text and embedding models, see Call the API with the OpenAI SDK. For the TIR SDK’s own client, see Call the API with the TIR SDK.

Was this page helpful?