AMD Token Lab gives Gemma 4 31B for free

AMD Token Lab provides an OpenAI-compatible API for leading open models served on AMD Instinct and Radeon hardware. The service comes as a member perk of the AMD AI Developer Program and requires no credit card or approval request to access.

The API endpoint lives at https://api.tokenlab.amd.com/v1 and works with curl, the OpenAI and Anthropic SDKs, LangChain, and AMD AI Notebooks. Every program member receives a key with 10 points, 30 days of access (extendable once by 15 days), and a 20 requests per minute rate limit.

Gemma 4 31B-IT accepts text and image inputs with a 262,144-token context window. The model costs 0.035 points per million input tokens and 0.07 points per million output tokens. Token Lab measures points as relative usage per model, so larger models consume more points per token. All 23 requests in this article consumed only 0.000335 of the 10-point allowance.

Getting started with Token Lab

Join the AMD AI Developer Program at developer.amd.com. The sign-up form requires email verification and grants access to AI Academy. Membership also includes a one-month DeepLearning.AI subscription, early event registration, a private Discord with AMD engineers, and a monthly sweepstakes for Radeon or Ryzen AI PC hardware.

After joining, obtain a Token Lab key at notebooks.amd.com/tokenlab. The dashboard displays remaining points, recent request count, days left, the rate limit, and the key status. Regenerating a key preserves your points and access period.

Store the API key in a .env file at the project root. Never commit this file to version control. The base URL and model name belong in a separate tpu.env file:

TOKENLAB_API_KEY=tl-...
TOKENLAB_BASE_URL=https://api.tokenlab.amd.com/v1
MODEL_NAME=Gemma-4-31B-IT

First API call

The simplest way to test the service is with make query, which sends one chat completion and prints the raw response. A minimal reply might confirm "The capital of Australia is Canberra." Every response includes a cost field in points so clients can track their own usage.

Model card and supported features

The make models command returns Token Lab's model card. Gemma 4 31B runs on SGLang as a dynamic router service. The card lists supported parameters including temperature, max_tokens, top_p, stream, response_format, tools, tool_choice, and reasoning_effort. The architecture supports text and image input modalities with text output.

Local chat interface

chat_ui.py starts a local Python web server on 127.0.0.1 that proxies /v1/* requests to Token Lab with the API key attached. The key never reaches the browser. Launch the interface with make ui, which starts the chat page on port 8766.

The interface includes controls for max tokens, temperature, top-p, and a thinking switch. Each reply shows the first-token time, decode rate, token count, and points used. Image attachment sends data in the OpenAI image format. Thinking mode streams the model's reasoning into a collapsible section above the answer.

Terminal client

ask.py accepts piped input or interactive conversation. Piped material becomes the user message while arguments serve as instructions. Flags control thinking mode, image attachment, raw JSON output, and history clearing.

echo "Canberra is the capital of Australia." | ask-tokenlab translate to French

Google ADK agent

A small agent for Google's Agent Development Kit connects to Token Lab through LiteLLM's OpenAI provider. One model object routes all communication:

model = LiteLlm(
    model="openai/Gemma-4-31B-IT",
    api_base="https://api.tokenlab.amd.com/v1",
    api_key=TOKENLAB_API_KEY,
    num_retries=30,
    timeout=600,
    extra_body={"chat_template_kwargs": {"enable_thinking": False}})

The agent includes two tools. list_tokenlab_models returns the current catalog. count_and_range filters a number list and reports count, minimum, maximum, and sum. The agent can answer questions like "Which models on Token Lab use vLLM?" by calling the appropriate tool and quoting its exact result.

Performance benchmarks

One streamed request at a time from a laptop showed varying speeds. Without thinking enabled, decode rates ranged from 3.4 to 9.5 tokens per second. With thinking mode on, decode dropped to 1.98 tokens per second for a 390-token output (291 reasoning tokens). First-token latency varied from 1.2 to 5.0 seconds depending on service load.

The endpoint is shared among all Token Lab users. Gemma 4 31B carries a 128-request concurrent limit; exceeding it returns HTTP 429 with Retry-After: 1. The article's 23 requests represented a tiny fraction of this limit.

Token Lab versus other AMD options

The AMD AI Developer Program offers three credit tiers. Token Lab requires no credit request and provides immediate API access with a key. AMD Instinct Developer Cloud grants raw GPU access but needs a verification form. Fireworks AI offers managed endpoints after similar onboarding. Token Lab wins on speed of access, while the cloud options provide per-GPU performance when needed.

Summary of results

  • Joining the AMD AI Developer Program is free and Token Lab needs no credit request: a key comes with 10 points, 30 days and 20 requests per minute.
  • Gemma 4 31B answers text and images, with thinking, tools and a 262,144-token context, on the OpenAI API.
  • Everything in this article used 0.000335 of the 10 points over 23 requests.
  • The local chat page keeps the key on your machine and shows each reply's timings and points.
  • An ADK agent reaches Token Lab with one LiteLlm object and calls tools: it answered a counting question from a tool's exact result.
  • The endpoint is shared: one request decoded at 2.0 to 9.5 tokens per second, and the first token took up to 5 s.
  • Gemma 4 31B runs on SGLang behind Token Lab, and the GPU model is not published.
  • A request over the shared 128-request limit gets 429 and must be sent again; a stream cut off mid-reply cannot be retried automatically.