When setting up the API call for Jurassic (requested from https://studio.ai21.com/docs/api/), I always get the 400 error response.
import json
import requests
requests.post(
"https://api.ai21.com/studio/v1/j1-large/complete",
headers={"Authorization": "PERSONAL API KEY"},
json={
"prompt": "Life is like",
"numResults": 1,
"maxTokens": 8,
"stopSequences": ["."],
"topKReturn": 0,
"temperature": 0.0
}
)
Output: <Response [400]>
Could anyone give me some advice please?
Your headers are wrong, as the documentation indicates that the API key should be preceded by
Bearer
. Try this: