AI agents: read /llms.txt for the documentation index or append .md to any guide URL for raw Markdown.
Skip to content

AI PR review bring your own key ​

MergeJudge is bring-your-own-key for normal hosted reviews: your Anthropic, OpenAI, z.ai or compatible key runs under your account. MergeJudge's own provider API keys are not used for your reviews. On the GitHub App, a public repository with no key and no runner can get free AI reviews (limited, diff mode) on Cloudflare Workers AI; private repositories never use that path. See Getting started and Privacy.

What our servers see: MergeJudge's servers read the pull request diff from GitHub to run the rules. The GitHub Action does not call those servers. When an AI provider is configured, the diff is sent to that provider. On a free AI review for a public repository, the diff for that diff-mode review is sent to Cloudflare Workers AI. MergeJudge does not use your code to train models. Your provider's terms decide what happens to the prompt after that.

MergeJudge is bring-your-own-LLM. The default and recommended setup is an API key for a pay-as-you-go provider, stored as a key in the hosted manager panel. Without a key, public repos on the GitHub App get free AI reviews to start, and everything else runs rules-only and still works.

Model names below are examples; they change often, so check your provider's docs.

Use your own OpenAI API key in GitHub Actions ​

On the hosted GitHub App, save a key named OPENAI_API_KEY in the panel and set provider.type: openai and provider.model in .mergejudge.yml on the base branch. In the Action, pass the same name as a secret. The default call is Chat Completions at https://api.openai.com/v1/chat/completions. Set api: responses only when you want the Responses API. A complete workflow file is in Use your own OpenAI API key in GitHub Actions.

yaml
# Action inputs. The key is a GitHub secret, not a MergeJudge key.
provider: openai
model: your-model-name
api_key_env: OPENAI_API_KEY

Local models (OpenAI-compatible endpoint, for example Ollama) ​

type: openai-compatible sends Chat Completions to {base_url}/chat/completions. Set base_url. If you omit it, the request goes to https://api.openai.com/v1. model has to be set, and api_key_env has to name a non-empty secret: with no key the review is rules-only, even if the server would have ignored the key.

A local Ollama server is that kind of endpoint. Its OpenAI-compatible API is http://127.0.0.1:11434/v1, and it accepts response_format: { type: "json_object" }, which is what every MergeJudge review sends. Ollama's hosted cloud API does not support structured outputs, so do not use it as base_url. On the GitHub Action, 127.0.0.1 is the machine running the job. A GitHub-hosted ubuntu-latest runner cannot reach Ollama on your laptop. Use a self-hosted runner on the machine where Ollama is listening. The hosted GitHub App calls base_url from MergeJudge's servers, and the panel only saves an https URL, so a laptop address does not work there. The Action workflow is in Local models.

yaml
provider:
  type: openai-compatible
  base_url: http://127.0.0.1:11434/v1
  model: your-model-name
  api_key_env: OLLAMA_API_KEY

