That’s my Python request:
<code>def analyze_screenshot_base64(encoded_image):
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {openai.api_key}"
}
payload = {
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Develop a trading setup (LONG or SHORT) with a CRV of at least 5 based on this chart. Include entry price, stop loss, and take profit levels."
},
{
"type": "image_url",
"image": {
"url": f"data:image/png;base64,{encoded_image}"
}
}
]
}
],
"max_tokens": 300
}
response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload)
return response.json()
</code>
<code>def analyze_screenshot_base64(encoded_image):
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {openai.api_key}"
}
payload = {
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Develop a trading setup (LONG or SHORT) with a CRV of at least 5 based on this chart. Include entry price, stop loss, and take profit levels."
},
{
"type": "image_url",
"image": {
"url": f"data:image/png;base64,{encoded_image}"
}
}
]
}
],
"max_tokens": 300
}
response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload)
return response.json()
</code>
def analyze_screenshot_base64(encoded_image):
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {openai.api_key}"
}
payload = {
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Develop a trading setup (LONG or SHORT) with a CRV of at least 5 based on this chart. Include entry price, stop loss, and take profit levels."
},
{
"type": "image_url",
"image": {
"url": f"data:image/png;base64,{encoded_image}"
}
}
]
}
],
"max_tokens": 300
}
response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload)
return response.json()
But the API returns me:
{‘error’: {‘message’: ‘Invalid content type. image_url is only
supported by certain models.’, ‘type’: ‘invalid_request_error’,
‘param’: ‘messages.[0].content.[1].type’, ‘code’: None}}
What could be the problem?
1