DeepInfra raises $107M Series B to scale the inference cloud — read the announcement

Granite 4.2 8B: Model Overview & Integration Guide

Published on 2026.10.21 by DeepInfra
Granite 4.2 8B: Model Overview & Integration Guide

Granite 4.2 8B is an 8-billion-parameter dense transformer reasoning model developed by IBM. As the mid-size member of the Granite 4.2 family, it balances reasoning depth with operational efficiency.

Released under the Apache 2.0 license, the model is built for complex reasoning, code generation, tool calling, and structured data output.

Its defining feature is native chain-of-thought reasoning. Granite 4.2 8B performs step-by-step logical processing inside <think>…</think> tags before producing a final answer.

This supports applications that need deep logic, such as mathematical problem solving, agentic workflows, and software engineering tasks.

Capabilities and Performance

Native Reasoning and Flexible Thinking Modes

To give developers control over latency and computational depth, the model supports three thinking modes that can be toggled on a per-query basis:

  • Full Thinking (default): maximizes reasoning depth for complex queries and generates comprehensive chain-of-thought tokens
  • Low-Effort Thinking: provides brief reasoning for simpler queries, reducing time to first token
  • Non-Thinking: disables the reasoning phase entirely for the lowest possible latency

Benchmarks

The model has been tested across reasoning, knowledge, instruction following, and coding tasks:

CategoryBenchmarkScoreMetric
ReasoningAIME 202586.67Accuracy
ReasoningGPQA64.14Accuracy
KnowledgeMMLU-Pro74.04Accuracy
Instruction FollowingArena-Hard-V265.19Score
CodingSWE-Bench Verified47.67Resolved Issues

Compared to Granite 4.2 3B, the 8B variant offers greater reasoning depth. Compared to the 30B flagship, it remains more resource-efficient, making it a middle option for enterprise deployments.

Context Window and Multilingual Support

Granite 4.2 8B natively supports a 128K token context window, extendable to 512K tokens for long-context tasks.

This makes it capable of analyzing long documents and large codebases.

The model officially supports 12 languages, including English, French, Japanese, Arabic, Spanish, and Chinese.

Getting Started With the API

Granite 4.2 8B is hosted on DeepInfra, with an OpenAI-compatible interface for integration into existing workflows.

Authentication

The API requires a DeepInfra API key. Include it in the HTTP Authorization header as a bearer token:

Authorization: Bearer <YOUR_DEEPINFRA_API_KEY>

Content-Type: application/json

API Endpoint Basics

  • Base URL: https://api.deepinfra.com/v1/openai
  • Path: /chat/completions
  • Model Identifier: ibm-granite/granite-4.2-8b

cURL Example

curl -X POST "https://api.deepinfra.com/v1/openai/chat/completions" \

  -H "Authorization: Bearer $DEEPINFRA_API_KEY" \

  -H "Content-Type: application/json" \

  -d '{

    "model": "ibm-granite/granite-4.2-8b",

    "messages": [

      {"role": "user", "content": "Solve: If a store sells 12 pens for $18, how much do 30 pens cost?"}

    ],

    "temperature": 0.7

  }'
copy

Python Example

import os

import requests

api_key = os.environ.get("DEEPINFRA_API_KEY")

url = "https://api.deepinfra.com/v1/openai/chat/completions"

payload = {

    "model": "ibm-granite/granite-4.2-8b",

    "messages": [

        {"role": "system", "content": "Be a helpful assistant."},

        {"role": "user", "content": "Write a Python function to check if a string is a palindrome."}

    ],

    "temperature": 0.7,

    "max_tokens": 1024

}

response = requests.post(url, headers={"Authorization": f"Bearer {api_key}"}, json=payload)

print(response.json())
copy

Configuration and Parameters

The API supports the following parameters to fine-tune model behavior:

ParameterTypeDefaultDescription
max_tokensintegernot setMaximum new tokens to generate, capped by the model’s context length
temperaturefloat1Controls randomness (0 is deterministic, higher is more creative)
top_pfloat1Nucleus sampling probability cutoff
repetition_penaltyfloat1Discourages repetitive text generation
stoparraynot setSequences that halt token generation
response_formatobjecttextSet to json_object or json_schema for structured JSON output
tools / tool_choicearray / stringnot setDefines callable functions and controls tool invocation
prompt_cache_keystringnot setExplicit key for reusing cached prompt state across requests

