From 1f0f44ede0629405a5a6a67527bb8b8c6872b624 Mon Sep 17 00:00:00 2001 From: di-sukharev Date: Sun, 15 Jun 2025 12:17:18 +0300 Subject: [PATCH] build --- out/cli.cjs | 387 +++++++++++++++++++++++++++++++++++++++++- out/github-action.cjs | 385 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 763 insertions(+), 9 deletions(-) diff --git a/out/cli.cjs b/out/cli.cjs index b511b57..78f58f8 100755 --- a/out/cli.cjs +++ b/out/cli.cjs @@ -47672,7 +47672,7 @@ function G3(t2, e3) { // package.json var package_default = { name: "opencommit", - version: "3.2.8", + version: "3.2.9", description: "Auto-generate impressive commits in 1 second. Killing lame commits with AI \u{1F92F}\u{1F52B}", keywords: [ "git", @@ -50371,7 +50371,338 @@ var MODEL_LIST = { "mistral-moderation-2411", "mistral-moderation-latest" ], - deepseek: ["deepseek-chat", "deepseek-reasoner"] + deepseek: ["deepseek-chat", "deepseek-reasoner"], + // OpenRouter available models + // input_modalities: 'text' + // output_modalities: 'text' + // https://openrouter.ai/api/v1/models + openrouter: [ + "openai/gpt-4o-mini", + // used by default + "01-ai/yi-large", + "aetherwiing/mn-starcannon-12b", + "agentica-org/deepcoder-14b-preview:free", + "ai21/jamba-1.6-large", + "ai21/jamba-1.6-mini", + "aion-labs/aion-1.0", + "aion-labs/aion-1.0-mini", + "aion-labs/aion-rp-llama-3.1-8b", + "alfredpros/codellama-7b-instruct-solidity", + "all-hands/openhands-lm-32b-v0.1", + "alpindale/goliath-120b", + "alpindale/magnum-72b", + "amazon/nova-lite-v1", + "amazon/nova-micro-v1", + "amazon/nova-pro-v1", + "anthracite-org/magnum-v2-72b", + "anthracite-org/magnum-v4-72b", + "anthropic/claude-2", + "anthropic/claude-2.0", + "anthropic/claude-2.0:beta", + "anthropic/claude-2.1", + "anthropic/claude-2.1:beta", + "anthropic/claude-2:beta", + "anthropic/claude-3-haiku", + "anthropic/claude-3-haiku:beta", + "anthropic/claude-3-opus", + "anthropic/claude-3-opus:beta", + "anthropic/claude-3-sonnet", + "anthropic/claude-3-sonnet:beta", + "anthropic/claude-3.5-haiku", + "anthropic/claude-3.5-haiku-20241022", + "anthropic/claude-3.5-haiku-20241022:beta", + "anthropic/claude-3.5-haiku:beta", + "anthropic/claude-3.5-sonnet", + "anthropic/claude-3.5-sonnet-20240620", + "anthropic/claude-3.5-sonnet-20240620:beta", + "anthropic/claude-3.5-sonnet:beta", + "anthropic/claude-3.7-sonnet", + "anthropic/claude-3.7-sonnet:beta", + "anthropic/claude-3.7-sonnet:thinking", + "anthropic/claude-opus-4", + "anthropic/claude-sonnet-4", + "arcee-ai/arcee-blitz", + "arcee-ai/caller-large", + "arcee-ai/coder-large", + "arcee-ai/maestro-reasoning", + "arcee-ai/spotlight", + "arcee-ai/virtuoso-large", + "arcee-ai/virtuoso-medium-v2", + "arliai/qwq-32b-arliai-rpr-v1:free", + "cognitivecomputations/dolphin-mixtral-8x22b", + "cognitivecomputations/dolphin3.0-mistral-24b:free", + "cognitivecomputations/dolphin3.0-r1-mistral-24b:free", + "cohere/command", + "cohere/command-a", + "cohere/command-r", + "cohere/command-r-03-2024", + "cohere/command-r-08-2024", + "cohere/command-r-plus", + "cohere/command-r-plus-04-2024", + "cohere/command-r-plus-08-2024", + "cohere/command-r7b-12-2024", + "deepseek/deepseek-chat", + "deepseek/deepseek-chat-v3-0324", + "deepseek/deepseek-chat-v3-0324:free", + "deepseek/deepseek-chat:free", + "deepseek/deepseek-prover-v2", + "deepseek/deepseek-prover-v2:free", + "deepseek/deepseek-r1", + "deepseek/deepseek-r1-0528", + "deepseek/deepseek-r1-0528-qwen3-8b", + "deepseek/deepseek-r1-0528-qwen3-8b:free", + "deepseek/deepseek-r1-0528:free", + "deepseek/deepseek-r1-distill-llama-70b", + "deepseek/deepseek-r1-distill-llama-70b:free", + "deepseek/deepseek-r1-distill-llama-8b", + "deepseek/deepseek-r1-distill-qwen-1.5b", + "deepseek/deepseek-r1-distill-qwen-14b", + "deepseek/deepseek-r1-distill-qwen-14b:free", + "deepseek/deepseek-r1-distill-qwen-32b", + "deepseek/deepseek-r1-distill-qwen-32b:free", + "deepseek/deepseek-r1-distill-qwen-7b", + "deepseek/deepseek-r1-zero:free", + "deepseek/deepseek-r1:free", + "deepseek/deepseek-v3-base:free", + "eleutherai/llemma_7b", + "eva-unit-01/eva-llama-3.33-70b", + "eva-unit-01/eva-qwen-2.5-32b", + "eva-unit-01/eva-qwen-2.5-72b", + "featherless/qwerky-72b:free", + "google/gemini-2.0-flash-001", + "google/gemini-2.0-flash-exp:free", + "google/gemini-2.0-flash-lite-001", + "google/gemini-2.5-flash-preview", + "google/gemini-2.5-flash-preview-05-20", + "google/gemini-2.5-flash-preview-05-20:thinking", + "google/gemini-2.5-flash-preview:thinking", + "google/gemini-2.5-pro-exp-03-25", + "google/gemini-2.5-pro-preview", + "google/gemini-2.5-pro-preview-05-06", + "google/gemini-flash-1.5", + "google/gemini-flash-1.5-8b", + "google/gemini-pro-1.5", + "google/gemma-2-27b-it", + "google/gemma-2-9b-it", + "google/gemma-2-9b-it:free", + "google/gemma-3-12b-it", + "google/gemma-3-12b-it:free", + "google/gemma-3-1b-it:free", + "google/gemma-3-27b-it", + "google/gemma-3-27b-it:free", + "google/gemma-3-4b-it", + "google/gemma-3-4b-it:free", + "google/gemma-3n-e4b-it:free", + "gryphe/mythomax-l2-13b", + "inception/mercury-coder-small-beta", + "infermatic/mn-inferor-12b", + "inflection/inflection-3-pi", + "inflection/inflection-3-productivity", + "liquid/lfm-3b", + "liquid/lfm-40b", + "liquid/lfm-7b", + "mancer/weaver", + "meta-llama/llama-2-70b-chat", + "meta-llama/llama-3-70b-instruct", + "meta-llama/llama-3-8b-instruct", + "meta-llama/llama-3.1-405b", + "meta-llama/llama-3.1-405b-instruct", + "meta-llama/llama-3.1-405b:free", + "meta-llama/llama-3.1-70b-instruct", + "meta-llama/llama-3.1-8b-instruct", + "meta-llama/llama-3.1-8b-instruct:free", + "meta-llama/llama-3.2-11b-vision-instruct", + "meta-llama/llama-3.2-11b-vision-instruct:free", + "meta-llama/llama-3.2-1b-instruct", + "meta-llama/llama-3.2-1b-instruct:free", + "meta-llama/llama-3.2-3b-instruct", + "meta-llama/llama-3.2-3b-instruct:free", + "meta-llama/llama-3.2-90b-vision-instruct", + "meta-llama/llama-3.3-70b-instruct", + "meta-llama/llama-3.3-70b-instruct:free", + "meta-llama/llama-3.3-8b-instruct:free", + "meta-llama/llama-4-maverick", + "meta-llama/llama-4-maverick:free", + "meta-llama/llama-4-scout", + "meta-llama/llama-4-scout:free", + "meta-llama/llama-guard-2-8b", + "meta-llama/llama-guard-3-8b", + "meta-llama/llama-guard-4-12b", + "microsoft/mai-ds-r1:free", + "microsoft/phi-3-medium-128k-instruct", + "microsoft/phi-3-mini-128k-instruct", + "microsoft/phi-3.5-mini-128k-instruct", + "microsoft/phi-4", + "microsoft/phi-4-multimodal-instruct", + "microsoft/phi-4-reasoning-plus", + "microsoft/phi-4-reasoning-plus:free", + "microsoft/phi-4-reasoning:free", + "microsoft/wizardlm-2-8x22b", + "minimax/minimax-01", + "mistralai/codestral-2501", + "mistralai/devstral-small", + "mistralai/devstral-small:free", + "mistralai/magistral-medium-2506", + "mistralai/magistral-medium-2506:thinking", + "mistralai/magistral-small-2506", + "mistralai/ministral-3b", + "mistralai/ministral-8b", + "mistralai/mistral-7b-instruct", + "mistralai/mistral-7b-instruct-v0.1", + "mistralai/mistral-7b-instruct-v0.2", + "mistralai/mistral-7b-instruct-v0.3", + "mistralai/mistral-7b-instruct:free", + "mistralai/mistral-large", + "mistralai/mistral-large-2407", + "mistralai/mistral-large-2411", + "mistralai/mistral-medium", + "mistralai/mistral-medium-3", + "mistralai/mistral-nemo", + "mistralai/mistral-nemo:free", + "mistralai/mistral-saba", + "mistralai/mistral-small", + "mistralai/mistral-small-24b-instruct-2501", + "mistralai/mistral-small-24b-instruct-2501:free", + "mistralai/mistral-small-3.1-24b-instruct", + "mistralai/mistral-small-3.1-24b-instruct:free", + "mistralai/mistral-tiny", + "mistralai/mixtral-8x22b-instruct", + "mistralai/mixtral-8x7b-instruct", + "mistralai/pixtral-12b", + "mistralai/pixtral-large-2411", + "moonshotai/kimi-vl-a3b-thinking:free", + "moonshotai/moonlight-16b-a3b-instruct:free", + "neversleep/llama-3-lumimaid-70b", + "neversleep/llama-3-lumimaid-8b", + "neversleep/llama-3.1-lumimaid-70b", + "neversleep/llama-3.1-lumimaid-8b", + "neversleep/noromaid-20b", + "nothingiisreal/mn-celeste-12b", + "nousresearch/deephermes-3-llama-3-8b-preview:free", + "nousresearch/deephermes-3-mistral-24b-preview:free", + "nousresearch/hermes-2-pro-llama-3-8b", + "nousresearch/hermes-3-llama-3.1-405b", + "nousresearch/hermes-3-llama-3.1-70b", + "nousresearch/nous-hermes-2-mixtral-8x7b-dpo", + "nvidia/llama-3.1-nemotron-70b-instruct", + "nvidia/llama-3.1-nemotron-ultra-253b-v1", + "nvidia/llama-3.1-nemotron-ultra-253b-v1:free", + "nvidia/llama-3.3-nemotron-super-49b-v1", + "nvidia/llama-3.3-nemotron-super-49b-v1:free", + "open-r1/olympiccoder-32b:free", + "openai/chatgpt-4o-latest", + "openai/codex-mini", + "openai/gpt-3.5-turbo", + "openai/gpt-3.5-turbo-0125", + "openai/gpt-3.5-turbo-0613", + "openai/gpt-3.5-turbo-1106", + "openai/gpt-3.5-turbo-16k", + "openai/gpt-3.5-turbo-instruct", + "openai/gpt-4", + "openai/gpt-4-0314", + "openai/gpt-4-1106-preview", + "openai/gpt-4-turbo", + "openai/gpt-4-turbo-preview", + "openai/gpt-4.1", + "openai/gpt-4.1-mini", + "openai/gpt-4.1-nano", + "openai/gpt-4.5-preview", + "openai/gpt-4o", + "openai/gpt-4o-2024-05-13", + "openai/gpt-4o-2024-08-06", + "openai/gpt-4o-2024-11-20", + "openai/gpt-4o-mini-2024-07-18", + "openai/gpt-4o-mini-search-preview", + "openai/gpt-4o-search-preview", + "openai/gpt-4o:extended", + "openai/o1", + "openai/o1-mini", + "openai/o1-mini-2024-09-12", + "openai/o1-preview", + "openai/o1-preview-2024-09-12", + "openai/o1-pro", + "openai/o3", + "openai/o3-mini", + "openai/o3-mini-high", + "openai/o3-pro", + "openai/o4-mini", + "openai/o4-mini-high", + "opengvlab/internvl3-14b:free", + "opengvlab/internvl3-2b:free", + "openrouter/auto", + "perplexity/llama-3.1-sonar-large-128k-online", + "perplexity/llama-3.1-sonar-small-128k-online", + "perplexity/r1-1776", + "perplexity/sonar", + "perplexity/sonar-deep-research", + "perplexity/sonar-pro", + "perplexity/sonar-reasoning", + "perplexity/sonar-reasoning-pro", + "pygmalionai/mythalion-13b", + "qwen/qwen-2-72b-instruct", + "qwen/qwen-2.5-72b-instruct", + "qwen/qwen-2.5-72b-instruct:free", + "qwen/qwen-2.5-7b-instruct", + "qwen/qwen-2.5-7b-instruct:free", + "qwen/qwen-2.5-coder-32b-instruct", + "qwen/qwen-2.5-coder-32b-instruct:free", + "qwen/qwen-2.5-vl-7b-instruct", + "qwen/qwen-2.5-vl-7b-instruct:free", + "qwen/qwen-max", + "qwen/qwen-plus", + "qwen/qwen-turbo", + "qwen/qwen-vl-max", + "qwen/qwen-vl-plus", + "qwen/qwen2.5-vl-32b-instruct", + "qwen/qwen2.5-vl-32b-instruct:free", + "qwen/qwen2.5-vl-3b-instruct:free", + "qwen/qwen2.5-vl-72b-instruct", + "qwen/qwen2.5-vl-72b-instruct:free", + "qwen/qwen3-14b", + "qwen/qwen3-14b:free", + "qwen/qwen3-235b-a22b", + "qwen/qwen3-235b-a22b:free", + "qwen/qwen3-30b-a3b", + "qwen/qwen3-30b-a3b:free", + "qwen/qwen3-32b", + "qwen/qwen3-32b:free", + "qwen/qwen3-8b", + "qwen/qwen3-8b:free", + "qwen/qwq-32b", + "qwen/qwq-32b-preview", + "qwen/qwq-32b:free", + "raifle/sorcererlm-8x22b", + "rekaai/reka-flash-3:free", + "sao10k/fimbulvetr-11b-v2", + "sao10k/l3-euryale-70b", + "sao10k/l3-lunaris-8b", + "sao10k/l3.1-euryale-70b", + "sao10k/l3.3-euryale-70b", + "sarvamai/sarvam-m:free", + "scb10x/llama3.1-typhoon2-70b-instruct", + "sentientagi/dobby-mini-unhinged-plus-llama-3.1-8b", + "shisa-ai/shisa-v2-llama3.3-70b:free", + "sophosympatheia/midnight-rose-70b", + "thedrummer/anubis-pro-105b-v1", + "thedrummer/rocinante-12b", + "thedrummer/skyfall-36b-v2", + "thedrummer/unslopnemo-12b", + "thedrummer/valkyrie-49b-v1", + "thudm/glm-4-32b", + "thudm/glm-4-32b:free", + "thudm/glm-z1-32b", + "thudm/glm-z1-32b:free", + "thudm/glm-z1-rumination-32b", + "tngtech/deepseek-r1t-chimera:free", + "undi95/remm-slerp-l2-13b", + "undi95/toppy-m-7b", + "x-ai/grok-2-1212", + "x-ai/grok-2-vision-1212", + "x-ai/grok-3-beta", + "x-ai/grok-3-mini-beta", + "x-ai/grok-beta", + "x-ai/grok-vision-beta" + ] }; var getDefaultModel = (provider) => { switch (provider) { @@ -50389,6 +50720,8 @@ var getDefaultModel = (provider) => { return MODEL_LIST.mistral[0]; case "deepseek": return MODEL_LIST.deepseek[0]; + case "openrouter": + return MODEL_LIST.openrouter[0]; default: return MODEL_LIST.openai[0]; } @@ -50542,7 +50875,8 @@ var configValidators = { "test", "flowise", "groq", - "deepseek" + "deepseek", + "openrouter" ].includes(value) || value.startsWith("ollama"), `${value} is not supported yet, use 'ollama', 'mlx', 'anthropic', 'azure', 'gemini', 'flowise', 'mistral', 'deepseek' or 'openai' (default)` ); @@ -50587,6 +50921,7 @@ var OCO_AI_PROVIDER_ENUM = /* @__PURE__ */ ((OCO_AI_PROVIDER_ENUM2) => { OCO_AI_PROVIDER_ENUM2["MISTRAL"] = "mistral"; OCO_AI_PROVIDER_ENUM2["MLX"] = "mlx"; OCO_AI_PROVIDER_ENUM2["DEEPSEEK"] = "deepseek"; + OCO_AI_PROVIDER_ENUM2["OPENROUTER"] = "openrouter"; return OCO_AI_PROVIDER_ENUM2; })(OCO_AI_PROVIDER_ENUM || {}); var defaultConfigPath = (0, import_path.join)((0, import_os.homedir)(), ".opencommit"); @@ -50874,7 +51209,11 @@ ${key}:`)); } } } - console.log(source_default.yellow('\nUse "oco config describe [PARAMETER]" to see accepted values and more details for a specific config parameter.')); + console.log( + source_default.yellow( + '\nUse "oco config describe [PARAMETER]" to see accepted values and more details for a specific config parameter.' + ) + ); } var configCommand = G3( { @@ -66182,6 +66521,40 @@ var DeepseekEngine = class extends OpenAiEngine { } }; +// src/engine/openrouter.ts +var OpenRouterEngine = class { + constructor(config7) { + this.config = config7; + this.generateCommitMessage = async (messages) => { + try { + const response = await this.client.post("", { + model: this.config.model, + messages + }); + const message = response.data.choices[0].message; + let content = message?.content; + return removeContentTags(content, "think"); + } catch (error) { + const err = error; + if (axios_default.isAxiosError(error) && error.response?.status === 401) { + const openRouterError = error.response.data.error; + if (openRouterError) throw new Error(openRouterError.message); + } + throw err; + } + }; + this.client = axios_default.create({ + baseURL: "https://openrouter.ai/api/v1/chat/completions", + headers: { + Authorization: `Bearer ${config7.apiKey}`, + "HTTP-Referer": "https://github.com/di-sukharev/opencommit", + "X-Title": "OpenCommit", + "Content-Type": "application/json" + } + }); + } +}; + // src/utils/engine.ts function parseCustomHeaders(headers) { let parsedHeaders = {}; @@ -66195,7 +66568,9 @@ function parseCustomHeaders(headers) { parsedHeaders = JSON.parse(headers); } } catch (error) { - console.warn("Invalid OCO_API_CUSTOM_HEADERS format, ignoring custom headers"); + console.warn( + "Invalid OCO_API_CUSTOM_HEADERS format, ignoring custom headers" + ); } return parsedHeaders; } @@ -66232,6 +66607,8 @@ function getEngine() { return new MLXEngine(DEFAULT_CONFIG2); case "deepseek" /* DEEPSEEK */: return new DeepseekEngine(DEFAULT_CONFIG2); + case "openrouter" /* OPENROUTER */: + return new OpenRouterEngine(DEFAULT_CONFIG2); default: return new OpenAiEngine(DEFAULT_CONFIG2); } diff --git a/out/github-action.cjs b/out/github-action.cjs index 562eec4..d0496f4 100644 --- a/out/github-action.cjs +++ b/out/github-action.cjs @@ -70984,7 +70984,338 @@ var MODEL_LIST = { "mistral-moderation-2411", "mistral-moderation-latest" ], - deepseek: ["deepseek-chat", "deepseek-reasoner"] + deepseek: ["deepseek-chat", "deepseek-reasoner"], + // OpenRouter available models + // input_modalities: 'text' + // output_modalities: 'text' + // https://openrouter.ai/api/v1/models + openrouter: [ + "openai/gpt-4o-mini", + // used by default + "01-ai/yi-large", + "aetherwiing/mn-starcannon-12b", + "agentica-org/deepcoder-14b-preview:free", + "ai21/jamba-1.6-large", + "ai21/jamba-1.6-mini", + "aion-labs/aion-1.0", + "aion-labs/aion-1.0-mini", + "aion-labs/aion-rp-llama-3.1-8b", + "alfredpros/codellama-7b-instruct-solidity", + "all-hands/openhands-lm-32b-v0.1", + "alpindale/goliath-120b", + "alpindale/magnum-72b", + "amazon/nova-lite-v1", + "amazon/nova-micro-v1", + "amazon/nova-pro-v1", + "anthracite-org/magnum-v2-72b", + "anthracite-org/magnum-v4-72b", + "anthropic/claude-2", + "anthropic/claude-2.0", + "anthropic/claude-2.0:beta", + "anthropic/claude-2.1", + "anthropic/claude-2.1:beta", + "anthropic/claude-2:beta", + "anthropic/claude-3-haiku", + "anthropic/claude-3-haiku:beta", + "anthropic/claude-3-opus", + "anthropic/claude-3-opus:beta", + "anthropic/claude-3-sonnet", + "anthropic/claude-3-sonnet:beta", + "anthropic/claude-3.5-haiku", + "anthropic/claude-3.5-haiku-20241022", + "anthropic/claude-3.5-haiku-20241022:beta", + "anthropic/claude-3.5-haiku:beta", + "anthropic/claude-3.5-sonnet", + "anthropic/claude-3.5-sonnet-20240620", + "anthropic/claude-3.5-sonnet-20240620:beta", + "anthropic/claude-3.5-sonnet:beta", + "anthropic/claude-3.7-sonnet", + "anthropic/claude-3.7-sonnet:beta", + "anthropic/claude-3.7-sonnet:thinking", + "anthropic/claude-opus-4", + "anthropic/claude-sonnet-4", + "arcee-ai/arcee-blitz", + "arcee-ai/caller-large", + "arcee-ai/coder-large", + "arcee-ai/maestro-reasoning", + "arcee-ai/spotlight", + "arcee-ai/virtuoso-large", + "arcee-ai/virtuoso-medium-v2", + "arliai/qwq-32b-arliai-rpr-v1:free", + "cognitivecomputations/dolphin-mixtral-8x22b", + "cognitivecomputations/dolphin3.0-mistral-24b:free", + "cognitivecomputations/dolphin3.0-r1-mistral-24b:free", + "cohere/command", + "cohere/command-a", + "cohere/command-r", + "cohere/command-r-03-2024", + "cohere/command-r-08-2024", + "cohere/command-r-plus", + "cohere/command-r-plus-04-2024", + "cohere/command-r-plus-08-2024", + "cohere/command-r7b-12-2024", + "deepseek/deepseek-chat", + "deepseek/deepseek-chat-v3-0324", + "deepseek/deepseek-chat-v3-0324:free", + "deepseek/deepseek-chat:free", + "deepseek/deepseek-prover-v2", + "deepseek/deepseek-prover-v2:free", + "deepseek/deepseek-r1", + "deepseek/deepseek-r1-0528", + "deepseek/deepseek-r1-0528-qwen3-8b", + "deepseek/deepseek-r1-0528-qwen3-8b:free", + "deepseek/deepseek-r1-0528:free", + "deepseek/deepseek-r1-distill-llama-70b", + "deepseek/deepseek-r1-distill-llama-70b:free", + "deepseek/deepseek-r1-distill-llama-8b", + "deepseek/deepseek-r1-distill-qwen-1.5b", + "deepseek/deepseek-r1-distill-qwen-14b", + "deepseek/deepseek-r1-distill-qwen-14b:free", + "deepseek/deepseek-r1-distill-qwen-32b", + "deepseek/deepseek-r1-distill-qwen-32b:free", + "deepseek/deepseek-r1-distill-qwen-7b", + "deepseek/deepseek-r1-zero:free", + "deepseek/deepseek-r1:free", + "deepseek/deepseek-v3-base:free", + "eleutherai/llemma_7b", + "eva-unit-01/eva-llama-3.33-70b", + "eva-unit-01/eva-qwen-2.5-32b", + "eva-unit-01/eva-qwen-2.5-72b", + "featherless/qwerky-72b:free", + "google/gemini-2.0-flash-001", + "google/gemini-2.0-flash-exp:free", + "google/gemini-2.0-flash-lite-001", + "google/gemini-2.5-flash-preview", + "google/gemini-2.5-flash-preview-05-20", + "google/gemini-2.5-flash-preview-05-20:thinking", + "google/gemini-2.5-flash-preview:thinking", + "google/gemini-2.5-pro-exp-03-25", + "google/gemini-2.5-pro-preview", + "google/gemini-2.5-pro-preview-05-06", + "google/gemini-flash-1.5", + "google/gemini-flash-1.5-8b", + "google/gemini-pro-1.5", + "google/gemma-2-27b-it", + "google/gemma-2-9b-it", + "google/gemma-2-9b-it:free", + "google/gemma-3-12b-it", + "google/gemma-3-12b-it:free", + "google/gemma-3-1b-it:free", + "google/gemma-3-27b-it", + "google/gemma-3-27b-it:free", + "google/gemma-3-4b-it", + "google/gemma-3-4b-it:free", + "google/gemma-3n-e4b-it:free", + "gryphe/mythomax-l2-13b", + "inception/mercury-coder-small-beta", + "infermatic/mn-inferor-12b", + "inflection/inflection-3-pi", + "inflection/inflection-3-productivity", + "liquid/lfm-3b", + "liquid/lfm-40b", + "liquid/lfm-7b", + "mancer/weaver", + "meta-llama/llama-2-70b-chat", + "meta-llama/llama-3-70b-instruct", + "meta-llama/llama-3-8b-instruct", + "meta-llama/llama-3.1-405b", + "meta-llama/llama-3.1-405b-instruct", + "meta-llama/llama-3.1-405b:free", + "meta-llama/llama-3.1-70b-instruct", + "meta-llama/llama-3.1-8b-instruct", + "meta-llama/llama-3.1-8b-instruct:free", + "meta-llama/llama-3.2-11b-vision-instruct", + "meta-llama/llama-3.2-11b-vision-instruct:free", + "meta-llama/llama-3.2-1b-instruct", + "meta-llama/llama-3.2-1b-instruct:free", + "meta-llama/llama-3.2-3b-instruct", + "meta-llama/llama-3.2-3b-instruct:free", + "meta-llama/llama-3.2-90b-vision-instruct", + "meta-llama/llama-3.3-70b-instruct", + "meta-llama/llama-3.3-70b-instruct:free", + "meta-llama/llama-3.3-8b-instruct:free", + "meta-llama/llama-4-maverick", + "meta-llama/llama-4-maverick:free", + "meta-llama/llama-4-scout", + "meta-llama/llama-4-scout:free", + "meta-llama/llama-guard-2-8b", + "meta-llama/llama-guard-3-8b", + "meta-llama/llama-guard-4-12b", + "microsoft/mai-ds-r1:free", + "microsoft/phi-3-medium-128k-instruct", + "microsoft/phi-3-mini-128k-instruct", + "microsoft/phi-3.5-mini-128k-instruct", + "microsoft/phi-4", + "microsoft/phi-4-multimodal-instruct", + "microsoft/phi-4-reasoning-plus", + "microsoft/phi-4-reasoning-plus:free", + "microsoft/phi-4-reasoning:free", + "microsoft/wizardlm-2-8x22b", + "minimax/minimax-01", + "mistralai/codestral-2501", + "mistralai/devstral-small", + "mistralai/devstral-small:free", + "mistralai/magistral-medium-2506", + "mistralai/magistral-medium-2506:thinking", + "mistralai/magistral-small-2506", + "mistralai/ministral-3b", + "mistralai/ministral-8b", + "mistralai/mistral-7b-instruct", + "mistralai/mistral-7b-instruct-v0.1", + "mistralai/mistral-7b-instruct-v0.2", + "mistralai/mistral-7b-instruct-v0.3", + "mistralai/mistral-7b-instruct:free", + "mistralai/mistral-large", + "mistralai/mistral-large-2407", + "mistralai/mistral-large-2411", + "mistralai/mistral-medium", + "mistralai/mistral-medium-3", + "mistralai/mistral-nemo", + "mistralai/mistral-nemo:free", + "mistralai/mistral-saba", + "mistralai/mistral-small", + "mistralai/mistral-small-24b-instruct-2501", + "mistralai/mistral-small-24b-instruct-2501:free", + "mistralai/mistral-small-3.1-24b-instruct", + "mistralai/mistral-small-3.1-24b-instruct:free", + "mistralai/mistral-tiny", + "mistralai/mixtral-8x22b-instruct", + "mistralai/mixtral-8x7b-instruct", + "mistralai/pixtral-12b", + "mistralai/pixtral-large-2411", + "moonshotai/kimi-vl-a3b-thinking:free", + "moonshotai/moonlight-16b-a3b-instruct:free", + "neversleep/llama-3-lumimaid-70b", + "neversleep/llama-3-lumimaid-8b", + "neversleep/llama-3.1-lumimaid-70b", + "neversleep/llama-3.1-lumimaid-8b", + "neversleep/noromaid-20b", + "nothingiisreal/mn-celeste-12b", + "nousresearch/deephermes-3-llama-3-8b-preview:free", + "nousresearch/deephermes-3-mistral-24b-preview:free", + "nousresearch/hermes-2-pro-llama-3-8b", + "nousresearch/hermes-3-llama-3.1-405b", + "nousresearch/hermes-3-llama-3.1-70b", + "nousresearch/nous-hermes-2-mixtral-8x7b-dpo", + "nvidia/llama-3.1-nemotron-70b-instruct", + "nvidia/llama-3.1-nemotron-ultra-253b-v1", + "nvidia/llama-3.1-nemotron-ultra-253b-v1:free", + "nvidia/llama-3.3-nemotron-super-49b-v1", + "nvidia/llama-3.3-nemotron-super-49b-v1:free", + "open-r1/olympiccoder-32b:free", + "openai/chatgpt-4o-latest", + "openai/codex-mini", + "openai/gpt-3.5-turbo", + "openai/gpt-3.5-turbo-0125", + "openai/gpt-3.5-turbo-0613", + "openai/gpt-3.5-turbo-1106", + "openai/gpt-3.5-turbo-16k", + "openai/gpt-3.5-turbo-instruct", + "openai/gpt-4", + "openai/gpt-4-0314", + "openai/gpt-4-1106-preview", + "openai/gpt-4-turbo", + "openai/gpt-4-turbo-preview", + "openai/gpt-4.1", + "openai/gpt-4.1-mini", + "openai/gpt-4.1-nano", + "openai/gpt-4.5-preview", + "openai/gpt-4o", + "openai/gpt-4o-2024-05-13", + "openai/gpt-4o-2024-08-06", + "openai/gpt-4o-2024-11-20", + "openai/gpt-4o-mini-2024-07-18", + "openai/gpt-4o-mini-search-preview", + "openai/gpt-4o-search-preview", + "openai/gpt-4o:extended", + "openai/o1", + "openai/o1-mini", + "openai/o1-mini-2024-09-12", + "openai/o1-preview", + "openai/o1-preview-2024-09-12", + "openai/o1-pro", + "openai/o3", + "openai/o3-mini", + "openai/o3-mini-high", + "openai/o3-pro", + "openai/o4-mini", + "openai/o4-mini-high", + "opengvlab/internvl3-14b:free", + "opengvlab/internvl3-2b:free", + "openrouter/auto", + "perplexity/llama-3.1-sonar-large-128k-online", + "perplexity/llama-3.1-sonar-small-128k-online", + "perplexity/r1-1776", + "perplexity/sonar", + "perplexity/sonar-deep-research", + "perplexity/sonar-pro", + "perplexity/sonar-reasoning", + "perplexity/sonar-reasoning-pro", + "pygmalionai/mythalion-13b", + "qwen/qwen-2-72b-instruct", + "qwen/qwen-2.5-72b-instruct", + "qwen/qwen-2.5-72b-instruct:free", + "qwen/qwen-2.5-7b-instruct", + "qwen/qwen-2.5-7b-instruct:free", + "qwen/qwen-2.5-coder-32b-instruct", + "qwen/qwen-2.5-coder-32b-instruct:free", + "qwen/qwen-2.5-vl-7b-instruct", + "qwen/qwen-2.5-vl-7b-instruct:free", + "qwen/qwen-max", + "qwen/qwen-plus", + "qwen/qwen-turbo", + "qwen/qwen-vl-max", + "qwen/qwen-vl-plus", + "qwen/qwen2.5-vl-32b-instruct", + "qwen/qwen2.5-vl-32b-instruct:free", + "qwen/qwen2.5-vl-3b-instruct:free", + "qwen/qwen2.5-vl-72b-instruct", + "qwen/qwen2.5-vl-72b-instruct:free", + "qwen/qwen3-14b", + "qwen/qwen3-14b:free", + "qwen/qwen3-235b-a22b", + "qwen/qwen3-235b-a22b:free", + "qwen/qwen3-30b-a3b", + "qwen/qwen3-30b-a3b:free", + "qwen/qwen3-32b", + "qwen/qwen3-32b:free", + "qwen/qwen3-8b", + "qwen/qwen3-8b:free", + "qwen/qwq-32b", + "qwen/qwq-32b-preview", + "qwen/qwq-32b:free", + "raifle/sorcererlm-8x22b", + "rekaai/reka-flash-3:free", + "sao10k/fimbulvetr-11b-v2", + "sao10k/l3-euryale-70b", + "sao10k/l3-lunaris-8b", + "sao10k/l3.1-euryale-70b", + "sao10k/l3.3-euryale-70b", + "sarvamai/sarvam-m:free", + "scb10x/llama3.1-typhoon2-70b-instruct", + "sentientagi/dobby-mini-unhinged-plus-llama-3.1-8b", + "shisa-ai/shisa-v2-llama3.3-70b:free", + "sophosympatheia/midnight-rose-70b", + "thedrummer/anubis-pro-105b-v1", + "thedrummer/rocinante-12b", + "thedrummer/skyfall-36b-v2", + "thedrummer/unslopnemo-12b", + "thedrummer/valkyrie-49b-v1", + "thudm/glm-4-32b", + "thudm/glm-4-32b:free", + "thudm/glm-z1-32b", + "thudm/glm-z1-32b:free", + "thudm/glm-z1-rumination-32b", + "tngtech/deepseek-r1t-chimera:free", + "undi95/remm-slerp-l2-13b", + "undi95/toppy-m-7b", + "x-ai/grok-2-1212", + "x-ai/grok-2-vision-1212", + "x-ai/grok-3-beta", + "x-ai/grok-3-mini-beta", + "x-ai/grok-beta", + "x-ai/grok-vision-beta" + ] }; var getDefaultModel = (provider) => { switch (provider) { @@ -71002,6 +71333,8 @@ var getDefaultModel = (provider) => { return MODEL_LIST.mistral[0]; case "deepseek": return MODEL_LIST.deepseek[0]; + case "openrouter": + return MODEL_LIST.openrouter[0]; default: return MODEL_LIST.openai[0]; } @@ -71155,7 +71488,8 @@ var configValidators = { "test", "flowise", "groq", - "deepseek" + "deepseek", + "openrouter" ].includes(value) || value.startsWith("ollama"), `${value} is not supported yet, use 'ollama', 'mlx', 'anthropic', 'azure', 'gemini', 'flowise', 'mistral', 'deepseek' or 'openai' (default)` ); @@ -71200,6 +71534,7 @@ var OCO_AI_PROVIDER_ENUM = /* @__PURE__ */ ((OCO_AI_PROVIDER_ENUM2) => { OCO_AI_PROVIDER_ENUM2["MISTRAL"] = "mistral"; OCO_AI_PROVIDER_ENUM2["MLX"] = "mlx"; OCO_AI_PROVIDER_ENUM2["DEEPSEEK"] = "deepseek"; + OCO_AI_PROVIDER_ENUM2["OPENROUTER"] = "openrouter"; return OCO_AI_PROVIDER_ENUM2; })(OCO_AI_PROVIDER_ENUM || {}); var defaultConfigPath = (0, import_path.join)((0, import_os.homedir)(), ".opencommit"); @@ -71487,7 +71822,11 @@ ${key}:`)); } } } - console.log(source_default.yellow('\nUse "oco config describe [PARAMETER]" to see accepted values and more details for a specific config parameter.')); + console.log( + source_default.yellow( + '\nUse "oco config describe [PARAMETER]" to see accepted values and more details for a specific config parameter.' + ) + ); } var configCommand = G2( { @@ -86795,6 +87134,40 @@ var DeepseekEngine = class extends OpenAiEngine { } }; +// src/engine/openrouter.ts +var OpenRouterEngine = class { + constructor(config6) { + this.config = config6; + this.generateCommitMessage = async (messages) => { + try { + const response = await this.client.post("", { + model: this.config.model, + messages + }); + const message = response.data.choices[0].message; + let content = message?.content; + return removeContentTags(content, "think"); + } catch (error) { + const err = error; + if (axios_default.isAxiosError(error) && error.response?.status === 401) { + const openRouterError = error.response.data.error; + if (openRouterError) throw new Error(openRouterError.message); + } + throw err; + } + }; + this.client = axios_default.create({ + baseURL: "https://openrouter.ai/api/v1/chat/completions", + headers: { + Authorization: `Bearer ${config6.apiKey}`, + "HTTP-Referer": "https://github.com/di-sukharev/opencommit", + "X-Title": "OpenCommit", + "Content-Type": "application/json" + } + }); + } +}; + // src/utils/engine.ts function parseCustomHeaders(headers) { let parsedHeaders = {}; @@ -86808,7 +87181,9 @@ function parseCustomHeaders(headers) { parsedHeaders = JSON.parse(headers); } } catch (error) { - console.warn("Invalid OCO_API_CUSTOM_HEADERS format, ignoring custom headers"); + console.warn( + "Invalid OCO_API_CUSTOM_HEADERS format, ignoring custom headers" + ); } return parsedHeaders; } @@ -86845,6 +87220,8 @@ function getEngine() { return new MLXEngine(DEFAULT_CONFIG2); case "deepseek" /* DEEPSEEK */: return new DeepseekEngine(DEFAULT_CONFIG2); + case "openrouter" /* OPENROUTER */: + return new OpenRouterEngine(DEFAULT_CONFIG2); default: return new OpenAiEngine(DEFAULT_CONFIG2); }