8000 feat: add prefix cache support for volcengine by laoshancun · Pull Request #765 · Calcium-Ion/new-api · GitHub
[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add prefix cache support for volcengine #765

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

laoshancun
Copy link
@laoshancun laoshancun commented Feb 18, 2025

There are 2 api change.

  • cache context create
POST http://oneapi/v1/context/create
Authorization: Bearer token
Content-Type: application/json
 
{ 
    "model":"doubao-pro-32k", 
    "messages":[ 
        {"role":"system","content":"long prompt need to cache"}
     ], 
     "ttl":86400, 
     "mode": "common_prefix"
}
  • use cache context
POST http://oneapi/v1/chat/completions
Authorization: Bearer token
Content-Type: application/json
 
{
    "context_id": "ctx-20250218162710-6jwbk", // context_id from context create api result
    "model": "doubao-pro-32k",
    "messages":[ 
       {"role":"user","content":"hello!"}
     ]
}

see also:https://www.volcengine.com/docs/82379/1396490

@laoshancun laoshancun changed the title feat: add prefix create support for volcengine feat: add prefix cache support for volcengine Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0