Compact conversation
POST
/v1/responses/compact
package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.mirapi.ai/v1/responses/compact"
payload := strings.NewReader("{ \"model\": \"example\", \"input\": [ {} ], \"instructions\": \"example\", \"previous_response_id\": \"example\" }")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}const url = 'https://api.mirapi.ai/v1/responses/compact';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"model":"example","input":[{}],"instructions":"example","previous_response_id":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.mirapi.ai/v1/responses/compact \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "example", "input": [ {} ], "instructions": "example", "previous_response_id": "example" }'The OpenAI Responses API endpoint that compacts a long conversation.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
model
required
string
input
One of:
string
Array<object>
object
instructions
string
previous_response_id
string
Examplegenerated
{ "model": "example", "input": [ {} ], "instructions": "example", "previous_response_id": "example"}Responses
Section titled “Responses”Conversation compacted
Media typeapplication/json
object
id
string
object
string
created_at
integer
output
Array<object>
object
usage
object
prompt_tokens
Prompt tokens
integer
completion_tokens
Completion tokens
integer
total_tokens
Total tokens
integer
prompt_tokens_details
object
cached_tokens
integer
text_tokens
integer
audio_tokens
integer
image_tokens
integer
completion_tokens_details
object
text_tokens
integer
audio_tokens
integer
reasoning_tokens
integer
error
object
Example
{ "object": "response.compaction"}