Pick the provider in .mergejudge.yml (read from the PR's base branch). The key is read from the name in api_key_env, or the default below (Action: an env var; hosted: the panel key with that name).

On the hosted service, add your own key in the panel, named like the provider's key name (for example ANTHROPIC_API_KEY), or set api_key_env to the name you used. MergeJudge's own provider API keys are not used for your reviews. Without a key, a public repo gets free AI reviews to start, within a monthly limit; otherwise the review runs rules-only.

typeAPIDefault key nameNotes
anthropicMessages API (/v1/messages)ANTHROPIC_API_KEY
openaiChat Completions, or Responses with api: responsesOPENAI_API_KEY
zaiz.ai, OpenAI-compatibleZAI_API_KEYendpoint: paygo (default) or endpoint: coding
openai-compatibleAny Chat Completions endpointOPENAI_API_KEYneeds base_url
workers-aiCloudflare Workers AI AI bindingnoneSelf-hosted Worker only as a provider.type you configure. On the hosted App, Workers AI is used only for the free AI path on eligible public repos (not a setting you pick in .mergejudge.yml).
yaml
# Anthropic
provider: { type: anthropic, model: claude-sonnet-5-5 }

# OpenAI, Chat Completions (default) or Responses API
provider: { type: openai, model: gpt-5-mini }
provider: { type: openai, api: responses, model: gpt-5-mini }

# z.ai GLM, pay-as-you-go
provider: { type: zai, model: glm-5.3 }

# Any OpenAI-compatible endpoint
provider: { type: openai-compatible, base_url: https://openrouter.ai/api/v1, model: openai/gpt-5-mini, api_key_env: OPENROUTER_API_KEY }

# Cloudflare Workers AI (self-hosted Worker only; on the hosted App it is used only for free AI reviews, not chosen here)
provider: { type: workers-ai, model: "@cf/zai-org/glm-4.7-flash" }

Every adapter goes through the same JSON check: if the reply isn't valid JSON, MergeJudge retries once with the parse error (and JSON mode where the API has one), then falls back to rules only.

On the Worker, only model keys are visible to provider selection. The GitHub App key and webhook secret are never passed to a provider, even if api_key_env names them.

Other OpenAI-compatible endpoints ​

  • OpenRouter: base_url: https://openrouter.ai/api/v1, one key for many models.
  • AWS Bedrock: via an OpenAI-compatible gateway or Bedrock's OpenAI-compatible endpoint for your region.

Model names above are examples and change often; check your provider's docs.

Subscriptions (Claude, ChatGPT, coding subscriptions) ​

Consumer and coding subscriptions are not API keys, and their conditions of use generally don't allow using them as a backend for automated CI services. MergeJudge does not support plugging a subscription token into its provider.

If you want to use a subscription in CI, use the vendor's official integration, alongside MergeJudge in rules-only mode.

z.ai coding plan

type: zai, endpoint: coding points at the z.ai coding-plan endpoint. It is supported because some owners use it for their own repos, but it's a subscription meant for coding tools: read z.ai's conditions of use before using it for automated reviews, and prefer the pay-as-you-go endpoint (endpoint: paygo) for anything shared.

Cost and safety ​

  • diff and context modes: one LLM call per PR run (plus at most one JSON repair retry).
  • deep mode: one pass with a larger prompt (runner or Action). See Review modes.
  • budget.max_tokens_per_pr caps the prompt; patches are truncated to fit. budget.max_output_tokens caps the reply (default: 8000 for reasoning models such as glm-5.x, gpt-5 and o-series, else 2500; a reply cut off at the limit is retried once with 2x and compact JSON, then falls back to rules-only).
  • Keys are read from the name in api_key_env (Action: an env var; hosted: the panel key with that name) and are never logged or posted.
  • PR content is sent inside <untrusted_pr_data> delimiters and the model is told to ignore instructions in it.

FAQ ​

Can I use my own API key for AI code review? ​

Yes. MergeJudge is bring-your-own-key. On the hosted GitHub App you save the key in the panel (stored encrypted, shown as name and last 4 only). In the GitHub Action you pass it as a secret. Without a key, a public repo on the GitHub App gets free AI reviews to start (up to 10 per repo per month, on a model MergeJudge runs on Cloudflare Workers AI); otherwise the review runs rules-only. MergeJudge's own Anthropic, OpenAI or similar provider API keys are not used for your reviews; the free path on public repos uses Cloudflare Workers AI instead.

How do I use my own OpenAI API key in GitHub Actions? ​

Store it as a repository secret OPENAI_API_KEY and set provider: openai, model, and api_key_env: OPENAI_API_KEY on the Action. The call goes to https://api.openai.com/v1/chat/completions. The full workflow is on the self-hosted GitHub Action page.

Can I point MergeJudge at a local model such as Ollama? ​

Yes, on the GitHub Action, with provider: openai-compatible and base_url set to a Chat Completions endpoint that job can reach, such as http://127.0.0.1:11434/v1 on a self-hosted runner where Ollama is listening. You must set base_url; otherwise the request goes to api.openai.com. A non-empty key is required even when the server ignores it. The Action sends response_format json_object, which a local Ollama server accepts. Ollama's hosted cloud API does not support structured outputs. The hosted GitHub App calls base_url from MergeJudge's servers and the panel only saves an https URL, so a laptop address does not work there.

What do MergeJudge's servers see? ​

MergeJudge's servers read the pull request diff from GitHub to run the rules. The GitHub Action does not call those servers. When an AI provider is configured, the diff is sent to that provider. On a free AI review for a public repository, the diff for that diff-mode review is sent to Cloudflare Workers AI. MergeJudge does not use your code to train models.

Which providers are supported? ​

anthropic, openai, zai and openai-compatible, which covers any Chat Completions endpoint. workers-ai is a provider.type only on a self-hosted Worker, not in the GitHub Action. On the hosted service it is used only for free AI reviews on eligible public repos.

Can I use a Claude or ChatGPT subscription as the CI backend? ​

No. Subscriptions are not API keys, and MergeJudge doesn't support plugging a subscription token into its provider. The runner on your own machine can use your own Claude Code or Codex login.

How do I cap token use? ​

budget.max_tokens_per_pr caps the prompt and budget.max_output_tokens caps the reply. Deep mode has its own deep.* caps.

The MergeJudge runner is open source (MIT). MergeJudge doesn't merge pull requests itself. MergeJudge is not affiliated with or endorsed by GitHub. Sign in · Impressum · Privacy · Terms · Cookie settings