---
title: "Create an API key"
description: "Create a TIR Token Factory API key for your project, choose when it expires, and copy it once to authenticate requests to any model."
content_type: "how-to"
product: "token-factory"
platform: "TIR"
url: "/tir/token-factory/how-to/create-an-api-key/"
topic: ["api-keys"]
---

# Create an API key

Create an API key to authenticate requests to Token Factory models from your project. One key works
with every model, and the model ID in each request decides which model answers. Token Factory API
keys are separate from TIR Personal Access Tokens, which do not work with Token Factory.

## Create the key

1. In TIR, open a project. In the side menu, under **INFERENCE**, select **Token Factory**, then
   select **API Keys**.
2. Select **Create API Key**. On a model's page, **Create API key** opens the same form. A project
   can have up to 25 active API keys; at the limit, revoke a key you no longer use before you
   create another. On a prepaid account, you need a credit balance above zero to create a
   key.
3. In **Name**, say where you will use the key, in up to 100 characters; for example, `production`
   or `ci-tests`. Every key needs a name, and a clear one helps you pick the right key to block or
   revoke later.
4. In **Expires**, choose how long the key works. Requests with the key fail once it expires.
   - **Never** suits a key held by a server you control.
   - **In 30 days**, **In 90 days**, or **In 1 year** suits a key for a test, a contractor, or a
     tool you try out, so it stops on its own.

   You cannot change the name or expiry later. To change either, create a new key and revoke the old
   one.

5. Select **Create Key**.

## Copy the key

**Copy your new API key** shows the key once. TIR does not keep a copy, so a key you do not copy now
cannot be shown again; if that happens, create a new key instead.

1. Copy the key and store it somewhere safe, such as your secret manager or an environment variable
   on the server that uses it.
2. Tick **I have copied the API key.**, then select **Done**.

The key now appears on **API Keys** with the status **Active**. The **Key** column shows only the
start and the last four characters of each key, so you can tell keys apart without exposing them.
**Created By** shows who created each one.

To use the key, see [Call a model with the OpenAI
SDK](/tir/token-factory/how-to/call-a-model-with-the-openai-sdk/) or [Call a model with
REST](/tir/token-factory/how-to/call-a-model-with-rest/). If a key is lost or leaked, [block or
revoke it](/tir/token-factory/how-to/block-unblock-or-revoke-an-api-key/). For help with a message
when you create a key, see [Troubleshooting TIR Token
Factory](/tir/token-factory/troubleshooting/token-factory/).
