TensaHub › Hugging Face Inference

granite-4.2-8b · CoreWeave

API for the model ibm-granite/granite-4.2-8b:coreweave at Hugging Face Inference, $0.06 / $0.15 per million tokens, context 131,072 tokens. curl, Python and JavaScript samples, live testing.

Test and rate in the catalog

ibm-granite/granite-4.2-8b served by CoreWeave through the Hugging Face router (bf16 quantization).

Type
Model
Provider
Hugging Face Inference
Host
CoreWeave
Model ID
ibm-granite/granite-4.2-8b:coreweave
Pricing
Paid
Input / output price
$0.06 / $0.15 per million tokens
Keyless access
No
Key variable
HF_TOKEN
Base URL (OpenAI-compatible)
https://router.huggingface.co/v1
Context
131,072 tokens
Inputs
Text
Features
Tool calling, JSON output
Response time
First token 214 ms · 54 tokens/s · uptime 99.9%
Developer rating
Not rated yet
Documentation
https://huggingface.co/ibm-granite/granite-4.2-8b

Code samples

cURL

curl https://router.huggingface.co/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $HF_TOKEN" \
  -d '{"model":"ibm-granite/granite-4.2-8b:coreweave","messages":[{"role":"user","content":"Hello, introduce yourself in one sentence."}]}'

Python

# pip install openai
import os
from openai import OpenAI

client = OpenAI(base_url="https://router.huggingface.co/v1", api_key=os.environ["HF_TOKEN"])
r = client.chat.completions.create(
    model="ibm-granite/granite-4.2-8b:coreweave",
    messages=[{"role": "user", "content": "Hello, introduce yourself in one sentence."}],
)
print(r.choices[0].message.content)

JavaScript

// npm install openai
import OpenAI from 'openai'

const client = new OpenAI({ baseURL: 'https://router.huggingface.co/v1', apiKey: process.env.HF_TOKEN })
const r = await client.chat.completions.create({
  model: 'ibm-granite/granite-4.2-8b:coreweave',
  messages: [{ role: 'user', content: 'Hello, introduce yourself in one sentence.' }],
})
console.log(r.choices[0].message.content)

Generate the integration code →

Popular searches

Frequently asked questions

Is the granite-4.2-8b · CoreWeave API free?

No: granite-4.2-8b · CoreWeave is a paid API ($0.06 / $0.15 per million tokens).

How do I call granite-4.2-8b · CoreWeave from my code?

granite-4.2-8b · CoreWeave exposes an OpenAI-compatible API at https://router.huggingface.co/v1: use any OpenAI SDK (Python, JavaScript…) with this base URL. Model identifier: ibm-granite/granite-4.2-8b:coreweave. Ready-to-use code (streaming, JSON, retries) is available in the developer toolkit.

What is the context window of granite-4.2-8b · CoreWeave?

granite-4.2-8b · CoreWeave accepts up to 131,072 tokens of context (prompt and history).

What are the alternatives to granite-4.2-8b · CoreWeave?

Similar APIs listed in the catalog: IBM: Granite 4.2 8B.

Alternatives