---
title: IBM: Granite 4.2 8B API | Text Generation | ModelsLab
description: Build with IBM: Granite 4.2 8B API by IBM Granite. Text generation, chat, code, and reasoning. Plans from $21/month.
url: https://modelslab.com/models/ibm-granite/ibm-granite-granite-4.2-8b.md
canonical: https://modelslab.com/models/ibm-granite/ibm-granite-granite-4.2-8b
type: product
component: Playground/LLM/Index
generated_at: 2026-09-03T09:44:40.446084Z
---

IBM: Granite 4.2 8B
---

 [LLMs.txt](https://modelslab.com/models/ibm-granite/ibm-granite-granite-4.2-8b/llms.txt) [.md](https://modelslab.com/models/ibm-granite/ibm-granite-granite-4.2-8b.md)

IBM: Granite 4.2 8B
---

Choose a prompt below to get started or type your own message

 Explain quantum computing in simple terms

 Write a Python function to sort a list

 Create a marketing email for a SaaS product

 Compare REST vs GraphQL APIs

text files

Send

### IBM: Granite 4.2 8B

ibm-granite ibm-granite-granite-4.2-8b

Copy model ID

PricingInput $0.10 / 1M tokens

Output $0.15 / 1M tokens

API EndpointsOpenAI Compatible

`https://modelslab.com/api/v7/llm/chat/completions`Endpoint

Anthropic Compatible

`https://modelslab.com/api/v7/llm/v1/messages`Messages

`https://modelslab.com/api/v7/llm/v1/messages/count_tokens`Count Tokens

`https://modelslab.com/api/v7/llm/v1/models`Models

Use with Claude Code

cURL Example

ParametersSystem MessageYou are a helpful AI assistant specialized in providing accurate and detailed responses.

Temperature0.7

Max Tokens4000

Top P0.9

Frequency Penalty0

Presence Penalty0

Thinkinglow

lowmediumhigh

Deeper thinking spends more of the Max Tokens budget before the answer starts.

Model Info

Support

Looking for something different?
---

Models that trade off differently against the one you are viewing

### Better quality

Newer flagship models that generally produce stronger results.

[![GPT 5.2](https://images.modelslab.sh/?Image=https://assets.modelslab.ai/generations/2bdd00f4-1692-49d8-a562-72cb1753d0ff.png)](https://modelslab.com/models/openai/gpt-5.2)[OpenAI](https://modelslab.com/models/openai)

 [GPT 5.2](https://modelslab.com/models/openai/gpt-5.2)

[![GPT 5.1](https://images.modelslab.sh/?Image=https://assets.modelslab.ai/generations/fad83520-47a8-4059-b4b9-b32adf4d0be7.png)](https://modelslab.com/models/openai/gpt5.1)[OpenAI](https://modelslab.com/models/openai)

 [GPT 5.1](https://modelslab.com/models/openai/gpt5.1)

[![Gemini 3 Pro Preview](https://images.modelslab.sh/?Image=https://assets.modelslab.ai/generations/1846e76f-9d5c-4a35-a43a-82db45b7bb8b.png)](https://modelslab.com/models/google/gemini-3-pro-preview)[Google](https://modelslab.com/models/google)

 [Gemini 3 Pro Preview](https://modelslab.com/models/google/gemini-3-pro-preview)

[![GPT-5.1-Codex-Max](https://images.modelslab.sh/?Image=https://assets.modelslab.ai/generations/06356c4c-df09-4ccb-a5c0-629da670f75b.png)](https://modelslab.com/models/openai/gpt-5.1-codex-max)[OpenAI](https://modelslab.com/models/openai)

 [GPT-5.1-Codex-Max](https://modelslab.com/models/openai/gpt-5.1-codex-max)

### Lower cost per run

Open-source models we host, unlimited on the $149/month plan.

[Modelslab: Custom LLM

Popular](https://modelslab.com/models/modelslab/uncensored-chat)[ModelsLab](https://modelslab.com/models/modelslab)

 [Modelslab: Custom LLM

Open Source Model](https://modelslab.com/models/modelslab/uncensored-chat)

[![gpt-oss-20b](https://images.modelslab.sh/?Image=https://assets.modelslab.ai/generations/8b2f0440-52cc-4f41-93eb-d31006ad71e2.webp)](https://modelslab.com/models/openai/gpt-oss-20b)[OpenAI](https://modelslab.com/models/openai)

 [gpt-oss-20b

Closed Source Model](https://modelslab.com/models/openai/gpt-oss-20b)

[![Gemma 3N E4B Instruct](https://images.modelslab.sh/?Image=https://assets.modelslab.ai/generations/b5ad4a07-e4eb-4d39-85d1-58ec000a8a4f.png)](https://modelslab.com/models/google/google-gemma-3n-E4B-it)[Google](https://modelslab.com/models/google_deepmind)

 [Gemma 3N E4B Instruct

Closed Source Model](https://modelslab.com/models/google/google-gemma-3n-E4B-it)

[Qwen3.5 35B A3b](https://modelslab.com/models/Qwen/Qwen-Qwen3.5-35B-A3B)[Qwen](https://modelslab.com/models/open_router)

 [Qwen3.5 35B A3b

Closed Source Model](https://modelslab.com/models/Qwen/Qwen-Qwen3.5-35B-A3B)

[![GPT OSS 120b](https://images.modelslab.sh/?Image=https://assets.modelslab.ai/generations/32ccebf4-aaac-46b2-af6a-b19d11fcf8fa.webp)](https://modelslab.com/models/openai/gpt-oss-120b)[OpenAI](https://modelslab.com/models/openai)

 [GPT OSS 120b

Closed Source Model](https://modelslab.com/models/openai/gpt-oss-120b)

[![Gemma 3 4b it](https://images.modelslab.sh/?Image=https://assets.modelslab.ai/generations/c419acdb-893e-4bda-ac4d-cec941648345.png)](https://modelslab.com/models/google/google-gemma-3-4b-it)[Google](https://modelslab.com/models/open_router)

 [Gemma 3 4b it

Closed Source Model](https://modelslab.com/models/google/google-gemma-3-4b-it)

Related Models
---

Discover similar models you might be interested in

 [View all LLM Models](https://modelslab.com/models?feature=llmaster)

[#### Mistral AI/Mistral: Saba

mistralai-mistral-saba

From $0.40/M tokens](https://modelslab.com/models/mistralai/mistralai-mistral-saba)

[#### Amazon/Amazon: Nova Micro 1.0

amazon-nova-micro-v1

From $0.09/M tokens](https://modelslab.com/models/amazon/amazon-nova-micro-v1)

[#### Anthropic/Anthropic Claude Sonnet Latest

anthropic-claude-sonnet-latest

From $6.00/M tokens](https://modelslab.com/models/anthropic/anthropic-claude-sonnet-latest)

[#### Baidu/Baidu: ERNIE 4.5 VL 424B A47B 

baidu-ernie-4.5-vl-424b-a47b

From $0.83/M tokens](https://modelslab.com/models/baidu/baidu-ernie-4.5-vl-424b-a47b)

[#### Google/Google: Gemini 3.1 Pro Preview Custom Tools

google-gemini-3.1-pro-preview-customtools

From $7.00/M tokens](https://modelslab.com/models/google/google-gemini-3.1-pro-preview-customtools)

[#### DeepSeek/DeepSeek: DeepSeek V3.1 Terminus

deepseek-deepseek-v3.1-terminus

From $0.64/M tokens](https://modelslab.com/models/deepseek/deepseek-deepseek-v3.1-terminus)

[#### Qwen/Qwen2-VL (72B) Instruct

Qwen-Qwen2-VL-72B-Instruct

From $1.20/M tokens](https://modelslab.com/models/qwen/Qwen-Qwen2-VL-72B-Instruct)

[#### Qwen/Qwen: Qwen3 VL 8B Thinking

qwen-qwen3-vl-8b-thinking

From $1.14/M tokens](https://modelslab.com/models/qwen/qwen-qwen3-vl-8b-thinking)

[#### Meta/Meta: Muse Spark 1.3

meta-muse-spark-1.3

From $2.75/M tokens](https://modelslab.com/models/meta/meta-muse-spark-1.3)

[#### Z.ai/Z.ai: GLM Latest

z-ai-glm-latest

From $2.29/M tokens](https://modelslab.com/models/z-ai/z-ai-glm-latest)

[#### Mistral AI/Mistral: Mistral Medium 3.5

mistralai-mistral-medium-3-5

From $4.50/M tokens](https://modelslab.com/models/mistralai/mistralai-mistral-medium-3-5)

[#### Z.ai/Z.ai: GLM 4.6

z-ai-glm-4.6

From $1.38/M tokens](https://modelslab.com/models/z-ai/z-ai-glm-4.6)

[#### NVIDIA/NVIDIA: Nemotron 3 Nano 30B A3B

nvidia-nemotron-3-nano-30b-a3b

From $0.13/M tokens](https://modelslab.com/models/nvidia/nvidia-nemotron-3-nano-30b-a3b)

[#### Google/Google: Gemini 2.5 Flash

google-gemini-2.5-flash

From $1.40/M tokens](https://modelslab.com/models/google/google-gemini-2.5-flash)

[#### Anthropic/Claude Opus 5

anthropic-claude-opus-5

From $15.00/M tokens](https://modelslab.com/models/anthropic/anthropic-claude-opus-5)

[#### Aion Labs/AionLabs: Aion-3.0

aion-labs-aion-3.0

From $4.50/M tokens](https://modelslab.com/models/aion-labs/aion-labs-aion-3.0)

[#### Google/Google: Gemini 3.7 Flash

google-gemini-3.7-flash

From $2.25/M tokens](https://modelslab.com/models/google/google-gemini-3.7-flash)

[#### Mistral AI/Mistral Large 2407

mistralai-mistral-large-2407

From $4.00/M tokens](https://modelslab.com/models/mistralai/mistralai-mistral-large-2407)

About IBM: Granite 4.2 8B
---

Granite 4.2 8B is a dense reasoning model from IBM. It is suited for mathematics, code generation, multilingual dialogue, and agentic workflows that need multi-step reasoning. It supports full, low-effort,...

### Technical Specifications

Model IDibm-granite-granite-4.2-8b

CategoryLLM Models

TaskText Generation

Price$0.125 per million tokens

AddedAugust 31, 2026

### Key Features

- Chat completion and multi-turn conversation API
- Streaming response with token-by-token output
- Function calling and tool use support
- System prompts and role-based messaging
- JSON mode and structured output

### Quick Start

Integrate IBM: Granite 4.2 8B into your application with a single API call. Get your API key from the [pricing page](https://modelslab.com/pricing) to get started.

PythonJavaScriptcURLPHP

```
<code>import requests
import json

url = "https://modelslab.com/api/v7/llm/chat/completions"

headers = {
    "Content-Type": "application/json"
}

data = {
        "model_id": "ibm-granite-granite-4.2-8b",
        "messages": [
            {
                "role": "user",
                "content": "Hello!"
            }
        ],
        "max_tokens": 1000,
        "key": "YOUR_API_KEY"
    }

try:
    response = requests.post(url, headers=headers, json=data)
    response.raise_for_status()  # Raises an HTTPError for bad responses (4XX or 5XX)
    result = response.json()
    print("API Response:")
    print(json.dumps(result, indent=2))
except requests.exceptions.HTTPError as http_err:
    print(f"HTTP error occurred: {http_err} - {response.text}")
except Exception as err:
    print(f"Other error occurred: {err}")</code>
```

### Pricing

IBM: Granite 4.2 8B API costs $0.125 per million tokens. Pay only for what you use with no minimum commitments. [View pricing plans](https://modelslab.com/pricing)

### Use Cases

- AI chatbots and virtual assistants
- Code generation and developer tools
- Content writing and copywriting automation
- Data analysis, summarization, and extraction

[Browse LLM Models](https://modelslab.com/models?feature=llmaster) [More from IBM Granite](https://modelslab.com/models/open_router) [View Pricing](https://modelslab.com/pricing)

IBM: Granite 4.2 8B FAQ
---

### What is IBM: Granite 4.2 8B?

Granite 4.2 8B is a dense reasoning model from IBM. It is suited for mathematics, code generation, multilingual dialogue, and agentic workflows that need multi-step reasoning. It supports full, low-effort,...

### How do I use the IBM: Granite 4.2 8B API?

You can integrate IBM: Granite 4.2 8B into your application with a single API call. Sign up on ModelsLab to get your API key, then use the model ID "ibm-granite-granite-4.2-8b" in your API requests. We provide SDKs for Python, JavaScript, and cURL examples in the API documentation.

### How much does IBM: Granite 4.2 8B cost?

IBM: Granite 4.2 8B costs $0.125 per million tokens. ModelsLab plans start at $21/month (Basic), and the $149/month Open Source plan includes unlimited generation on open-source models.

### What is the IBM: Granite 4.2 8B model ID?

The model ID for IBM: Granite 4.2 8B is "ibm-granite-granite-4.2-8b". Use this ID in your API requests to specify this model.

### Do I need a paid plan to use IBM: Granite 4.2 8B?

Yes. ModelsLab is subscription-based with no free tier — plans start at $21/month (Basic, 3,250 API calls). The $149/month Open Source Unlimited plan includes unlimited generation across open-source models; premium third-party models are billed per call from your wallet.

---

*This markdown version is optimized for AI agents and LLMs.*

**Links:**
- [Website](https://modelslab.com)
- [API Documentation](https://docs.modelslab.com)
- [Blog](https://modelslab.com/blog)

---
*Generated by ModelsLab - 2026-09-03*