Prompt Enhancement rewrites your prompt before it reaches the AI model. It detects what kind of question you are asking, strips ambiguity, and adds structure — all in milliseconds, with no extra API call and no stored data.
How It Works
When you enable enhancement, RoutePlex detects the intent behind your prompt and rewrites it with targeted improvements — adding structure, specificity, and context that lead to better model responses.
For example:
- A vague coding question gets language context, edge-case hints, and output format guidance
- A debugging prompt gets error framing and reproduction steps
- An analysis request gets structured criteria and comparison framework
- A writing prompt gets tone, audience, and length guidance
Enhancement is skipped automatically if your prompt is already detailed enough.
Using with SDKs
Python SDK
from routeplex import RoutePlex
client = RoutePlex(api_key="YOUR_API_KEY")
# Enable per request
response = client.chat("fix my code", enhance_prompt=True)
print(response.output)Node.js SDK
import { RoutePlex } from "@routeplex/node";
const client = new RoutePlex({ apiKey: "YOUR_API_KEY" });
const response = await client.chat("fix my code", { enhancePrompt: true });
console.log(response.output);Using with curl
curl -X POST https://api.routeplex.com/api/v1/chat \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "fix my code"}],
"mode": "routeplex-ai",
"enhance_prompt": true
}'Using with OpenAI SDK
from openai import OpenAI
client = OpenAI(
api_key="YOUR_ROUTEPLEX_API_KEY",
base_url="https://api.routeplex.com/v1"
)
response = client.chat.completions.create(
model="routeplex-ai",
messages=[{"role": "user", "content": "fix my code"}],
extra_headers={"X-RoutePlex-Enhance": "true"}
)Enhancement Response
When enhancement is applied, the response includes metadata:
{
"data": {
"output": "...",
"enhancement": {
"applied": true,
"original_prompt": "fix my code"
}
}
}When applied is false, the original prompt was already detailed enough and was sent unchanged.
Standalone Enhance Endpoint
Preview the enhanced prompt without making a full chat request. No API key required, completely free:
Python SDK
result = client.enhance("tell me about kubernetes")
if result.changed:
print(f"Enhanced: {result.enhanced_prompt}")Node.js SDK
const result = await client.enhance("tell me about kubernetes");
if (result.changed) {
console.log(`Enhanced: ${result.enhancedPrompt}`);
}curl
curl -X POST https://api.routeplex.com/api/v1/chat/enhance \
-H "Content-Type: application/json" \
-d '{"prompt": "sort a list in python"}'Body field:
prompt(notmessage). Max 8000 characters.
Privacy
Enhancement is stateless — your prompt is processed in memory and immediately discarded. Nothing is stored. The standalone /enhance endpoint requires no authentication.
Try It
The Playground has an enhancement toggle that lets you see the before/after in real time.