Skip to main content
POST
cURL
Relace Apply runs at over 10,000 tok/s, making complicated code merges feel instantaneous.

Models

We have deprecated all previous versions of the apply models in favor of relace-apply-3, which is more performant on accuracy, speed, and long context requests.

OpenAI Compatible Endpoint

If the Relace REST API is inconvenient, we also support an OpenAI compatible endpoint for our apply models.
The user message must include <code> and <update> tags following the format above. The <instruction> tag is optional.

OpenRouter

Relace Apply is also available via OpenRouter’s OpenAI-compatible endpoint. See the model page for current availability and details. The performance section of the model page shows our real-time throughput and latency numbers from customer requests.

Fallbacks

We recommend using GPT-4.1-mini with predictive edits as a fallback. This option is 10-20x slower than Relace’s apply models, but it’s useful for redundancy. Relace apply models also return a 400 error code when input exceeds context limits (see table above). For these cases, GPT-4o-mini’s 1M token context window is a reliable fallback option. However, even frontier LLMs struggle with long context. We recommend proactive refactoring of files >32k tokens to improve output quality.

Authorizations

Authorization
string
header
required

Relace API key Authorization header using the Bearer scheme.

Body

application/json

Initial code and edits to apply

initial_code
string
required

The original code that needs to be modified

edit_snippet
string
required

The code changes to be applied to the initial code

model
enum<string>
default:relace-apply-3

Choice of apply model to use

Available options:
relace-apply-3
instruction
string

Optional single line instruction for to disambiguate the edit snippet. e.g. Remove the captcha from the login page

stream
boolean
default:false

Whether to stream the response back

relace_metadata
object

Optional metadata for logging and tracking purposes.

Response

Code successfully applied

mergedCode
string

The merged code with the changes applied

usage
object

Token usage information for the request