vim.pack.add({ { src = "https://github.com/milanglacier/minuet-ai.nvim" }, }) local function opencode_go_api_key() local ok, lines = pcall(vim.fn.readfile, vim.fn.expand("~/.local/share/opencode/auth.json")) if not ok then return nil end local ok_decode, auth = pcall(vim.fn.json_decode, table.concat(lines, "\n")) if not ok_decode or not auth["opencode-go"] or not auth["opencode-go"].key then return nil end return auth["opencode-go"].key end local function setup_minuet() pcall(require("minuet").setup, { provider = "openai_compatible", request_timeout = 2.5, throttle = 1500, debounce = 600, provider_options = { openai_compatible = { api_key = opencode_go_api_key, end_point = "https://opencode.ai/zen/go/v1/chat/completions", model = "deepseek-v4-flash", name = "Opencode", optional = { max_tokens = 56, top_p = 0.9, thinking = { type = "disabled" }, }, }, }, }) end setup_minuet() vim.api.nvim_create_autocmd("PackChanged", { callback = function(ev) if ev.data.spec.name == "minuet-ai.nvim" then setup_minuet() end end, })