Skip to content

403 {"error":{"type":"forbidden","message":"Request not allowed"}} #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
aaaa-zhen opened this issue Oct 24, 2024 · 16 comments
Open

Comments

@aaaa-zhen
Copy link

anyone has this issue ?
image

@genecyber
Copy link

do you have anything running on your 1212 port? or is a prior instance of electron running?

@lenohard
Copy link

I can confirm it's caused by the region restriction, you may need set up a proxy for your request to anthropic.

@aaaa-zhen
Copy link
Author

I can confirm it's caused by the region restriction, you may need set up a proxy for your request to anthropic.

thanks, but when I test anthropic official's it works..

@aaaa-zhen
Copy link
Author

do you have anything running on your 1212 port? or is a prior instance of electron running?

nope I killed it

@lenohard
Copy link

I can confirm it's caused by the region restriction, you may need set up a proxy for your request to anthropic.

thanks, but when I test anthropic official's it works..

I have the same error msg. And the following cmd has this error as well(which is from official documention):

curl https://api.anthropic.com/v1/messages \
  -H "content-type: application/json" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "anthropic-beta: computer-use-2024-10-22" \
  -d '{
    "model": "claude-3-5-sonnet-20241022",
    "max_tokens": 1024,
    "tools": [
      {
        "type": "computer_20241022",
        "name": "computer",
        "display_width_px": 1024,
        "display_height_px": 768,
        "display_number": 1
      },
      {
        "type": "text_editor_20241022",
        "name": "str_replace_editor"
      },
      {
        "type": "bash_20241022",
        "name": "bash"
      }
    ],
    "messages": [
      {
        "role": "user",
        "content": "Save a picture of a cat to my desktop."
      }
    ]
  }'

After I enable system proxy TUN , so it can take over the traffic of Terminal as well. Both the error from the cmd above and agent.exe disappear. Hope this can provide some clues to your problem.

@positive666
Copy link

same error , offical api test work, but this program run error

@vacuityv
Copy link

I met this error and I edit .env file and set ANTHROPIC_BASE_URL to a proxy url and fixed it. I think this must be a network error

@imcaptor
Copy link

imcaptor commented Oct 25, 2024

I met the same error.
test the api is ok, and I have set the https_proxy and http_proxy

@positive666
Copy link

I met the same error. test the api is ok, and I have set the https_proxy and http_proxy

me too

@vacuityv
Copy link

@imcaptor @positive666 I met the same issure with you guys. I fixed it by edit .env file and set ANTHROPIC_BASE_URL.(I make a rewrite url through nginx)

@positive666
Copy link

@imcaptor @positive666 I met the same issure with you guys. I fixed it by edit .env file and set ANTHROPIC_BASE_URL.(I make a rewrite url through nginx)
Hello, is Nginx necessary? Could you share your NGINX configuration?

@vacuityv
Copy link

vacuityv commented Oct 25, 2024

@positive666 I need nginx just because I live in China and my internet cant't accesss the server. I can share you:

location /claude {
            proxy_pass  https://api.anthropic.com/;
            proxy_ssl_server_name on;
            proxy_set_header Host api.anthropic.com;
            proxy_set_header Connection '';
            proxy_http_version 1.1;
            chunked_transfer_encoding off;
            proxy_buffering off;
            proxy_cache off;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header X-Forwarded-Proto $scheme;
        }

@positive666
Copy link

@positive666 I need nginx just because I live in China and my internet cant't accesss the server. I can share you:

location /claude {
            proxy_pass  https://api.anthropic.com/;
            proxy_ssl_server_name on;
            proxy_set_header Host api.anthropic.com;
            proxy_set_header Connection '';
            proxy_http_version 1.1;
            chunked_transfer_encoding off;
            proxy_buffering off;
            proxy_cache off;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header X-Forwarded-Proto $scheme;
        }

@positive666 I need nginx just because I live in China and my internet cant't accesss the server. I can share you:

location /claude {
            proxy_pass  https://api.anthropic.com/;
            proxy_ssl_server_name on;
            proxy_set_header Host api.anthropic.com;
            proxy_set_header Connection '';
            proxy_http_version 1.1;
            chunked_transfer_encoding off;
            proxy_buffering off;
            proxy_cache off;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header X-Forwarded-Proto $scheme;
        }

Thanks!

@chaizijun12
Copy link

offical api test work, but this program run error, How to solve this problem

@GP-GUO
Copy link

GP-GUO commented Oct 26, 2024

PixPin_2024-10-26_15-55-58
Used transit, configured base_url, but still getting error POST /v1/messages
@vacuityv

@vacuityv
Copy link

@GP-GUO this error means your base url is nor correct. you can check BASE_URL/v1/messages use curl.

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

No branches or pull requests

8 participants