API Reference

Documentation

Everything you need to integrate Pawan.Krd into your application.

Proofreadings

Grammarly-style writing assistance: correct spelling, grammar and punctuation, adjust tone, replace borrowed words with pure-language equivalents, rewrite or paraphrase text, suggest alternatives for a selection, and analyze writing quality.

POST/v1/proofreadings

Request

📋Request
1{ 2 "model": "your-proofreading-model", 3 "task": "proofread", 4 "input": "Ths sentense have some erors.", 5 "language": "en", 6 "spell_check": true, 7 "grammar": true, 8 "explain": true 9}

Parameters

model
stringrequired
Proofreading model id (type: proofreading).
input
stringrequired
The text to check. Max length depends on the model (Max Input Characters).
task
string
One of proofread, spelling, grammar, punctuation, suggestions, kurdish_pure, tone, rewrite, paraphrase, simplify, shorten, expand, alternatives, analyze, statistics. Defaults to the model's default task.
language
string
BCP 47 language tag, e.g. ckb (Sorani), kmr (Kurmanji), ar, en. Must be one of the model's supported languages.
spell_check
boolean
Fix spelling mistakes (proofread task).
grammar
boolean
Fix grammar mistakes (proofread task).
punctuation
boolean
Fix punctuation (proofread task).
suggestions
boolean
Include style / clarity / word-choice suggestions.
kurdish_pure
boolean
Pure language: replace borrowed words with native equivalents.
tone
string
Target tone: neutral, formal, informal, professional, friendly, casual, academic, confident, persuasive, diplomatic, empathetic, enthusiastic, simple, journalistic, creative. Required for task: "tone".
explain
boolean
Attach an explanation to each change.
merge_adjacent_changes
boolean
Merge neighbouring edits into a single change.
goal
string
Rewrite goal: clarity, fluency, concise, simplify, expand, paraphrase, formalize, polish.
length
string
shorter, same or longer (rewrite tasks).
n
integer
Number of rewrites / alternatives to return.
selection
{ start, end }
UTF-16 offsets of the span to generate alternatives for (alternatives task).
custom_dictionary
string[]
Words that must never be flagged (names, brands, jargon).
instructions
string
Extra free-form instructions (max 500 chars).
⚠

Model-specific support

Each model declares which properties, tasks, tones and languages it supports (see the model page or GET /v1/models → parameters). Sending an unsupported property or value returns 400 unsupported_parameter. Omitted properties fall back to the model's defaults.

Response

📋200 OK — proofread / rewrite tasks
1{ 2 "id": "prf_abc123", 3 "object": "proofreading", 4 "created": 1790000000, 5 "model": "your-proofreading-model", 6 "task": "proofread", 7 "choices": [ 8 { 9 "index": 0, 10 "text": "This sentence has some errors.", 11 "changes": [ 12 { 13 "id": "chg_1", 14 "type": "spell-correction", 15 "start_index": 0, 16 "end_index": 3, 17 "old_text": "Ths", 18 "new_text": "This", 19 "category": "spelling", 20 "explanation": "Misspelled word." 21 }, 22 { 23 "id": "chg_2", 24 "type": "replace", 25 "start_index": 13, 26 "end_index": 17, 27 "old_text": "have", 28 "new_text": "has", 29 "category": "grammar", 30 "explanation": "Subject-verb agreement." 31 } 32 ], 33 "finish_reason": "stop" 34 } 35 ], 36 "usage": { "input_tokens": 24, "output_tokens": 61, "total_tokens": 85 } 37}

Each change has a type (insert, delete, replace, spell-correction), UTF-16 start_index/end_index into the original input, and an optional category (spelling, grammar, punctuation, style, clarity, tone, word-choice). The alternatives task returns selection + alternatives[], and statistics returns a statistics object.

📋200 OK — analyze task
1{ 2 "id": "prf_def456", 3 "object": "proofreading", 4 "task": "analyze", 5 "analysis": { 6 "detected_language": "en", 7 "tone": "informal", 8 "tone_scores": [{ "tone": "informal", "score": 0.82 }], 9 "formality": "informal", 10 "readability": 71.4, 11 "grade_level": "intermediate", 12 "sentiment": "neutral", 13 "quality_score": 64, 14 "issue_counts": { "spelling": 2, "grammar": 1, "punctuation": 0, "style": 1 }, 15 "summary": "Casual message with a few spelling mistakes.", 16 "statistics": { "characters": 34, "characters_no_spaces": 28, "words": 7, "sentences": 1, "paragraphs": 1, "average_words_per_sentence": 7, "reading_time_seconds": 2 } 17 }, 18 "usage": { "input_tokens": 20, "output_tokens": 110, "total_tokens": 130 } 19}

Examples

💻cURL — professional rewrite
1curl https://api.pawan.krd/v1/proofreadings \ 2 -H "Authorization: Bearer pk-your_key" \ 3 -H "Content-Type: application/json" \ 4 -d '{ 5 "model": "your-proofreading-model", 6 "task": "rewrite", 7 "input": "hey, can u send me the report asap", 8 "tone": "professional", 9 "goal": "polish", 10 "n": 2 11 }'
📒JavaScript — Sorani with pure language
1const response = await fetch("https://api.pawan.krd/v1/proofreadings", { 2 method: "POST", 3 headers: { 4 Authorization: "Bearer pk-your_key", 5 "Content-Type": "application/json", 6 }, 7 body: JSON.stringify({ 8 model: "your-proofreading-model", 9 task: "proofread", 10 input: "ئەم دەقە هەڵەی تێدایە", 11 language: "ckb", 12 kurdish_pure: true, 13 }), 14}); 15 16const result = await response.json(); 17for (const change of result.choices[0].changes) { 18 console.log(change.category, change.old_text, "→", change.new_text); 19}
🐍Python — alternatives for a selection
1import requests 2 3response = requests.post( 4 "https://api.pawan.krd/v1/proofreadings", 5 headers={"Authorization": "Bearer pk-your_key"}, 6 json={ 7 "model": "your-proofreading-model", 8 "task": "alternatives", 9 "input": "The meeting was very good.", 10 "selection": {"start": 16, "end": 25}, 11 "n": 3, 12 }, 13) 14 15for alt in response.json()["alternatives"]: 16 print(alt["text"], "-", alt["note"])
ℹ

Streaming

Proofreadings are returned as a single JSON response; stream: true is rejected.