Aider-AI / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
20.95k stars 1.94k forks source link

can't work with bedrock models #1986

Open yair4Data opened 2 weeks ago

yair4Data commented 2 weeks ago

Issue

i followed the manual , supplied all the aws credentials in various ways (exported them in the shell , added them to local .env file) but i keep getting 403 error: litellm.exceptions.AuthenticationError: litellm.AuthenticationError: BedrockException Invalid Authentication - b'{"message":"The security token included in the request is invalid."}' i am connecting via aws profile , supplied it also with the region in the parameters , but with no affect. this did work for me : aws bedrock-runtime converse --model-id anthropic.claude-3-5-sonnet-20240620-v1:0 --messages '[{ "role": "user", "content": [{"text": "Create a list of 3 pop songs."}] }]' --profile staging

Version and model info

aider 0.59.1

fry69 commented 2 weeks ago

Thank you for filing this issue.

The error ->

The security token included in the request is invalid.

tells you that a token got received but it was invalid. Please double check your token and that you did not include additional characters like apostrophes or similar.

yair4Data commented 2 weeks ago

i dont provide the token , just AWS_REGION,AWS_PROFILE,AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY as they appear in .aws/credentials

fry69 commented 2 weeks ago

Then please double check if they do not include additional characters if you set those environment variables. E.g. NOT THIS ->

export AWS_ACCESS_KEY_ID="super_secret"

but this ->

export AWS_ACCESS_KEY_ID=super_secret
yair4Data commented 2 weeks ago

checked and validated it is correct.

fry69 commented 2 weeks ago

Then something else must be wrong. AWS does not like the token it receives, see error. This is known to work in other cases. I am afraid I can't help you further.

fry69 commented 2 weeks ago

You can try to debug this yourself:

Start aider with --verbose to see what it picks up from where.

Search/ask in the LiteLLM repository for help -> https://github.com/BerriAI/litellm

tiagoefreitas commented 1 week ago

Have the same issue, I am sure everything is correct and I get the same error