---
title: "Get started with TIR Token Factory"
description: "Pick a TIR Token Factory model, create an API key, and get your first reply from the model with the OpenAI SDK for Python."
content_type: "get-started"
product: "token-factory"
platform: "TIR"
url: "/tir/token-factory/get-started/"
---

# Get started with TIR Token Factory

<!-- cspell:ignore gemma -->

Pick a model, create an API key, and send the model your first prompt from Python with the OpenAI
SDK.

## Pick a model

1. In TIR, open a project. In the side menu, under **INFERENCE**, select **Token Factory**. It
   lists every model you can call, with its context window and its prices per million tokens.
2. Select a model to open its page. The examples use Gemma 4 31B, whose model ID is
   `google/gemma-4-31b-it`; any model on the list works the same way.

## Create an API key

Every request to a Token Factory model needs an API key from your project. On a prepaid account, you
need a credit balance above zero to create one.

1. On the model's page, select **Create API key**.
2. In **Name**, say where you will use the key, for example `getting-started`. In **Expires**,
   choose **Never**, or **In 30 days** for a key you need only for a short time.
3. Select **Create Key**.
4. In **Copy your new API key**, copy the key and keep it somewhere safe. TIR shows it only once and
   does not keep a copy. Tick **I have copied the API key.**, then select **Done**.

## Call the model

1. Install the OpenAI SDK:

   ```bash
   pip install -U openai
   ```

2. Put the key in an environment variable, so it stays out of your code. `<your-api-key>` is the
   key you copied:

   ```bash
   export TOKEN_FACTORY_API_KEY="<your-api-key>"
   ```

3. Save this in a file named hello.py:

   ```python
   import os
   from openai import OpenAI

   client = OpenAI(
       api_key=os.environ["TOKEN_FACTORY_API_KEY"],
       base_url="https://blaze.e2enetworks.net/v1",
   )

   response = client.chat.completions.create(
       model="google/gemma-4-31b-it",
       messages=[{"role": "user", "content": "Say hello in one sentence."}],
   )
   print(response.choices[0].message.content)
   ```

   **Call this model** on the model's page shows the same request in Python, Node, and cURL, with
   that model's ID already filled in.

4. Run it from the same terminal:

   ```bash
   python hello.py
   ```

The model's reply prints to your console. The request can take up to a minute to appear on the
model page's **Metrics**, and its tokens are billed to your project.

## What to do next

- [Call a model with the OpenAI SDK](/tir/token-factory/how-to/call-a-model-with-the-openai-sdk/)
  covers Node and streaming.
- To compare models before you build on one, see
  [Choose a model](/tir/token-factory/how-to/choose-a-model/).
- [Tokens and billing](/tir/token-factory/concepts/tokens-and-billing/) explains what a request
  costs.

For help with an error, see [Troubleshooting TIR Token
Factory](/tir/token-factory/troubleshooting/token-factory/), which lists each message with its fix.
