Implementation:Helicone Helicone XAI Model Definitions
| Knowledge Sources | |
|---|---|
| Domains | Model Registry, Cost Calculation, LLM Providers |
| Last Updated | 2026-02-14 06:32 GMT |
Overview
A model configuration registry defining the xAI Grok model family with their capabilities, context lengths, and modality support for use in Helicone's cost calculation and model metadata systems.
Description
The xai/models.ts module exports a models record containing configuration entries for eight xAI Grok model variants. Each entry conforms to the ModelConfig interface and specifies the model's display name, author ("xai"), description, context length, maximum output tokens, creation date, input/output modalities, and tokenizer ("Grok").
The model family spans:
- grok-code-fast-1: Specialized coding model (256K context)
- grok-4: Flagship general-purpose model (256K context)
- grok-4-fast-reasoning / grok-4-fast-non-reasoning: Cost-efficient variants with 2M token context windows
- grok-4-1-fast-reasoning / grok-4-1-fast-non-reasoning: Next-generation agentic tool-calling models (2M context)
- grok-3 / grok-3-mini: Previous generation models (131K context)
Multimodal support varies across models, with newer variants accepting image and audio inputs alongside text.
The module also exports the GrokModelName type, a union of all valid model key strings.
Usage
This configuration is consumed by the Helicone model registry to provide model metadata, enable cost calculations, and display model information in the dashboard.
Code Reference
Source Location
- Repository: Helicone
- File: packages/cost/models/authors/xai/models.ts
Signature
import { ModelConfig } from "../../types";
export const models: Record<string, ModelConfig> = {
"grok-code-fast-1": { ... },
"grok-4": { ... },
"grok-4-fast-reasoning": { ... },
"grok-4-fast-non-reasoning": { ... },
"grok-4-1-fast-non-reasoning": { ... },
"grok-4-1-fast-reasoning": { ... },
"grok-3": { ... },
"grok-3-mini": { ... },
} satisfies Record<string, ModelConfig>;
export type GrokModelName = keyof typeof models;
Import
import { models, GrokModelName } from "@helicone/cost/models/authors/xai/models";
I/O Contract
| Model ID | Context Length | Max Output Tokens | Modalities (Input) | Modalities (Output) |
|---|---|---|---|---|
grok-code-fast-1
|
256,000 | 10,000 | text | text |
grok-4
|
256,000 | 256,000 | text | text |
grok-4-fast-reasoning
|
2,000,000 | 2,000,000 | text, image | text |
grok-4-fast-non-reasoning
|
2,000,000 | 2,000,000 | text, image, audio | text |
grok-4-1-fast-non-reasoning
|
2,000,000 | 30,000 | text, image | text, image |
grok-4-1-fast-reasoning
|
2,000,000 | 2,000,000 | text, image | text |
grok-3
|
131,072 | 131,072 | text | text |
grok-3-mini
|
131,072 | 131,072 | text | text |
| Field | Type | Description |
|---|---|---|
name
|
string
|
Human-readable model display name |
author
|
string
|
Model creator identifier ("xai") |
description
|
string
|
Detailed description of capabilities |
contextLength
|
number
|
Maximum input context window in tokens |
maxOutputTokens
|
number
|
Maximum output generation length in tokens |
created
|
string
|
ISO 8601 creation date |
modality
|
{ inputs: string[], outputs: string[] }
|
Supported input and output modalities |
tokenizer
|
string
|
Tokenizer type ("Grok") |
Usage Examples
import { models, GrokModelName } from "@helicone/cost/models/authors/xai/models";
// Access a specific model configuration
const grok4 = models["grok-4"];
console.log(grok4.contextLength); // 256000
console.log(grok4.modality.inputs); // ["text"]
// Type-safe model name
const modelName: GrokModelName = "grok-4-fast-reasoning";
const config = models[modelName];
console.log(config.maxOutputTokens); // 2000000
// Iterate over all xAI models
for (const [id, config] of Object.entries(models)) {
console.log(`${id}: ${config.name} (${config.contextLength} tokens)`);
}