ponshu-room-lite/tools/check_models.dart

26 lines
1.1 KiB
Dart

import 'package:google_generative_ai/google_generative_ai.dart';
import '../lib/secrets.dart';
import 'dart:io';
void main() async {
final apiKey = Secrets.geminiApiKey;
// Using a model that definitely exists to get the client initialized,
// though listModels doesn't technically require a specific model instance usually in REST,
// the SDK might just use the apiKey.
// Actually the SDK doesn't expose listModels directly on GenerativeModel?
// Let's check if we can simply use the REST API via Dart's http or just try to init a model and query.
// Wait, the google_generative_ai package usually doesn't have a static listModels method exposed easily in top level?
// Let's check source code if possible, or just use curl.
// Using curl via Process.run is easier/safer if I don't want to depend on package imports that might fail.
print("Checking models via curl...");
final result = await Process.run('curl', [
'-s',
'https://generativelanguage.googleapis.com/v1beta/models?key=$apiKey'
]);
print(result.stdout);
print(result.stderr);
}