Explicit Caching
Last updated
POST /v1/chat/completions HTTP/1.1
Host: llm.onerouter.pro
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 286
{
"model": "google/gemini-2.5-flash",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Based on the book text below:"
},
{
"type": "text",
"text": "{long_prompt}",
"cache_control": {
"type": "ephemeral"
}
},
{
"type": "text",
"text": "List all main characters mentioned in the text above."
}
]
}
]
}{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "Based on the text provided, the main characters are:\n\n1. **Alex**\n2. **Dr. Anya Sharma**\n3. **Leo**",
"role": "assistant"
}
}
],
"created": 1773906600,
"id": "chatcmpl-20260319074953445439360mnRrCh5z",
"model": "gemini-2.5-flash",
"object": "chat.completion",
"request_id": "2e404909cba543d080d6c62d55fbd72a",
"usage": {
"completion_tokens": 1135,
"completion_tokens_details": {
"audio_tokens": 0,
"image_tokens": 0,
"reasoning_tokens": 1100
},
"prompt_tokens": 22,
"prompt_tokens_details": {
"audio_tokens": 0,
"cache_write_tokens": 0,
"cached_tokens": 0,
"video_tokens": 0
},
"total_tokens": 1157
}
}