IBM Granite Code ($0.025)
ibm_granite_codeGenerate, review, refactor, explain, test, or document source code using IBM Granite instruct models, with USDC pay-per-call access and no IBM Cloud account.
Instructions
Code generation, review, refactoring, and explanation via IBM Granite instruct models. Provide a task type and code/prompt; receive the generated or reviewed code with explanation. Use this when the input is source code or a request to write code; for general conversation call ibm_granite_chat instead. No IBM Cloud account required — pay $0.025 USDC per call via x402.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"task": "<task>",
"prompt": "<prompt>"
},
"name": "ibm_granite_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task | Yes | Code task: generate (new code from description), review (bugs/security), refactor (quality), explain (plain language), test (unit tests), or document (add docstrings). | |
| prompt | Yes | For "generate": describe what to build. For all others: paste the code to process. | |
| context | No | Additional context: architecture notes, constraints, or example usage. | |
| language | No | Target programming language (e.g. "TypeScript", "Python", "Rust"). Optional for explain/review. |