@caeliq/llms 1.0.67 → 1.0.69

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.
Files changed (39) hide show
  1. package/README.md +7 -5
  2. package/dist/cjs/server.cjs +226 -222
  3. package/dist/cjs/server.cjs.map +4 -4
  4. package/dist/cursor-sdk/events-to-sse.d.ts +3 -3
  5. package/dist/cursor-sdk/lifecycle-planner.d.ts +5 -0
  6. package/dist/cursor-sdk/session.d.ts +21 -0
  7. package/dist/cursor-sdk/shared.d.ts +7 -0
  8. package/dist/cursor-sdk/usage.d.ts +14 -7
  9. package/dist/esm/server.mjs +222 -218
  10. package/dist/esm/server.mjs.map +4 -4
  11. package/dist/routing/fim-pipeline.d.ts +6 -0
  12. package/dist/routing/protocol-endpoints.d.ts +1 -1
  13. package/dist/server.d.ts +1 -1
  14. package/dist/session-registry.d.ts +36 -0
  15. package/dist/tests/cursor-sdk.shared.d.ts +1 -0
  16. package/dist/tests/cursor-sdk.tool-id-alias.d.ts +1 -0
  17. package/dist/tests/fim.endpoint.d.ts +1 -0
  18. package/dist/tests/fim.transformers.d.ts +1 -0
  19. package/dist/tests/gpt6.astra-hardening.d.ts +1 -0
  20. package/dist/tests/session-registry.d.ts +1 -0
  21. package/dist/transformer/fim/fim.deepseek.transformer.d.ts +15 -0
  22. package/dist/transformer/fim/fim.mistral.transformer.d.ts +14 -0
  23. package/dist/transformer/fim/fim.qwen.transformer.d.ts +15 -0
  24. package/dist/transformer/fim/fim.transformer.d.ts +22 -0
  25. package/dist/transformer/fim/index.d.ts +4 -0
  26. package/dist/transformer/index.d.ts +5 -0
  27. package/dist/transformer/openai.transformer.d.ts +5 -0
  28. package/dist/transformer/opencode-headers.transformer.d.ts +1 -2
  29. package/dist/utils/fim/encode.d.ts +14 -0
  30. package/dist/utils/fim/inbound.d.ts +9 -0
  31. package/dist/utils/fim/index.d.ts +7 -0
  32. package/dist/utils/fim/kinds.d.ts +16 -0
  33. package/dist/utils/fim/response.d.ts +17 -0
  34. package/dist/utils/fim/types.d.ts +41 -0
  35. package/dist/utils/fim/url.d.ts +13 -0
  36. package/dist/utils/message-debug.d.ts +20 -2
  37. package/dist/utils/reasoning-effort.d.ts +23 -0
  38. package/dist/utils/router.d.ts +2 -1
  39. package/package.json +5 -5
package/README.md CHANGED
@@ -6,11 +6,11 @@ Claude Code Router is an adaptive LLM gateway for Claude Code. It routes each re
6
6
 
7
7
  ## ✨ Features
8
8
 
9
- - **Adaptive Model Routing**: Route requests by scenario, including background tasks, thinking, long context, web search, and image workflows.
9
+ - **Adaptive Model Routing**: Route requests by scenario, including background tasks, thinking, long context, web search, FIM completions, and image workflows.
10
10
  - **Tool Use & Thinking**: Preserve tool calls, tool results, and reasoning content across providers with different API formats.
11
11
  - **Multi-Provider Support**: Supports various model providers like OpenRouter, DeepSeek, Ollama, Gemini, Antigravity, Volcengine, SiliconFlow, Codex, Claude subscription, Qwen, Chrome On-Device, and Cursor (SDK).
12
12
  - **Request/Response Transformation**: Customize requests and responses for different providers using transformers.
13
- - **Native Client Protocols**: Accept Anthropic Messages, OpenAI Chat Completions, and OpenAI Responses requests through the same router and fallback pipeline.
13
+ - **Native Client Protocols**: Accept Anthropic Messages, OpenAI Chat Completions, OpenAI Responses, and FIM Completions through the same router (FIM uses a dedicated pipeline and `fim.*` transformers).
14
14
  - **Dynamic Model Switching**: Switch models on-the-fly within Claude Code using the `/model` command.
15
15
  - **CLI Model Management**: Manage models and providers directly from the terminal with `ccr model`.
16
16
  - **GitHub Actions Integration**: Trigger Claude Code tasks in your GitHub workflows.
