Skip to content

I took bedrock nova micro api key; I always get operation not supported exception.

0

when I tried curl -X POST \

https://bedrock-runtime.us-east-2.amazonaws.com/model/amazon.nova-micro-v1:0/invoke
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "X-Amz-Bedrock-Api-Key: I used my key here"
-d '{"messages":[{"role":"user","content":[{"text":"Explain quantum computing in simple terms."}]}],"inferenceConfig":{"maxTokens":100}}'. I got {"Message":"Authorization header is missing"};

asked a year ago288 views

2 Answers
0

Hello.

Modify the command as follows:
The API key is set in the Authorization header.
Also, please make your request with the model ID "us.amazon.nova-micro-v1:0".
https://docs.aws.amazon.com/bedrock/latest/userguide/api-keys-use.html

curl -X POST \
https://bedrock-runtime.us-east-2.amazonaws.com/model/us.amazon.nova-micro-v1:0/invoke \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer bedrock-api-key-" \
-d '{"messages":[{"role":"user","content":[{"text":"Explain quantum computing in simple terms."}]}],"inferenceConfig":{"maxTokens":100}}'
EXPERT

answered a year ago

-1

There are a few issues with your approach to invoking the Amazon Nova Micro model in Bedrock:

  1. Authentication Issue: The error "Authorization header is missing" indicates that you're not properly authenticating your request. Amazon Bedrock doesn't use an API key in the way you're trying to implement it with "X-Amz-Bedrock-Api-Key". Instead, Bedrock requires AWS Signature Version 4 (SigV4) authentication.

  2. Request Format: Your payload format needs adjustment. For Amazon Nova models, you should use the proper schema format. The payload should include the "schemaVersion" field set to "messages-v1" and may need to include other required parameters.

Here's how you can fix these issues:

  1. For authentication, you should use AWS SDK or AWS CLI which handles SigV4 signing automatically, or implement SigV4 signing in your code if making direct HTTP requests.

  2. Update your payload to match the correct format for Nova models:

{
"schemaVersion": "messages-v1",
"modelId": "amazon.nova-micro-v1:0",
"messages": [
{
"role": "user",
"content": [
{
"text": "Explain quantum computing in simple terms."
}
]
}
],
"inferenceConfig": {
"maxTokens": 100,
"temperature": 0.7
}
}
  1. Make sure you have proper access permissions to use the Nova model in your AWS account. You may need to check your IAM permissions and ensure you have enabled access to the specific model in the Bedrock console.

If you're still encountering issues, verify that you have the necessary permissions for "bedrock:InvokeModel" and that you've enabled access to the Nova model in your account.
Sources
Python Error when prompting LLM in Bedrock via Apigee API Endpoint | AWS re:Post
Access denied to bedrock:ListCustomModelDeployments You don't have permission to bedrock:ListCustomModelDeployments. To request access, copy the following text and send it to your AWS administrator. L | AWS re:Post
Require structured output - Amazon Nova

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.