OpenAI added a prediction parameter to chat completions that lets you pass a predicted completion for the model to validate or refine. This significantly reduces latency and cost for rewrite/edit tasks where you already have a good guess at the output:
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "Fix typos in the given text."},
{"role": "user", "content": "The quik brown fox jumpd over the layz dog."},
],
prediction={
"type": "content",
"content": "The quick brown fox jumped over the lazy dog."
},
)
When the prediction is close to what the model would generate anyway, the provider uses speculative decoding internally — the response comes back faster and costs less because fewer tokens need to be generated from scratch.
OrcaRouter drops this parameter (same ChatCompletionRequest schema gap). I'd like to see it forwarded as a pass-through. Since it's a structured dict ({"type": "content", "content": "..."}), adding prediction: dict | None = None to the schema should be sufficient.
One routing consideration: predicted output is currently only supported by OpenAI's gpt-4o family. If model="auto" receives a request with prediction, the auto-router should only consider models whose upstream is OpenAI and whose model supports predicted output. Otherwise the parameter reaches an upstream that rejects it with a 400.
Happy to help test if someone picks this up.
OpenAI added a
predictionparameter to chat completions that lets you pass a predicted completion for the model to validate or refine. This significantly reduces latency and cost for rewrite/edit tasks where you already have a good guess at the output:When the prediction is close to what the model would generate anyway, the provider uses speculative decoding internally — the response comes back faster and costs less because fewer tokens need to be generated from scratch.
OrcaRouter drops this parameter (same
ChatCompletionRequestschema gap). I'd like to see it forwarded as a pass-through. Since it's a structured dict ({"type": "content", "content": "..."}), addingprediction: dict | None = Noneto the schema should be sufficient.One routing consideration: predicted output is currently only supported by OpenAI's
gpt-4ofamily. Ifmodel="auto"receives a request withprediction, the auto-router should only consider models whose upstream is OpenAI and whose model supports predicted output. Otherwise the parameter reaches an upstream that rejects it with a 400.Happy to help test if someone picks this up.