Skip to content

fix: remove mandatory API key check and add LLM gateway support#16

Merged
ccsert merged 1 commit into
mainfrom
fix/issue-13-15-gateway-and-apikey
Apr 30, 2026
Merged

fix: remove mandatory API key check and add LLM gateway support#16
ccsert merged 1 commit into
mainfrom
fix/issue-13-15-gateway-and-apikey

Conversation

@ccsert
Copy link
Copy Markdown
Owner

@ccsert ccsert commented Apr 30, 2026

Summary

Changes

File Change
entrypoint.sh API key check → warning; add LLM_API_KEY, OPENROUTER_API_KEY, OPENAI_BASE_URL recognition; update help text
README.md Add "Using LLM Gateways" section with gateway examples
README_zh.md Add Chinese LLM Gateway docs; update secrets table
templates/workflow-docker.yaml Add OPENAI_BASE_URL env var
templates/workflow-source.yaml Add OPENAI_BASE_URL env var
.gitignore Add packages/ directory

Closes #13, Closes #15

- Change API key validation from hard error to warning (fixes #13)
- Add LLM_API_KEY, OPENROUTER_API_KEY, OPENAI_BASE_URL support
- Add LLM Gateway configuration docs for OpenRouter, LiteLLM, Together AI, NVIDIA NIM, Ollama (fixes #15)
- Add OPENAI_BASE_URL to workflow templates
- Update help output with new environment variables
- Add packages/ to .gitignore
Copilot AI review requested due to automatic review settings April 30, 2026 08:09
@ccsert ccsert merged commit e5785f2 into main Apr 30, 2026
3 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Docker entrypoint and documentation to make LLM API keys optional (warning-only) and to document/configure OpenAI-compatible “LLM gateway” usage via OPENAI_BASE_URL, addressing requests to support free/local models and gateway providers.

Changes:

  • Downgrade Docker-mode LLM API key validation from a hard error to a warning; expand help text to mention gateway/key env vars.
  • Add “Using LLM Gateways” documentation (EN + ZH) with example OPENAI_BASE_URL values for common gateways.
  • Update workflow templates to include commented OPENAI_BASE_URL and ignore packages/ in git.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
entrypoint.sh Removes mandatory LLM key check; adds warning + help output for gateway-related env vars.
README.md Adds LLM gateway usage section and updates secrets table.
README_zh.md Adds Chinese LLM gateway docs and updates secrets table.
templates/workflow-docker.yaml Documents optional OPENAI_BASE_URL in the Docker workflow template.
templates/workflow-source.yaml Documents optional OPENAI_BASE_URL in the source workflow template.
.gitignore Ignores packages/ directory.

Comment thread entrypoint.sh
Comment on lines +65 to +71
# Warn if no LLM API key is set (not fatal - some providers don't need one)
if [ -z "$DEEPSEEK_API_KEY" ] && [ -z "$ANTHROPIC_API_KEY" ] && \
[ -z "$OPENAI_API_KEY" ] && [ -z "$LLM_API_KEY" ] && \
[ -z "$OPENROUTER_API_KEY" ] && [ -z "$OPENAI_BASE_URL" ]; then
log_warn "No LLM API key detected (DEEPSEEK_API_KEY, ANTHROPIC_API_KEY, OPENAI_API_KEY, LLM_API_KEY, OPENROUTER_API_KEY)"
log_warn "If you are using a local model or custom gateway, you can ignore this warning"
log_warn "Set OPENAI_BASE_URL to use an OpenAI-compatible gateway (LiteLLM, OpenRouter, etc.)"
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning message can be misleading when no keys are set because the script will still default to MODEL=deepseek/deepseek-chat (see print_config) which typically requires DEEPSEEK_API_KEY. Consider adjusting the warning to explicitly say that if you keep the default model you still need the corresponding provider key, otherwise set MODEL to a local/gateway-backed provider and/or OPENAI_BASE_URL.

Suggested change
# Warn if no LLM API key is set (not fatal - some providers don't need one)
if [ -z "$DEEPSEEK_API_KEY" ] && [ -z "$ANTHROPIC_API_KEY" ] && \
[ -z "$OPENAI_API_KEY" ] && [ -z "$LLM_API_KEY" ] && \
[ -z "$OPENROUTER_API_KEY" ] && [ -z "$OPENAI_BASE_URL" ]; then
log_warn "No LLM API key detected (DEEPSEEK_API_KEY, ANTHROPIC_API_KEY, OPENAI_API_KEY, LLM_API_KEY, OPENROUTER_API_KEY)"
log_warn "If you are using a local model or custom gateway, you can ignore this warning"
log_warn "Set OPENAI_BASE_URL to use an OpenAI-compatible gateway (LiteLLM, OpenRouter, etc.)"
# Warn if no LLM API key or OpenAI-compatible base URL is set
if [ -z "$DEEPSEEK_API_KEY" ] && [ -z "$ANTHROPIC_API_KEY" ] && \
[ -z "$OPENAI_API_KEY" ] && [ -z "$LLM_API_KEY" ] && \
[ -z "$OPENROUTER_API_KEY" ] && [ -z "$OPENAI_BASE_URL" ]; then
log_warn "No LLM API key or OPENAI_BASE_URL detected (DEEPSEEK_API_KEY, ANTHROPIC_API_KEY, OPENAI_API_KEY, LLM_API_KEY, OPENROUTER_API_KEY)"
log_warn "If you keep the default MODEL=deepseek/deepseek-chat, you still need the corresponding provider key (typically DEEPSEEK_API_KEY)"
log_warn "Only ignore this warning if you set MODEL to a local/gateway-backed provider and/or set OPENAI_BASE_URL for an OpenAI-compatible gateway (LiteLLM, OpenRouter, etc.)"

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +88 to +93
# Point MODEL to an OpenAI-compatible provider
MODEL: openai/your-model-name
OPENAI_API_KEY: ${{ secrets.YOUR_API_KEY }}
# Set the gateway URL
OPENAI_BASE_URL: "https://openrouter.ai/api/v1" # OpenRouter
# OPENAI_BASE_URL: "http://localhost:4000/v1" # LiteLLM
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the gateway example, the snippet uses OPENAI_API_KEY, but the OpenRouter row below says to use OPENROUTER_API_KEY. This is inconsistent and may confuse users (and the default workflow templates only pass OPENAI_API_KEY). Please align the docs to one env var scheme (either document OpenRouter as OPENAI_API_KEY with OPENAI_BASE_URL, or add OPENROUTER_API_KEY consistently to secrets/workflow examples if it’s actually supported).

Copilot uses AI. Check for mistakes.
Comment thread README.md
| `OPENCODE_GIT_TOKEN` | Gitea API Token (requires repo permissions) |
| `DEEPSEEK_API_KEY` | DeepSeek API Key (default model) |
| `ANTHROPIC_API_KEY` | Anthropic API Key (optional) |
| `OPENAI_API_KEY` | OpenAI API Key (optional) |
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The secrets table doesn’t mention OPENROUTER_API_KEY (or other gateway-specific keys), but the new gateway section later instructs users to use OPENROUTER_API_KEY. Either add the referenced secret(s) here or update the later section to use the keys that are already documented.

Suggested change
| `OPENAI_API_KEY` | OpenAI API Key (optional) |
| `OPENAI_API_KEY` | OpenAI API Key (optional) |
| `OPENROUTER_API_KEY` | OpenRouter API Key (optional, for LLM gateway usage) |

Copilot uses AI. Check for mistakes.
Comment thread README_zh.md
Comment on lines +88 to +93
# 将 MODEL 指向 OpenAI 兼容的 provider
MODEL: openai/your-model-name
OPENAI_API_KEY: ${{ secrets.YOUR_API_KEY }}
# 设置网关 URL
OPENAI_BASE_URL: "https://openrouter.ai/api/v1" # OpenRouter
# OPENAI_BASE_URL: "http://localhost:4000/v1" # LiteLLM
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在网关示例中,代码块里使用的是 OPENAI_API_KEY,但下面 OpenRouter 的备注却写的是使用 OPENROUTER_API_KEY。这两处不一致容易让用户配置错(而默认 workflow 模板也只传了 OPENAI_API_KEY)。建议统一文档:要么说明 OpenRouter 也用 OPENAI_API_KEY + OPENAI_BASE_URL,要么在 secrets / workflow 示例中一致地加入 OPENROUTER_API_KEY(如果确实被支持)。

Copilot uses AI. Check for mistakes.
Comment thread README_zh.md
| `OPENCODE_GIT_TOKEN` | Gitea API Token(需要 repo 权限) |
| `DEEPSEEK_API_KEY` | DeepSeek API Key(默认模型) |
| `ANTHROPIC_API_KEY` | Anthropic API Key(可选) |
| `OPENAI_API_KEY` | OpenAI API Key(可选) |
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secrets 表里没有列出 OPENROUTER_API_KEY(或其他网关相关的 key),但后面的网关章节又要求使用 OPENROUTER_API_KEY。建议要么在这里补充对应的 secret,要么把后面章节改成使用这里已说明的 key。

Suggested change
| `OPENAI_API_KEY` | OpenAI API Key(可选) |
| `OPENAI_API_KEY` | OpenAI API Key(可选) |
| `OPENROUTER_API_KEY` | OpenRouter API Key(使用 LLM 网关时可选) |

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How do i use LLM Gateways? Docker install method requires setting either DEEPSEEK_API_KEY, ANTHROPIC_API_KEY, or OPENAI_API_KEY

2 participants