listModels method

Future<List<String>> listModels()

Implementation

Future<List<String>> listModels() async {
  final res = await http.get(
    Uri.parse('$baseUrl/models'),
    headers: _headers,
  );

  if (res.statusCode != 200) {
    throw DeepSeekException.fromBody(res.body, res.statusCode);
  }

  final Map<String, dynamic> map = jsonDecode(res.body);

  return List<String>.from(map['data'].map((m) => m['id']));
}