Skip to content

Ask AI

Powered by Blaze

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

Get started with TIR Token Factory

View as Markdown

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

  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.

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.
  1. Install the OpenAI SDK:

    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:

    export TOKEN_FACTORY_API_KEY="<your-api-key>"
  3. Save this in a file named hello.py:

    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:

    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.

For help with an error, see Troubleshooting TIR Token Factory, which lists each message with its fix.

Was this page helpful?