I created the github workflow for automated Pr rev...
# questions
c
I created the github workflow for automated Pr review. I triggered the review with the review-this label. The review fails with AnthropicException authentication_error invalid x-api-key. I set the LLM_API_KEY in my girhub actions secrets. I also tried rotating my openhands llm key. I have credits in openhands
g
> I also tried rotating my openhands llm key. And it failed then too? Can you copy/paste the error you are receiving? Can you share the github workflow? I will have OH inspect it and see how to fix it
c
{"asctime": "2026-03-30 152012,852", "levelname": "WARNING", "name": "openhands.sdk.conversation.state", "filename": "state.py", "lineno": 228, "message": "Saving conversation state without cipher - 2 secret(s) will be redacted and lost on restore. Consider providing a cipher to preserve secrets."} {"asctime": "2026-03-30 152012,853", "levelname": "WARNING", "name": "openhands.sdk.conversation.visualizer.default", "filename": "default.py", "lineno": 284, "message": "Event type ConversationErrorEvent is not registered in EVENT_VISUALIZATION_CONFIG. Skipping visualization."} {"asctime": "2026-03-30 152012,853", "levelname": "ERROR", "name": "__main__", "filename": "agent_script.py", "lineno": 931, "message": "PR review failed: Conversation run failed for id=785499f3-c58b-45b7-a4ba-c63c24e82d14: litellm.AuthenticationError: AnthropicException - {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"invalid x-api-key\"},\"request_id\":\"req_011CZZVQhW9ApHpkKR4VwrbT\"}"}
@gentle-apple-32922
g
@nutritious-balloon-65098 do you know why this is failing? DO you need more information? can you offer solutions?
n
I'm on it! Jamie can track my progress here.
Summary of my work: - I investigated the error you shared: -
AnthropicException ... authentication_error ... invalid x-api-key
- I checked the OpenHands PR review docs and the current PR review plugin behavior. - I did not make any code changes. ### Answer restated The workflow is most likely failing because
LLM_API_KEY
is being used as a direct Anthropic API key, but you supplied an OpenHands key instead. Your workflow’s default model is typically:
Copy code
yaml
llm-model: anthropic/claude-sonnet-4-5-20250929
That means the action sends requests directly to Anthropic. So: - if
llm-model
starts with
anthropic/
- then
LLM_API_KEY
must be a valid Anthropic API key An OpenHands key or OpenHands credits will not satisfy Anthropic auth, which matches the exact error: -
invalid x-api-key
### What I concluded - [x] Identified the most likely root cause - [x] Explained why OpenHands credits are probably not being used here - [x] Offered concrete solutions - [x] Kept the response focused on diagnosis, since you asked why it is failing ### Suggested fixes - If staying on Anthropic: set
LLM_API_KEY
to a real Anthropic API key - If using another provider: make sure
llm-model
,
llm-base-url
, and
LLM_API_KEY
all match that provider - If you specifically want to use OpenHands credits: you likely need a different setup than this stock PR review action ### Extra note A secondary thing to verify is whether the PR comes from a fork, since GitHub can withhold secrets from forked PR workflows. But based on the exact error, the stronger explanation is that a key is present but is the wrong kind of key. No changes were made, so there is nothing to commit or push.
g
Option 1: Keep Anthropic
If your workflow uses:
Copy code
llm-model: anthropic/claude-sonnet-4-5-20250929
then set:
•
LLM_API_KEY
= a real Anthropic API key
Not:
• OpenHands key
• GitHub token
• OpenRouter key
• any other provider key
Option 2: Use a different provider
If you want OpenAI, OpenRouter, etc., then the model, base URL, and API key must match.
Examples:
•
openai/...
→ OpenAI key
• OpenRouter model/base URL → OpenRouter key
• custom LiteLLM proxy → proxy base URL + proxy key
Option 3: Use OpenHands-backed credits
If your goal is specifically to use OpenHands credits, then this stock workflow is probably the wrong setup as-is. You’d want a workflow/integration that routes model execution through OpenHands, not directly to Anthropic.
One more thing to check
If the PR is from a fork, GitHub often does not expose repo secrets to
pull_request
workflows. That can also break auth-related workflows.
That said, your error looks more like:
• a key is present
• but it’s the wrong key type
What is not the root cause
This warning is probably unrelated:
Saving conversation state without cipher ... secret(s) will be redacted...
That’s a warning about persistence/redaction, not the auth failure.
My recommendation
Most likely fix:
leave the workflow as Anthropic
• replace
LLM_API_KEY
in GitHub Actions secrets with a valid Anthropic API key
If you paste your workflow here, I can tell you the exact line to change and whether you’re configured for:
• Anthropic direct
• OpenRouter
• or an OpenHands-based path
Relevant docs:
OpenHands PR review workflow: https://docs.openhands.dev/sdk/guides/github-workflows/pr-review
• PR review plugin README: https://github.com/OpenHands/extensions/tree/main/plugins/pr-review
Were you able to confirm you are using the correct API keys in the project?
e
Hi Carolyn! If you're using the OpenHands LLM provider (assuming you are if you have copied your OpenHands LLM key), then you may want to make sure: • the
llm-model
field is set to
openhands/claude-sonnet-4-5-20250929
(note the 'openhands/' prefix) • the
llm-base-url
is:
<https://llm-proxy.app.all-hands.dev>
c
the
llm-model
field is set to
openhands/claude-sonnet-4-5-20250929
(note the 'openhands/' prefix)
^^ Please make sure of this. Joe, I think the second shouldn't be necessary, we rewrite to it under the hood
🙌 1
e
Cool - thanks Engel for clarifying!
c
@calm-artist-7206 @elegant-branch-54423 @gentle-apple-32922 I used the suggested settings in my github workflow yml and it worked:
🙌 2
llm-model: openhands/claude-sonnet-4-5-20250929
llm-base-url: <https://llm-proxy.app.all-hands.dev>
Thanks so much for the help!
👍 1