--- title: "Call the API with REST" description: "Send a GenAI API request directly over HTTP, with the ready-made endpoint and body that Get Code fills in for any model." content_type: "how-to" product: "genai-api" platform: "TIR" url: "/tir/genai-api/how-to/call-the-api-with-rest/" topic: ["call-the-api"] --- # Call the API with REST 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. ## Before you begin You need: - A Personal Access Token. See [Get started with TIR GenAI API](/tir/genai-api/get-started/). - An HTTP client, such as curl or Postman. ## Get the ready-made request In **GenAI API**, select a model's row 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 your HTTP client. Every request needs your Auth Token in the `Authorization` header as a Bearer token: ```text Authorization: Bearer ``` ## Call a text or embedding model A text or embedding model's endpoint carries the model's own name: `https://infer.e2enetworks.net/project//genai//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: ```bash curl https://infer.e2enetworks.net/project//genai/llama_4_scout_17b_16e_instruct/v1/chat/completions \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "model": "llama_4_scout_17b_16e_instruct", "messages": [{"role": "user", "content": ""}] }' ``` `` 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?](/tir/genai-api/faq/#is-a-model-on-genai-api-guaranteed-to-stay-available). ## Call a model that takes its name in the request body Speech, image, and translation models share one endpoint, `https://infer.e2enetworks.net/project//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. ## Read the response 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](/tir/genai-api/troubleshooting/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](/tir/genai-api/how-to/call-the-api-with-the-openai-sdk/). For the TIR SDK's own client, see [Call the API with the TIR SDK](/tir/genai-api/how-to/call-the-api-with-the-tir-sdk/).