The tools / tool_choice parameters are what make tool calling work: the model decides which function to invoke and supplies arguments that match its schema.

The response_format parameter is how you request reliable structured data output instead of free-form text.

Response Format

Because Granite 4.2 8B is a reasoning model, the content field in the response includes the reasoning steps followed by the final answer:

{

  "choices": [

    {

      "message": {

        "role": "assistant",

        "content": "<think>\n12 pens cost $18, so 1 pen is $1.50. 30 * $1.50 = $45.\n</think>\n30 pens will cost $45."

      }

    }

  ]

}
copy

Pricing and Usage

DeepInfra prices Granite 4.2 8B on a per-token basis:

  • Input tokens: $0.06 per 1 million tokens
  • Output tokens: $0.25 per 1 million tokens
  • Prompt caching: $0.015 per 1 million cached tokens, which reduces costs for repeated system prompts or large context windows

Private endpoint deployments and dedicated hosting are available for high-volume enterprise needs.

Technical Background

Granite 4.2 8B was post-trained from Granite 4.1 8B Base using a three-stage pipeline. The final stage used Group Relative Policy Optimization, a reinforcement learning technique, run on an NVIDIA GB200 NVL72 cluster.

This training supports what IBM calls reasoning-augmented tool calling, where the model reasons about which tool to use and why it fits the task.

Related Models on DeepInfra

Granite 4.2 8B sits alongside other efficient models on DeepInfra that handle tool calling and agentic workloads:

  • Gemma 4 26B A4B IT: a mixture-of-experts model with 25.2B total and 3.8B active parameters. It offers a 262,144-token context window and supports JSON output, function calling, and multimodal input
  • Qwen3.6-35B-A3B: a multimodal mixture-of-experts model with 35B total and 3B active parameters and a native 262,144-token context window
  • GLM-5.3-Flash: a natively multimodal model with a 1,048,576-token context window and support for JSON output and function calling
  • DeepSeek-V4-Flash-0731: a model with a 1,048,576-token context window and support for JSON output and function calling

Conclusion

Granite 4.2 8B bridges lightweight efficiency and deep logical processing. Its native chain-of-thought, large context window, and flexible thinking modes make it a fit for agentic workflows and enterprise coding tasks.

Key takeaways:

  • Reasoning: strong scores on AIME 2025 and SWE-Bench Verified
  • Flexibility: toggle between full reasoning and low-latency modes
  • Cost: usage-based pricing with prompt caching discounts

Get an API key and try Granite 4.2 8B on DeepInfra.

Related articles
GLM-5.3 Model Overview & Integration GuideGLM-5.3 Model Overview & Integration Guide<p>GLM-5.3 is a large-scale reasoning model from Z.ai, built for complex software engineering and long-horizon agent tasks. It handles text input and output across a 1,048,576-token context window, and is one of several hundred models in DeepInfra’s catalog. The model uses the same base as GLM-5.2. Every gain comes from post-training, which is where Z.ai [&hellip;]</p>
From Precision to Quantization: A Practical Guide to Faster, Cheaper LLMsFrom Precision to Quantization: A Practical Guide to Faster, Cheaper LLMs<p>Large language models live and die by numbers—literally trillions of them. How finely we store those numbers (their precision) determines how much memory a model needs, how fast it runs, and sometimes how good its answers are. This article walks from the basics to the deep end: we’ll start with how computers even store a [&hellip;]</p>
Data Sovereignty AI: Why Open-Weight Models MatterData Sovereignty AI: Why Open-Weight Models Matter<p>The prototype worked. The demo landed. Then the security questionnaire shows up, and question 41 asks which legal entity can be compelled to produce the contents of your prompts. That one question stalls more AI rollouts than latency or accuracy ever have. Inside hospitals, banks, law firms, and defense subcontractors, data sovereignty AI requirements have [&hellip;]</p>