--- title: "Call the API with the TIR SDK" description: "Call a GenAI API model with the TIR SDK, which fills in the request body for the eight models it knows by name." content_type: "how-to" product: "genai-api" platform: "TIR" url: "/tir/genai-api/how-to/call-the-api-with-the-tir-sdk/" topic: ["call-the-api"] --- # Call the API with the TIR SDK The TIR SDK calls a fixed list of eight models for you and fills in the request body, so you pass only the model name and your data. The examples call Whisper Large V3, one of the eight, and you can use any of them 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). ## Before you begin You need: - A Personal Access Token. See [Get started with TIR GenAI API](/tir/genai-api/get-started/). - Your project ID. The eight models the TIR SDK knows are `llama-2-13b-chat`, `stable-diffusion-2-1`, `mixtral-8x7b-instruct`, `codellama-13b-instruct`, `whisper-large-v3`, `e5-mistral-7b-instruct`, `llama-3-8b-instruct`, and `parakeet-ctc-asr`. Any other model name raises "model not present". Call that model with the [OpenAI SDK](/tir/genai-api/how-to/call-the-api-with-the-openai-sdk/) or [REST](/tir/genai-api/how-to/call-the-api-with-rest/) instead. ## Install the TIR SDK ```bash pip install e2enetworks ``` ## Initialize the client ```python from e2enetworks.cloud import tir tir.init(api_key="", access_token="") tir_client = tir.ModelAPIClient(project="") ``` `` is the Auth Token from your Personal Access Token. Copy it from the Create Token dialog or, later, from the **Personal Access Tokens** list. `` is that same token's API Key. To get it, use the **Download Config File** action next to the token in the list; the file holds both values. `` is the project the token belongs to. You can also set these as environment variables and initialize the client with no arguments; the SDK then reads them from the environment: ```bash export E2E_TIR_API_KEY= export E2E_TIR_ACCESS_TOKEN= ``` ## Call the model Whisper Large V3 takes the path to a local audio file of up to 50 MB. The SDK uploads the file for you before it calls the model: ```python response = tir_client.infer( model_name="whisper-large-v3", data={ "input": "", "task": "transcribe", "language": "english", # "max_new_tokens": 200, # optional: 1 to 445 # "return_timestamps": "sentence", # optional: none, sentence, or word }, ) print(response.outputs[0].data) ``` Replace `` with the path to the audio file on your machine. `task` and `language` are required; set `language` to the language spoken in the audio. The two commented lines are optional: one caps the length of the transcript, and the other adds timestamps to it. ## Read the transcription `response.outputs[0].data` holds the transcription. To call any other model in the catalog, see [Call the API with REST](/tir/genai-api/how-to/call-the-api-with-rest/) or, for a text or embedding model, [Call the API with the OpenAI SDK](/tir/genai-api/how-to/call-the-api-with-the-openai-sdk/). If the call fails, see [Troubleshooting TIR GenAI API](/tir/genai-api/troubleshooting/genai-api/).