API Reference
REST API endpoints for prompt adaptation, model discovery, and account management. All endpoints accept and return JSON.
https://api.refrase.cc/v1POST /api/adapt
Adapt a system prompt for a specific model and task type.
Request Body
{
"prompt": "You are a helpful assistant...",
"model": "claude-sonnet-4-20250514",
"task": "chat", // optional
"user_prompt": "Hello" // optional
}Response
{
"adapted": "...",
"original": "...",
"changes": [
{
"type": "modify",
"description": "Added XML structure tags",
"before": "...",
"after": "...",
"reason": "Claude performs better with XML-delimited sections"
}
],
"model": { "id": "...", "name": "...", "provider": "..." },
"metadata": {
"duration_ms": 230,
"rules_applied": 4,
"task": "chat"
}
}SDK Usage
GET /api/models
List all supported models with their capabilities and optimization rules.
Response
[
{
"id": "claude-sonnet-4-20250514",
"name": "Claude Sonnet 4",
"provider": "anthropic",
"capabilities": ["xml_tags", "thinking", "tool_use"]
},
...
]SDK Usage
GET /api/models/:id
Get details for a single model, including its full rule set.
Response
{
"id": "claude-sonnet-4-20250514",
"name": "Claude Sonnet 4",
"provider": "anthropic",
"capabilities": ["xml_tags", "thinking", "tool_use"],
"rules": [
{
"id": "xml-structure",
"description": "Wrap sections in XML tags",
"priority": 1
}
]
}GET /api/benchmarks
Retrieve benchmark data comparing model performance with and without prompt optimization.
POST /api/share
Create a shareable link for a prompt adaptation result.
Request Body
{
"prompt": "...",
"adapted": "...",
"model": "claude-sonnet-4-20250514",
"changes": [...]
}Response
{
"id": "abc123",
"url": "https://refrase.cc/s/abc123"
}SDK Usage
GET /api/share/:id
Retrieve a previously shared prompt adaptation.
Authenticated Endpoints
The following endpoints require authentication via a Bearer token in the Authorization header.
Authentication Example
GET /api/usageGet current usage stats and remaining quota for your account.
GET /api/dashboardGet aggregated dashboard data including adaptation history and usage trends.
GET /api/promptsList all saved prompts for the authenticated user.
POST /api/promptsSave a new prompt to the user's library.
DELETE /api/prompts/:idDelete a saved prompt by ID.
POST /api/trackTrack a usage event (e.g., adaptation applied, prompt copied).