Skip to content

Commit 9b641cf

Browse files
committed
docs(api): attribute the 64-char prompt_cache_key cap honestly
What: reword the XAI_MAX_PROMPT_CACHE_KEY_LENGTH comment. Why: review seat (PR #2256 mlarge P3) caught that xAI's docs do not state a 64-char bound for prompt_cache_key - the bound is OpenAI's documented one; we apply it as a conservative guard. Impact: comment-only; zero code change.
1 parent 44dd4b2 commit 9b641cf

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎src/api/providers/xai.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ import { isMcpTool } from "../../utils/mcp-name"
2727

2828
const XAI_DEFAULT_TEMPERATURE = 0
2929

30-
// xAI caps `prompt_cache_key` at 64 characters, the same bound the OpenAI Responses
31-
// API enforces on the field. Task ids are uuid v7 (36 chars), so this is a guard.
30+
// Conservative length guard for `prompt_cache_key`: OpenAI's documented cap is 64
31+
// chars; xAI does not document a bound for this field, so we apply the same cap.
32+
// Task ids are uuid v7 (36 chars), so this never truncates in practice.
3233
const XAI_MAX_PROMPT_CACHE_KEY_LENGTH = 64
3334

3435
export class XAIHandler extends BaseProvider implements SingleCompletionHandler {

0 commit comments

Comments
 (0)