{"slug":"granite-4.2-8b","name":"Granite 4.2 8B","family":"ibm","family_name":"IBM","developer":"IBM","color":"#ff00b2","status":"active","released":"2026-08-25","snapshot_of":null,"open":true,"context":131072,"max_output":117964,"knowledge_cutoff":null,"modalities":["text"],"output_modalities":["text"],"reasoning":true,"tools":true,"structured_output":true,"huggingface":"ibm-granite/granite-4.2-8b","speed":87.5,"latency":0.23,"short":"IBM's open-weight 8B text model, released August 2026, priced among the cheapest in the registry. It stands out for cost and tool support, but has one benchmark result, which ranks near the bottom.","strengths":["Blended price of $0.08 per million tokens, 2nd cheapest of 194 models","Open weights with tool calling, reasoning mode and structured output","131k context window for text input","Input costs $0.06 and output costs $0.15 per million tokens"],"weaknesses":["LMArena text score of 1318.5, 113th of 114, median 1437.6","Only one benchmark result, so overall quality is largely unmeasured","Served by a single provider, OpenRouter"],"best_for":"High-volume, low-cost agents needing tool calling and structured output, where top chat quality is not required.","long":"Granite 4.2 8B is IBM's open-weight 8B model, released August 2026. It accepts text only, has a 131k context window, and supports tool calling, reasoning mode and structured output. Its clearest advantage is price: $0.06 per million input tokens and $0.15 per million output tokens, the second-lowest blended price among 194 models.\n\nThe only benchmark result is LMArena text, where it scores 1318.5 and ranks 113th of 114, well below the median of 1437.6. With so little measured quality, a team should test it on its own tasks before relying on it. It is offered by one provider, OpenRouter, and its popularity rank is 142 of 194.\n\nIt fits low-cost, high-volume work where tool calling and structured output matter more than general conversational quality, such as classification, extraction or routing steps in an agent pipeline.","described":true,"gateway":false,"byok":true,"string":"openrouter:ibm-granite/granite-4.2-8b","input":0.06,"output":0.15,"cache_read":0.015,"blended":0.0825,"efficiency":null,"bench":{"lmarena":1318.5},"offers":[{"provider":"openrouter","name":"OpenRouter","model_id":"ibm-granite/granite-4.2-8b","api":["openai"],"input":0.06,"output":0.15,"cache_read":0.015,"cache_write":null,"input_tiers":[],"output_tiers":[],"context":131072,"deprecated":false,"gateway":false,"gateway_route":null,"byok":true,"string":"openrouter:ibm-granite/granite-4.2-8b","gateway_string":null}],"ranks":{"intelligence":null,"popularity":142,"efficiency":null,"speed":53,"price":2},"top_score":0.1143,"about":["IBM's open-weight 8B text model, released August 2026, priced among the cheapest in the registry. It stands out for cost and tool support, but has one benchmark result, which ranks near the bottom.","Granite 4.2 8B is IBM's open-weight 8B model, released August 2026. It accepts text only, has a 131k context window, and supports tool calling, reasoning mode and structured output. Its clearest advantage is price: $0.06 per million input tokens and $0.15 per million output tokens, the second-lowest blended price among 194 models.","The only benchmark result is LMArena text, where it scores 1318.5 and ranks 113th of 114, well below the median of 1437.6. With so little measured quality, a team should test it on its own tasks before relying on it. It is offered by one provider, OpenRouter, and its popularity rank is 142 of 194.","It fits low-cost, high-volume work where tool calling and structured output matter more than general conversational quality, such as classification, extraction or routing steps in an agent pipeline."],"examples":[{"file":"hello.py","lang":"python","code":"# /// script\n# dependencies = [\"pydantic-ai\"]\n# ///\nimport os\n\nfrom pydantic_ai import Agent\n\nos.environ['OPENROUTER_API_KEY'] = '...'\n\nagent = Agent('openrouter:ibm-granite/granite-4.2-8b', instructions='Be concise, reply with one sentence.')\n\nresult = agent.run_sync('Where does \"hello world\" come from?')\nprint(result.output)","soon":false},{"file":"structured_output.py","lang":"python","code":"# /// script\n# dependencies = [\"pydantic-ai\"]\n# ///\nimport os\n\nfrom pydantic import BaseModel\nfrom pydantic_ai import Agent\n\nos.environ['OPENROUTER_API_KEY'] = '...'\n\n\nclass CityLocation(BaseModel):\n    city: str\n    country: str\n\n\nagent = Agent('openrouter:ibm-granite/granite-4.2-8b', output_type=CityLocation)\n\nresult = agent.run_sync('Where were the olympics held in 2012?')\nprint(result.output)\n#> city='London' country='United Kingdom'","soon":false},{"file":"tools.py","lang":"python","code":"# /// script\n# dependencies = [\"pydantic-ai\"]\n# ///\nimport os\nimport random\n\nfrom pydantic_ai import Agent, RunContext\n\nos.environ['OPENROUTER_API_KEY'] = '...'\n\nagent = Agent(\n    'openrouter:ibm-granite/granite-4.2-8b',\n    deps_type=str,\n    instructions=\"You're a dice game, roll the die and see if it matches the user's guess.\",\n)\n\n\n@agent.tool_plain\ndef roll_dice() -> str:\n    \"\"\"Roll a six-sided die and return the result.\"\"\"\n    return str(random.randint(1, 6))\n\n\n@agent.tool\ndef get_player_name(ctx: RunContext[str]) -> str:\n    \"\"\"Get the player's name.\"\"\"\n    return ctx.deps\n\n\nresult = agent.run_sync('My guess is 4', deps='Anne')\nprint(result.output)","soon":false},{"file":"streaming.py","lang":"python","code":"# /// script\n# dependencies = [\"pydantic-ai\"]\n# ///\nimport asyncio\nimport os\n\nfrom pydantic_ai import Agent\n\nos.environ['OPENROUTER_API_KEY'] = '...'\n\nagent = Agent('openrouter:ibm-granite/granite-4.2-8b')\n\n\nasync def main():\n    async with agent.run_stream('Explain prompt caching in three bullet points.') as response:\n        async for text in response.stream_text(delta=True):\n            print(text, end='', flush=True)\n\n\nasyncio.run(main())","soon":false},{"file":"pax.sh","lang":"sh","code":"export OPENROUTER_API_KEY='...'\n\nuvx pax --model 'openrouter:ibm-granite/granite-4.2-8b'","soon":true},{"file":"pi.sh","lang":"sh","code":"# npm install -g @earendil-works/pi-coding-agent\nexport OPENROUTER_API_KEY='...'\n\npi --model 'openrouter/ibm-granite/granite-4.2-8b'","soon":false},{"file":"codex.sh","lang":"sh","code":"# npm install -g @openai/codex\nexport OPENROUTER_API_KEY='...'\n\ncodex --model 'ibm-granite/granite-4.2-8b' \\\n  -c model_provider='openrouter' \\\n  -c model_providers.openrouter.name='OpenRouter' \\\n  -c model_providers.openrouter.base_url='https://api.openrouter.example/v1' \\\n  -c model_providers.openrouter.env_key='OPENROUTER_API_KEY'","soon":false},{"file":"ai_sdk.ts","lang":"ts","code":"// npm install ai @ai-sdk/openai-compatible\nimport { createOpenAICompatible } from '@ai-sdk/openai-compatible'\nimport { generateText } from 'ai'\n\nprocess.env.OPENROUTER_API_KEY = '...'\n\nconst openrouter = createOpenAICompatible({\n  name: 'openrouter',\n  baseURL: 'https://api.openrouter.example/v1',\n  apiKey: process.env.OPENROUTER_API_KEY,\n})\n\nconst { text } = await generateText({\n  model: openrouter('ibm-granite/granite-4.2-8b'),\n  system: 'Be concise, reply with one sentence.',\n  prompt: 'Where does \"hello world\" come from?',\n})\nconsole.log(text)","soon":false}],"benchmarks":[{"id":"lmarena","name":"LMArena text","unit":"","desc":"Rating from blind human votes between pairs of chat responses","category":"preference","floor":1100,"ceiling":1600,"url":"https://lmarena.ai/leaderboard/text","credit":"LMArena (CC BY 4.0)"}],"generated":"2026-11-25","gaps":{"speed":3,"index":80,"description":0}}