Bridge by Wekoya / Docs / Chat
Context caches
Updated
Ask many questions about one long thing (a handbook, a contract, a video) without paying for it in full each time. Store it once as a cache, then name the cache in chat requests: its tokens are billed at the cached rate, a fraction of the input rate. Works on Gemini models.
curl https://wekoya-api.wekoya.tech/v1/caches \
-H "Authorization: Bearer $WEKOYA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.5-flash-lite",
"ttl_seconds": 3600,
"messages": [
{ "role": "system", "content": "Answer questions about this handbook. Cite the clause." },
{ "role": "user", "content": "<the whole handbook, or a PDF, video or audio file>" }
]
}'
# {
# "id": "cache_3857a1d3-…",
# "model": "gemini-3.5-flash-lite",
# "tokens": 9914,
# "expires_at": "2026-10-09T17:12:21Z",
# "wekoya": { "cost": 19.14, "currency": "NGN", "hours_paid": 1 }
# }reply = client.chat.completions.create(
model="gemini-3.5-flash-lite", # the cache's model, or "auto"
messages=[{"role": "user", "content": "What does clause 17 say?"}],
extra_body={"cache": "cache_3857a1d3-…"},
)
print(reply.choices[0].message.content)
print(reply.usage.prompt_tokens_details.cached_tokens) # 9914, at the cached rate- Making one costs its tokens once at the input rate, plus storage: ₦1,485 per million tokens an hour (₦6,683 on Pro models), paid up front for
ttl_seconds(1 minute to 7 days, default 1 hour), rounded up to the hour. - A cache needs at least 1,024 tokens (4,096 on some models). Below that, nothing is charged, and requests that start the same way are already cached by prompt caching.
- A request that uses a cache cannot add a system message or tools; put those in the cache. It runs on the cache's model and on your Bridge balance (not your own provider keys).
- Caches belong to your account; nobody else's key can use or see them.
- Deleting a cache early does not refund the storage already paid.
# Keep it longer (pays only for hours not already paid)
curl -X PATCH https://wekoya-api.wekoya.tech/v1/caches/cache_3857a1d3-… \
-H "Authorization: Bearer $WEKOYA_API_KEY" -H "Content-Type: application/json" \
-d '{ "ttl_seconds": 7200 }'
# List, read, delete
curl https://wekoya-api.wekoya.tech/v1/caches -H "Authorization: Bearer $WEKOYA_API_KEY"
curl -X DELETE https://wekoya-api.wekoya.tech/v1/caches/cache_3857a1d3-… -H "Authorization: Bearer $WEKOYA_API_KEY"