edits
Create text edit
Section titled “Create text edit”Edit given text according to instructions
Request
Section titled “Request”POST /editsRequest Body
Section titled “Request Body”| Field | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model name |
| input | string | No | Input text to edit |
| instruction | string | Yes | Edit instruction |
| n | integer | No | - |
| temperature | number | No | - |
| top_p | number | No | - |
Request Examples
Section titled “Request Examples”Fix grammar errors
Section titled “Fix grammar errors”{ "model": "gpt-4o-mini", "input": "What day of the wek is it?", "instruction": "Fix the spelling mistakes"}Improve text
Section titled “Improve text”{ "model": "qwen-plus", "input": "The cat sat on the mat.", "instruction": "Make this more interesting and descriptive", "temperature": 0.7}Rewrite tone (more formal)
Section titled “Rewrite tone (more formal)”{ "model": "gpt-5-nano", "input": "Can you send me that report asap?", "instruction": "Rewrite in a polite and formal tone", "temperature": 0.2}Successful response
Response Schema
Section titled “Response Schema”| Field | Type | Required | Description |
|---|---|---|---|
| object | string | Yes | - |
| created | integer | Yes | - |
| choices | Array<EditChoice> | Yes | - |
| usage | object | Yes | - |
Response Example
Section titled “Response Example”{ "object": "edit", "created": 1677652288, "choices": [ { "text": "What day of the week is it?", "index": 0 } ], "usage": { "prompt_tokens": 10, "completion_tokens": 8, "total_tokens": 18 }}Code Examples
Section titled “Code Examples”JavaScript (Fetch)
Section titled “JavaScript (Fetch)”const response = await fetch('https://api.r9s.ai/v1/edits', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ "model": "gpt-4o-mini", "input": "What day of the wek is it?", "instruction": "Fix the spelling mistakes"})});
const data = await response.json();console.log(data);Python (requests)
Section titled “Python (requests)”import requests
url = "https://api.r9s.ai/v1/edits"headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"}
response = requests.post(url, json={ "model": "gpt-4o-mini", "input": "What day of the wek is it?", "instruction": "Fix the spelling mistakes"}, headers=headers)data = response.json()print(data)curl -X POST "https://api.r9s.ai/v1/edits" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"gpt-4o-mini","input":"What day of the wek is it?","instruction":"Fix the spelling mistakes"}'Schema Reference
Section titled “Schema Reference”EditRequest
Section titled “EditRequest”| Field | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model name |
| input | string | No | Input text to edit |
| instruction | string | Yes | Edit instruction |
| n | integer | No | - |
| temperature | number | No | - |
| top_p | number | No | - |
EditResponse
Section titled “EditResponse”| Field | Type | Required | Description |
|---|---|---|---|
| object | string | Yes | - |
| created | integer | Yes | - |
| choices | Array<EditChoice> | Yes | - |
| usage | object | Yes | - |
EditChoice
Section titled “EditChoice”| Field | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | - |
| index | integer | Yes | - |
| Field | Type | Required | Description |
|---|---|---|---|
| prompt_tokens | integer | Yes | Number of tokens in the prompt (input) |
| prompt_tokens_details | object | No | Details about prompt tokens |
| completion_tokens | integer | Yes | Number of tokens in the completion (output) |
| completion_tokens_details | object | No | Details about completion tokens |
| total_tokens | integer | Yes | Total number of tokens (prompt + completion) |
Related APIs
Section titled “Related APIs”- API Overview - Learn about authentication and basic information
- models - View models related APIs
- chat - View chat related APIs
- responses - View responses related APIs
- messages - View messages related APIs
- completions - View completions related APIs
- images - View images related APIs
- embeddings - View embeddings related APIs
- engine-embeddings - View engine-embeddings related APIs
- moderations - View moderations related APIs
- audio - View audio related APIs
- search - View search related APIs
- proxy - View proxy related APIs