[Integrations](https://spiral.ai/integrations) › [goose](https://spiral.ai/integrations/goose) › [Gemma 4 31B](https://spiral.ai/integrations/goose/gemma-4-31b)

# How to Use Gemma 4 31B in goose

Gemma 4 31B suits code fixes, complex questions, and analysis of long documents. Google positions its dense architecture for answer quality, while Gemma 4 26B A4B prioritizes speed.

|  |  |
| --- | --- |
| Model | Gemma 4 31B |
| Available through | OpenRouter |
| Category | LLM |
| Price | Up to $0.00214 per run at the default inputs. $0.26 per 1M input tokens, $0.52 per 1M output tokens. |
| Returns | text, json |
| Runs | In the background |
| Setup | About 2 minutes, no API key |

## Prompts to try with Gemma 4 31B in goose

- Use Gemma 4 31B with thinking enabled to trace the failing test through the relevant project files. Propose the smallest fix, apply it, and run the affected tests.
- Use Gemma 4 31B to compare the API implementation with the project's documentation. List mismatches with file locations and propose corrections.
- Use Gemma 4 31B to review the current diff for incorrect assumptions and missing edge cases. Return findings with file locations, evidence, and suggested regression checks.
- Use Gemma 4 31B to explain the request path through this repository. Identify entry points, validation, state changes, and error handling, citing the relevant files.
- Use Gemma 4 31B to draft a migration plan from the project's current implementation to the behavior described in its issue. Check dependencies and return ordered steps with verification criteria.

## How to set up Gemma 4 31B in goose

Pick the way that suits you. Each takes about two minutes.

### Use Spiral's MCP server

1. **Add the extension**: In goose Desktop, open the sidebar, click Extensions, then Add custom extension. Enter:

2. **Sign in**: When goose first connects to Spiral, your browser opens. Sign in to Spiral, pick the organization and click Authorize. No API key. If the browser does not open, goose prints the link to open yourself.

### Use the Spiral skill

1. **Send goose this message**: Your agent reads Spiral's skill and sets itself up.

```
set up https://spiral.ai/SKILL.md
```

2. **Sign in or paste a key**: Approve Spiral in the browser, or give the agent a key from the console.

### Use the Spiral CLI

1. **Install and sign in**: Installs the Spiral CLI, signs you in and adds its skill to your coding agents.

```bash
npx -y spiral-cli@latest init
```

### Call the Spiral API

1. **Create an API key**: In the console, under API keys.

2. **Run Gemma 4 31B**: One request; the result comes back by polling or a webhook.

```bash
curl https://api.spiral.ai/v1/runs \
  -H "Authorization: Bearer $SPIRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "provider": "openrouter",
    "model": "google/gemma-4-31b-it",
    "input": {
      "messages": [
        {
          "role": "system"
        }
      ]
    }
  }'
```

Then paste one of the prompts above: goose finds Gemma 4 31B on Spiral, shows the price and runs it.

Setup guide in the docs: https://spiral.ai/docs/quickstarts/goose

## Gemma 4 31B tools and prices

- [Google: Gemma 4 31B](https://spiral.ai/tools/openrouter/google/gemma-4-31b-it) (OpenRouter): Up to $0.00214 per run at the default inputs. $0.26 per 1M input tokens, $0.52 per 1M output tokens.

## Settings you can ask for

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| seed |  | — |  |
| stop |  | — |  |
| min_p | 0 to 1 | — |  |
| tools |  | — |  |
| top_k | 0 to … | — |  |
| top_p | 0 to 1 | — |  |

## What can you do with Gemma 4 31B in goose?

Turn project code and documentation into proposed fixes, explanations, and review findings with Gemma 4 31B. Have the coding agent inspect relevant files and verify proposed changes with the project's checks.

### Diagnose a code defect

Ask Gemma 4 31B to trace a failing path, propose a small correction, and suggest a regression check.

### Compare long documents

Use Gemma 4 31B to compare requirements, identify contradictions, and attach supporting passages to each finding.

### Extract structured records

Ask Gemma 4 31B to turn supplied text into JSON records, using null when information is absent.

### Draft multilingual responses

Use Gemma 4 31B to draft replies in a requested language while preserving names and approved terminology.

### Summarize research

Ask Gemma 4 31B to condense supplied research into findings, disagreements, and unanswered questions.

### Check a plan against constraints

Give Gemma 4 31B a proposed plan and explicit constraints, then request conflicts and a revised sequence.

### Answer questions from reference text

Use Gemma 4 31B to draft answers grounded in supplied reference material, with evidence for each conclusion.

## Overview

- [OpenRouter](https://spiral.ai/providers/openrouter)
- [All goose guides](https://spiral.ai/integrations/goose)

## Gemma 4 31B in other agents

- [Amp](https://spiral.ai/integrations/amp/gemma-4-31b)
- [ChatGPT](https://spiral.ai/integrations/chatgpt/gemma-4-31b)
- [Claude](https://spiral.ai/integrations/claude-desktop/gemma-4-31b)
- [Claude Code](https://spiral.ai/integrations/claude-code/gemma-4-31b)
- [Cline](https://spiral.ai/integrations/cline/gemma-4-31b)
- [Codex](https://spiral.ai/integrations/codex/gemma-4-31b)
- [Cursor](https://spiral.ai/integrations/cursor/gemma-4-31b)
- [Devin](https://spiral.ai/integrations/devin/gemma-4-31b)
- [dots](https://spiral.ai/integrations/dots/gemma-4-31b)
- [Factory Droid](https://spiral.ai/integrations/factory-droid/gemma-4-31b)
- [Gemini](https://spiral.ai/integrations/gemini/gemma-4-31b)
- [Gemini CLI](https://spiral.ai/integrations/gemini-cli/gemma-4-31b)
- [Google Antigravity](https://spiral.ai/integrations/antigravity/gemma-4-31b)
- [Grok](https://spiral.ai/integrations/grok/gemma-4-31b)
- [Grok Build](https://spiral.ai/integrations/grok-build/gemma-4-31b)
- [Hermes](https://spiral.ai/integrations/hermes/gemma-4-31b)
- [Instinct](https://spiral.ai/integrations/instinct/gemma-4-31b)
- [Manus](https://spiral.ai/integrations/manus/gemma-4-31b)
- [Muse](https://spiral.ai/integrations/muse/gemma-4-31b)
- [Muse Code](https://spiral.ai/integrations/muse-code/gemma-4-31b)
- [n8n](https://spiral.ai/integrations/n8n/gemma-4-31b)
- [Notion](https://spiral.ai/integrations/notion/gemma-4-31b)
- [OpenClaw](https://spiral.ai/integrations/openclaw/gemma-4-31b)
- [opencode](https://spiral.ai/integrations/opencode/gemma-4-31b)
- [Perplexity](https://spiral.ai/integrations/perplexity/gemma-4-31b)
- [Raycast](https://spiral.ai/integrations/raycast/gemma-4-31b)
- [VS Code](https://spiral.ai/integrations/vscode/gemma-4-31b)
- [Windsurf](https://spiral.ai/integrations/windsurf/gemma-4-31b)
- [Zapier](https://spiral.ai/integrations/zapier/gemma-4-31b)

## More goose guides

- [Gemma 4 26B A4B](https://spiral.ai/integrations/goose/gemma-4-26b-a4b)
- [Granite 4.2 8B](https://spiral.ai/integrations/goose/granite-4-2-8b)
- [Gemma 3 4B](https://spiral.ai/integrations/goose/gemma-3-4b)
- [Grok 4.20](https://spiral.ai/integrations/goose/grok-4-20)
- [Gemma 3 27B IT](https://spiral.ai/integrations/goose/gemma-3-27b-it)
- [Grok 4.20 Multi-Agent](https://spiral.ai/integrations/goose/grok-4-20-multi-agent)

## Questions about Gemma 4 31B in goose

**Can goose use Gemma 4 31B?**

Yes. Add Spiral to goose as an MCP server, and goose can find and run Gemma 4 31B like any built-in tool.

**How much does Gemma 4 31B cost in goose?**

Up to $0.00214 per run at the default inputs. $0.26 per 1M input tokens, $0.52 per 1M output tokens. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your goose plan is separate.

**Do I need an OpenRouter account to use Gemma 4 31B in goose?**

No. Spiral runs Gemma 4 31B on its own OpenRouter account. You sign in to Spiral once and never paste a key.

**How long does it take to set up Gemma 4 31B in goose?**

About two minutes: add the extension, then sign in.

**Does goose wait while Gemma 4 31B runs?**

Gemma 4 31B runs in the background. goose starts the run, checks on it and gives you the text, json when it's ready.

**What is Gemma 4 31B useful for?**

Use it for code fixes, questions that require reasoning, summaries of long documents, and extracting information into JSON. Google positions the dense 31B model for answer quality.

**How much context can Gemma 4 31B handle?**

Google specifies a model context window of up to 256K tokens. That describes context capacity, not the length of a single answer.

**Can Gemma 4 31B work in languages other than English?**

Yes. Google describes Gemma 4 as supporting 140 languages; name the target language and explain which terms, names, or quotations should stay unchanged.

**Does Gemma 4 31B have a thinking mode?**

Yes. Thinking mode produces reasoning before the final answer; try it for code diagnosis, constraint checking, or questions with several dependent steps.

**Which generation settings should I start with?**

Google recommends temperature 1.0, nucleus sampling at 0.95, and a top-k value of 64 across use cases. Use those as a baseline before comparing changes on examples from your task.

