Hi, I´m trying to make a small iOS app for myself in flutter.
I have a paid subscription and also a valid API key. In my app I want to let describe the Ai a photo. Its working well in the chatGPT app…so it should also work with the API right?
I´m using the endpoint url: httxx://api.openai.com/v1/chat/completions
and as model: gpt-4-turbo
In my app there´s also showing up the error: “Cannot specify both model and engine” and I dont know why.
Here´s the sentence in the flutter file…maybe someone can help me out?
`Future<String> _getImageRecognition(String imagePath) async {
//
final url = Uri.parse('https://api.openai.com/v1/chat/completions');
//
final bytes = await File(imagePath).readAsBytes();
//
final base64Image = base64Encode(bytes);
//
try {
final response = await http.post(
url,
headers: {
'Authorization': 'Bearer $apiKey',
'Content-Type': 'application/json',
},
body: jsonEncode({
'model': 'gpt-4-turbo', //
'messages': [
{
'role': 'system',
'content':
'XXXXX'
},
{
'role': 'user',
'content':
'XXXXX: $base64Image. '
}
],
'max_tokens': 100 // Beispielparameter;
}),`