listModels static method
Returns a list of all model metadatas available in Groq
Implementation
static Future<List<GroqLLMModel>> listModels(String apiKey) async {
final response = await AuthHttp.get(url: _getModelBaseUrl, apiKey: apiKey);
if (response.statusCode == 200) {
final Map<String, dynamic> jsonData =
json.decode(utf8.decode(response.bodyBytes, allowMalformed: true));
final List<dynamic> jsonList = jsonData['data'] as List<dynamic>;
return jsonList.map((json) => GroqParser.llmModelFromJson(json)).toList();
} else {
throw GroqException.fromResponse(response);
}
}