API des Modells ibm-granite/granite-4.2-8b bei OpenRouter, $0.06 / $0.15 pro Million Tokens, Kontext 131.072 Tokens. Beispiele in curl, Python und JavaScript, Live-Test.
Im Katalog testen und bewerten
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,...
- Typ
- Modell
- Anbieter
- OpenRouter
- Modell-ID
ibm-granite/granite-4.2-8b- Preis
- Kostenpflichtig
- Preis Eingabe / Ausgabe
- $0.06 / $0.15 pro Million Tokens
- Zugang ohne Schlüssel
- Nein
- Schlüsselvariable
OPENROUTER_API_KEY- Basis-URL (OpenAI-kompatibel)
https://openrouter.ai/api/v1- Kontext
- 131.072 Tokens
- Eingaben
- Text
- Funktionen
- Reasoning, JSON-Ausgabe, Tool-Aufrufe
- Entwicklerbewertung
- Noch nicht bewertet
- Dokumentation
- https://openrouter.ai/ibm-granite/granite-4.2-8b
Codebeispiele
cURL
curl https://openrouter.ai/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-d '{"model":"ibm-granite/granite-4.2-8b","messages":[{"role":"user","content":"Hallo, stell dich in einem Satz vor."}]}'Python
# pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key=os.environ["OPENROUTER_API_KEY"])
r = client.chat.completions.create(
model="ibm-granite/granite-4.2-8b",
messages=[{"role": "user", "content": "Hallo, stell dich in einem Satz vor."}],
)
print(r.choices[0].message.content)JavaScript
// npm install openai
import OpenAI from 'openai'
const client = new OpenAI({ baseURL: 'https://openrouter.ai/api/v1', apiKey: process.env.OPENROUTER_API_KEY })
const r = await client.chat.completions.create({
model: 'ibm-granite/granite-4.2-8b',
messages: [{ role: 'user', content: 'Hallo, stell dich in einem Satz vor.' }],
})
console.log(r.choices[0].message.content)
Beliebte Suchen
Häufige Fragen
Ist die API von IBM: Granite 4.2 8B kostenlos?
Nein: IBM: Granite 4.2 8B ist eine kostenpflichtige API ($0.06 / $0.15 pro Million Tokens).
Wie rufe ich IBM: Granite 4.2 8B aus meinem Code auf?
IBM: Granite 4.2 8B bietet eine OpenAI-kompatible API unter https://openrouter.ai/api/v1: Verwenden Sie ein beliebiges OpenAI-SDK (Python, JavaScript …) mit dieser Basis-URL. Modellkennung: ibm-granite/granite-4.2-8b. Fertiger Code (Streaming, JSON, Wiederholungen) steht im Werkzeugkasten für Entwickler bereit.
Wie groß ist das Kontextfenster von IBM: Granite 4.2 8B?
IBM: Granite 4.2 8B verarbeitet bis zu 131.072 Tokens Kontext (Nachricht und Verlauf).
Welche Alternativen gibt es zu IBM: Granite 4.2 8B?
Ähnliche APIs im Katalog: granite-4.2-8b · CoreWeave.
Alternativen
- granite-4.2-8b · CoreWeave — Kostenpflichtig