Skip to content
Draft
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
7 changes: 3 additions & 4 deletions .github/workflows/pullfrog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,21 @@ jobs:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GOOGLE_GENERATIVE_AI_API_KEY:
${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
XAI_API_KEY: ${{ secrets.XAI_API_KEY }}
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
MOONSHOT_API_KEY: ${{ secrets.MOONSHOT_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}

# for Amazon Bedrock (https://docs.pullfrog.com/bedrock)
# AWS_BEARER_TOKEN_BEDROCK: ${{ secrets.AWS_BEARER_TOKEN_BEDROCK }}
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_REGION: us-east-1
# BEDROCK_MODEL_ID: <bedrock-model-id>

# for Google Vertex AI (https://docs.pullfrog.com/vertex)
# VERTEX_SERVICE_ACCOUNT_JSON: ${{ secrets.VERTEX_SERVICE_ACCOUNT_JSON }}
# GOOGLE_CLOUD_PROJECT: my-project
Expand Down
9 changes: 5 additions & 4 deletions lua/CopilotChat/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,11 @@ function Client:ask(opts)
local headers = self:authenticate(provider_name)
local resolved_model = provider.resolve_model(headers, opts.model)
opts.model = resolved_model
model_config = models[opts.model]
if not model_config then
error('Resolved model not found: ' .. opts.model)
end
-- The resolved model may not be present in the models cache when
-- model_picker_enabled is false for all API models (e.g. restricted accounts).
-- Fall back to the original config (e.g. from the 'auto' entry) so the
-- request can still be sent with the correct model id.
model_config = models[opts.model] or model_config
end

local options = {
Expand Down
15 changes: 11 additions & 4 deletions lua/CopilotChat/config/providers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,18 @@ M.copilot = {
error(err)
end

-- Get all chat models, preferring those with model_picker_enabled.
-- Fall back to all chat models if none are picker-enabled (e.g. restricted accounts).
local all_chat_data = vim.tbl_filter(function(model)
return model.capabilities and model.capabilities.type == 'chat'
end, response.body.data)

local picker_enabled_data = vim.tbl_filter(function(model)
return model.model_picker_enabled
end, all_chat_data)

local models = vim
.iter(response.body.data)
:filter(function(model)
return model.capabilities.type == 'chat' and model.model_picker_enabled
end)
.iter(#picker_enabled_data > 0 and picker_enabled_data or all_chat_data)
:map(function(model)
local supported_endpoints = model.supported_endpoints or {}
-- Pre-compute whether this model uses the Responses API
Expand Down
Loading