Skip to content

List Models

This example assumes using Instill; is in scope and apiKey contains your Instill API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
using var client = new InstillClient(apiKey);

GetAuthenticatedUserResponse userResponse = await client.Namespace.MgmtPublicServiceGetAuthenticatedUserAsync();
var namespaceName = $"namespaces/{userResponse.User.Id}";

ListModelsResponse response = await client.Model.ModelPublicServiceListModelsAsync(
    parent: namespaceName);

foreach (var model in response.Models ?? [])
{
    Console.WriteLine($"Model: {model.Name}");
    Console.WriteLine($"  ID: {model.Id}");
    Console.WriteLine($"  Description: {model.Description}");
    Console.WriteLine();
}