@bman654/clodex 2.18.3 → 2.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -346,7 +346,7 @@ import { join } from "path";
346
346
  // package.json
347
347
  var package_default = {
348
348
  name: "@bman654/clodex",
349
- version: "2.18.3",
349
+ version: "2.18.4",
350
350
  publishConfig: {
351
351
  access: "public"
352
352
  },
@@ -13025,8 +13025,8 @@ function translateRequest(body, npm, options) {
13025
13025
  }
13026
13026
  const upstreamModelId2 = options?.reasoningMetadata?.upstreamModelId ?? body.model;
13027
13027
  const supportsExplicitOpenAiCaching = !options?.openAiOAuth && supportsOpenAiPromptCacheBreakpoints(upstreamModelId2);
13028
+ const claudeSessionId = extractClaudeSessionId(body, options?.claudeSessionId);
13028
13029
  if (npm === "@ai-sdk/openai") {
13029
- const claudeSessionId = extractClaudeSessionId(body, options?.claudeSessionId);
13030
13030
  const serviceTier = options?.openAiOAuth ? oauthServiceTier() : void 0;
13031
13031
  providerOptions = deepMergeProviderOptions(providerOptions, {
13032
13032
  openai: {
@@ -13047,7 +13047,17 @@ function translateRequest(body, npm, options) {
13047
13047
  toolChoice: compactRequest ? "none" : translateToolChoice(body.tool_choice),
13048
13048
  maxOutputTokens: options?.openAiOAuth ? void 0 : body.max_tokens,
13049
13049
  temperature: body.temperature,
13050
- providerOptions
13050
+ providerOptions,
13051
+ // OpenRouter derives its own conversation key when none is sent, and routes a
13052
+ // session's requests to one provider when one is. The value needs to be stable
13053
+ // and unique, not recognizable, so the session UUID goes over hashed through
13054
+ // the same key the OpenAI route's prompt_cache_key uses; the system/tools hash
13055
+ // stays the fallback for clients that send no session identity.
13056
+ ...isOpenRouterRoute(npm, options?.reasoningMetadata) ? {
13057
+ headers: {
13058
+ "x-session-id": claudeSessionId ? claudeSessionPromptCacheKey(claudeSessionId) : openAiPromptCacheKey(baseSystem, upstreamTools)
13059
+ }
13060
+ } : {}
13051
13061
  };
13052
13062
  }
13053
13063
  function isOpenAiOAuthRoute(route) {