@@ -209,7 +209,7 @@ export OPENAI_BASE_URL=http://127.0.0.1:3456/v1
209
209
  export OPENAI_API_KEY=your-router-api-key
210
210
  ```
211
211
 
212
- CCR accepts Chat Completions at `/v1/chat/completions` (alias `/chat/completions`) and Responses at `/v1/responses` (alias `/responses`). Send a model as `provider,model` to select a destination explicitly, or send a bare model and configure `Router.default`. Both JSON and SSE responses are converted back to the protocol used by the client.
212
+ CCR accepts Chat Completions at `/v1/chat/completions` (alias `/chat/completions`), Responses at `/v1/responses` (alias `/responses`), and FIM at `/v1/fim/completions` (alias `/fim/completions`). Send a model as `provider,model` to select a destination explicitly, or send a bare model and configure `Router.default` (FIM also uses `Router.fim`). Chat JSON/SSE responses are converted back to the protocol used by the client; FIM responses follow the inbound FIM wire (v1: Codestral/Mistral).
213
213
 
214
214
  Discover what the router can reach with `GET /v1/models` (alias `/models`). By default it emits literal `provider,model` IDs. Set `"MODEL_ID_OUTPUT": "masked"` to expose otherwise-filtered IDs as `claude-<hex>` while leaving IDs beginning with `claude` or `anthropic` unchanged. Chat routes accept both representations regardless of this output setting. To surface CCR models in Codex's native picker, use `ccr codex-config`, which writes a Codex model catalog and the managed `config.toml` block that points Codex at the router.
215
215
 
@@ -436,8 +436,9 @@ The `Providers` array defines each provider: `name`, `api_base_url`, `api_key`,
436
436
 
437
437
  **Available Built-in Transformers:**
438
438
 
439
- - `Anthropic` — passes through to an Anthropic endpoint unchanged. `OpenAI` — registers the `/v1/chat/completions` route (the body is already in OpenAI shape).
440
- - Provider adapters: `deepseek`, `groq`, `mistral`, `openrouter`, `gemini` / `vertex-gemini`, `codex`, `claude-auth`, `antigravity-auth`, `qwen-auth`, `xai-auth`, `cursor-sdk`, `chrome-on-device`.
439
+ - Protocol owners: `Anthropic` (`/v1/messages`), `OpenAI` (`/v1/chat/completions`), `openai-responses` (`/v1/responses`), `Fim` (`/v1/fim/completions`).
440
+ - FIM provider adapters: `fim.mistral`, `fim.deepseek`, `fim.qwen` (dedicated FIM providers only — do not stack with chat transformers).
441
+ - Provider adapters: `deepseek`, `groq`, `mistral`, `openrouter`, `gemini` / `vertex-gemini`, `codex` (pair with `openai-responses`), `claude-auth` (pair with `Anthropic`), `antigravity-auth`, `qwen-auth`, `xai-auth`, `cursor-sdk`, `chrome-on-device`.
441
442
  - `maxtoken` — sets a specific `max_tokens`. `tooluse` — optimizes tool usage via `tool_choice`. `reasoning` — replays provider `reasoning_content` across turns. `sampling` — maps `temperature` / `top_p` / `top_k` / `repetition_penalty`. `enhancetool` — adds error tolerance to tool-call parameters (disables streaming of tool calls). `cleancache` — clears `cache_control`. `customparams` — injects custom request parameters.
442
443
  - Experimental gist/CLI integrations: `gemini-cli`, `chutes-glm`, `qwen-cli`, `rovo-cli`.
443
444
 
@@ -457,6 +458,7 @@ The `Router` object defines which model to use for different scenarios:
457
458
  - `longContext`: A model for handling long contexts (e.g., > 60K tokens).
458
459
  - `longContextThreshold` (optional): The token count threshold for triggering the long context model. Defaults to 60000 if not specified.
459
460
  - `webSearch`: Used for handling web search tasks and this requires the model itself to support the feature. If you're using openrouter, you need to add the `:online` suffix after the model name.
461
+ - `fim`: Used for `POST /v1/fim/completions` (fill-in-the-middle). Destination provider must use a `fim.*` transformer (`fim.mistral`, `fim.deepseek`, or `fim.qwen`). Setup for Codestral and local Qwen (LM Studio): `docs/docs/server/api/fim-completions-api.md`.
460
462
  - `image` (beta): Used for handling image-related tasks (supported by CCR’s built-in agent). If the model does not support tool calling, you need to set the `config.forceUseImageAgent` property to `true`.
461
463
 
462
464
  - You can also switch models dynamically in Claude Code with the `/model` command: