Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ Aictrl reads config from `.aictrl/` (project) or `~/.config/aictrl/` (global).
| Google | `GOOGLE_API_KEY` |
| OpenRouter | `OPENROUTER_API_KEY` |

Use `--variant` to select provider-specific reasoning effort. For OpenAI-compatible
Ollama models, `--variant none` sends `reasoning_effort: "none"` to disable
thinking; model `options` can also set `reasoning_effort: "none"` directly.

## Local Development

```bash
Expand Down
11 changes: 9 additions & 2 deletions packages/cli/src/provider/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,12 @@ export namespace ProviderTransform {
const OPENAI_EFFORTS = ["none", "minimal", ...WIDELY_SUPPORTED_EFFORTS, "xhigh"]

export function variants(model: Provider.Model): Record<string, Record<string, any>> {
if (!model.capabilities.reasoning) return {}
if (!model.capabilities.reasoning) {
if (model.api.npm === "@ai-sdk/openai-compatible") {
return { none: { reasoningEffort: "none" } }
}
return {}
}

const id = model.id.toLowerCase()
const isAnthropicAdaptive = ["opus-4-6", "opus-4.6", "sonnet-4-6", "sonnet-4.6"].some((v) =>
Expand Down Expand Up @@ -464,9 +469,11 @@ export namespace ProviderTransform {
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/deepinfra
case "venice-ai-sdk-provider":
// https://docs.venice.ai/overview/guides/reasoning-models#reasoning-effort
case "@ai-sdk/openai-compatible":
return Object.fromEntries(WIDELY_SUPPORTED_EFFORTS.map((effort) => [effort, { reasoningEffort: effort }]))

case "@ai-sdk/openai-compatible":
return Object.fromEntries(OPENAI_EFFORTS.map((effort) => [effort, { reasoningEffort: effort }]))

case "@ai-sdk/azure":
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/azure
if (id === "o1-mini") return {}
Expand Down
23 changes: 21 additions & 2 deletions packages/cli/test/provider/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,7 @@ describe("ProviderTransform.variants", () => {
})

describe("@ai-sdk/openai-compatible", () => {
test("returns WIDELY_SUPPORTED_EFFORTS with reasoningEffort", () => {
test("returns OPENAI_EFFORTS with reasoningEffort", () => {
const model = createMockModel({
id: "custom-provider/custom-model",
providerID: "custom-provider",
Expand All @@ -2002,10 +2002,29 @@ describe("ProviderTransform.variants", () => {
},
})
const result = ProviderTransform.variants(model)
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
expect(Object.keys(result)).toEqual(["none", "minimal", "low", "medium", "high", "xhigh"])
expect(result.none).toEqual({ reasoningEffort: "none" })
expect(result.minimal).toEqual({ reasoningEffort: "minimal" })
expect(result.low).toEqual({ reasoningEffort: "low" })
expect(result.high).toEqual({ reasoningEffort: "high" })
})

test("returns none variant without reasoning capability", () => {
const model = createMockModel({
id: "ollama/qwen3",
providerID: "ollama",
api: {
id: "qwen3",
url: "http://localhost:11434/v1",
npm: "@ai-sdk/openai-compatible",
},
capabilities: {
reasoning: false,
},
})
const result = ProviderTransform.variants(model)
expect(result).toEqual({ none: { reasoningEffort: "none" } })
})
})

describe("@ai-sdk/azure", () => {
Expand Down