How to Use Relace Apply 3 in opencode
Relace Apply 3 merges proposed edits into existing code. Give it the original code and an abbreviated edit snippet to get the merged code back.
Prompts to try with Relace Apply 3 in opencode
Copy an example into opencode, or ask in your own words.
Use Relace Apply 3 to merge a prepared fix for empty input in the project's Python parser. Read the current implementation first, then review the diff.
Prepare a TypeScript edit that renames the selected function and its call sites. Use Relace Apply 3 to merge it, then check the diff for unrelated changes.
Use Relace Apply 3 to merge revised labels into the project's HTML form. Include the original markup and a focused edit snippet.
Prepare a snippet removing the obsolete Ruby method, including surrounding context. Use Relace Apply 3 to merge the deletion and inspect the result.
Use Relace Apply 3 to merge the approved installation-section rewrite into README.md. Compare the result with the original to confirm other sections remain intact.
How to set up Relace Apply 3 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 Relace Apply 3
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": "relace/relace-apply-3", "input": { "messages": [ { "role": "system" } ] } }'
Then paste one of the prompts above: opencode finds Relace Apply 3 on Spiral, shows the price and runs it.
Relace Apply 3 providers and prices
Spiral runs Relace Apply 3 through OpenRouter. Open a card for today's price, with every fee included.
Up to $0.006695 per run at the default inputs. $1.105 per 1M input tokens, $1.625 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 | ||
| Max tokens | 1 to 128000 | The most output tokens to generate. |
Every API field of Relace: Relace Apply 3 is on its tool page: open its card above.
What can you do with Relace Apply 3 in opencode?
Turn proposed changes into merged project code with Relace Apply 3. Have the coding agent prepare focused edits, then inspect the resulting diff against the request.
Apply a TypeScript refactor
Merge a proposed function rename and updated call sites into existing TypeScript code, then inspect the resulting diff.
Merge a JavaScript bug fix
Apply a prepared correction to a calculation or event handler while retaining the surrounding implementation.
Update Python validation
Merge a proposed validation branch into a Python function using the original code and a focused edit snippet.
Revise Ruby application logic
Apply an approved method change to existing Ruby code and review the diff for unintended edits.
Apply HTML changes
Merge a prepared markup change, such as revised form labels, into the original HTML.
Maintain Markdown documentation
Merge a proposed section replacement into an existing Markdown document while retaining unrelated sections.
More on Relace Apply 3 and opencode
Overview
Relace Apply 3 in other agents
More opencode guides
Questions about Relace Apply 3 in opencode
Can opencode use Relace Apply 3?
Yes. Add Spiral to opencode as an MCP server, and opencode can find and run Relace Apply 3 like any built-in tool.
How much does Relace Apply 3 cost in opencode?
Up to $0.006695 per run at the default inputs. $1.105 per 1M input tokens, $1.625 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 Relace Apply 3 in opencode?
No. Spiral runs Relace Apply 3 on its own OpenRouter account. You sign in to Spiral once and never paste a key.
How long does it take to set up Relace Apply 3 in opencode?
About two minutes: add the server, then sign in, then check it.
Does opencode wait while Relace Apply 3 runs?
Relace Apply 3 runs in the background. opencode starts the run, checks on it and gives you the text, json when it's ready.
What is Relace Apply 3 best used for?
Use it to merge an already proposed change into existing code. A useful workflow separates deciding what to change from applying that change.
How should I format a Relace Apply 3 prompt?
Put the original code inside <code> tags and the proposed edit inside <update> tags. Add a brief instruction describing the intended change when the snippet could be ambiguous.
Which programming languages does Relace Apply 3 cover?
Relace reports training across dozens of languages, emphasizing TypeScript, JavaScript, Python, Ruby, HTML, and Markdown. That training coverage does not establish equal accuracy across languages.
Should I send very large source code blocks?
Relace recommends refactoring files above 32,000 tokens to improve output quality. Treat that recommendation as a quality guideline when choosing how much code to send.
How do I make deletions clear?
Include surrounding code that identifies the section to remove. Preserve the indentation and structure you want in the final result.
Start using Relace Apply 3 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


