How to Use gpt-oss-20b in opencode
gpt-oss-20b handles coding, reasoning, and tool-assisted text tasks. OpenAI positions it for lower latency and specialized work, while gpt-oss-120b targets more demanding reasoning.
Prompts to try with gpt-oss-20b in opencode
Copy an example into opencode, or ask in your own words.
Use gpt-oss-20b with high reasoning effort to investigate the failing tests in this project. Read the relevant implementation, reproduce one failure, and make the smallest fix with a regression test.
Use gpt-oss-20b to review the current diff for logic errors and missing edge cases. Cite file locations, explain each issue's trigger, and omit style-only suggestions.
Use gpt-oss-20b to inspect this project's text-parsing code. Add tests for empty input, malformed records, and unexpected Unicode, then report which tests expose a bug.
Use gpt-oss-20b with medium reasoning effort to trace how a request moves through this repository. Explain the main functions and error paths, citing the files you read.
Use gpt-oss-20b to examine the JSON records produced by this project. Propose validation rules, add checks for missing required values, and test them against representative records.
How to set up gpt-oss-20b in opencode
Pick the way that suits you. Each takes about two minutes.
Use Spiral's MCP server
- Add the server
Leave out --global to add Spiral to the current project only. No header and no client ID or secret: opencode registers itself with Spiral.
opencode mcp add spiral --global --url https://api.spiral.ai/mcp
- Sign in
Your browser opens. Sign in to Spiral, pick the organization and click Authorize, then return to the terminal. No API key. Inside opencode, /mcps starts the same sign-in.
opencode mcp auth spiral
- Check it
Spiral shows as connected.
opencode mcp list
Use the Spiral skill
- Send opencode this message
Your agent reads Spiral's skill and sets itself up.
set up https://spiral.ai/SKILL.md
- Sign in or paste a key
Approve Spiral in the browser, or give the agent a key from the console.
Use the Spiral CLI
- Install and sign in
Installs the Spiral CLI, signs you in and adds its skill to your coding agents.
npx -y spiral-cli@latest init
Call the Spiral API
- Create an API key
In the console, under API keys.
- Run gpt-oss-20b
One request; the result comes back by polling or a webhook.
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": "openai/gpt-oss-20b", "input": { "messages": [ { "role": "system" } ] } }'
Then paste one of the prompts above: opencode finds gpt-oss-20b on Spiral, shows the price and runs it.
gpt-oss-20b providers and prices
Spiral runs gpt-oss-20b through OpenRouter. Open a card for today's price, with every fee included.
Up to $0.013037 per run at the default inputs. $0.0221 per 1M input tokens, $0.1105 per 1M output tokens.
Settings you can ask for
Ask opencode for any of these in your prompt.
| Setting | Allowed values | Default | Description |
|---|---|---|---|
| Seed | a whole number | ||
| Min p | 0 to 1 | ||
| Top k | a whole number from 0 | ||
| Top p | 0 to 1 | ||
| Logprobs | on or off | ||
| Max tokens | 1 to 117964 | The most output tokens to generate. | |
| Temperature | 0 to 2 | ||
| Top logprobs | 0 to 20 | ||
| Presence penalty | -2 to 2 | ||
| Reasoning effort | low, medium, or high | medium | How much the model reasons. |
| Frequency penalty | -2 to 2 | ||
| Repetition penalty | 0 to 2 |
Every API field of OpenAI: gpt-oss-20b is on its tool page: open its card above.
What can you do with gpt-oss-20b in opencode?
gpt-oss-20b can help turn project code and test failures into focused fixes and review findings. Give it the relevant files, a concrete success condition, and tests that can check the result.
Debug a failing test
Give gpt-oss-20b the failure output and relevant code. Ask for a minimal fix and a regression test that reproduces the problem.
Review a code change
Ask gpt-oss-20b to inspect a diff for logic errors, missed edge cases, and assumptions that need tests.
Extract structured records
Turn support messages or intake text into JSON records. Specify the required keys and use null for information the source does not contain.
Explain technical material
Provide a technical passage and ask gpt-oss-20b to explain its assumptions, define unfamiliar terms, and work through a small example.
Check a quantitative argument
Ask gpt-oss-20b to examine units, assumptions, and calculations in a proposed solution. Use an available Python tool to verify the arithmetic.
Draft answers from reference text
Supply policy or product documentation and ask for answers with supporting passages. Require an explicit unknown when the text does not answer the question.
Triage recurring operational reports
Use gpt-oss-20b to classify supplied incident summaries, identify repeated symptoms, and propose the next diagnostic question for each unresolved issue.
More on gpt-oss-20b and opencode
Overview
gpt-oss-20b in other agents
More opencode guides
Questions about gpt-oss-20b in opencode
Can opencode use gpt-oss-20b?
Yes. Add Spiral to opencode as an MCP server, and opencode can find and run gpt-oss-20b like any built-in tool.
How much does gpt-oss-20b cost in opencode?
Up to $0.000695 per run at the default inputs. $0.039 per 1M input tokens, $0.169 per 1M output tokens. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your opencode plan is separate.
Do I need an OpenRouter account to use gpt-oss-20b in opencode?
No. Spiral runs gpt-oss-20b on its own OpenRouter account. You sign in to Spiral once and never paste a key.
How long does it take to set up gpt-oss-20b in opencode?
About two minutes: add the server, then sign in, then check it.
Does opencode wait while gpt-oss-20b runs?
gpt-oss-20b runs in the background. opencode starts the run, checks on it and gives you the text, json when it's ready.
What is gpt-oss-20b good at?
Coding, reasoning, and tasks that combine text with tool calls are its clearest fits. Try focused bug fixes, technical explanations, and extracting structured records from supplied text.
How much text can gpt-oss-20b handle?
OpenAI lists a 131,072-token context window and a maximum output of 131,072 tokens. Treat those as model specifications, rather than a target length for every answer.
Can gpt-oss-20b understand screenshots or recordings?
It processes text only. For a screenshot or recording, provide extracted text or a transcript and ask questions about that text.
Which reasoning level should I choose?
Start with low effort for straightforward dialogue and medium for everyday analysis. Try high effort for difficult debugging or multistep problems, then compare results on representative tasks.
Which languages should I use with gpt-oss-20b?
Its training data was mostly English, with an emphasis on STEM, coding, and general knowledge. For another language, test examples from your actual task before relying on the results.
Start using gpt-oss-20b in opencode
One Spiral account for every tool your agent needs. No subscription; you pay per run.
Paste this into opencode:
set up https://spiral.ai/SKILL.md


