Create, Get, Update, Delete
Manage your model training jobs.

Create Model

To create a model, you need to specify the model's name and other required fields (which depend on the model). Specifying the ID is optional.
Below, we create a classifier model with one initial concept. You can always add and remove concepts later.
Java
NodeJS
Python
cURL
Javascript (REST)
1
import com.clarifai.grpc.api.*;
2
import com.clarifai.grpc.api.status.*;
3
4
// Insert here the initialization code as outlined on this page:
5
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
6
7
SingleModelResponse postModelsResponse = stub.postModels(
8
PostModelsRequest.newBuilder().addModels(
9
Model.newBuilder()
10
.setId("petsID")
11
.setOutputInfo(
12
OutputInfo.newBuilder().setData(
13
Data.newBuilder().addConcepts(Concept.newBuilder().setId("boscoe"))
14
)
15
)
16
).build()
17
);
18
19
if (postModelsResponse.getStatus().getCode() != StatusCode.SUCCESS) {
20
throw new RuntimeException("Post models failed, status: " + postModelsResponse.getStatus());
Copied!
1
// Insert here the initialization code as outlined on this page:
2
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
stub.PostModels(
5
{
6
models: [
7
{
8
id: "petsID",
9
output_info: {
10
data: {concepts: [{id: "boscoe"}]},
11
}
12
}
13
]
14
},
15
metadata,
16
(err, response) => {
17
if (err) {
18
throw new Error(err);
19
}
20
21
if (response.status.code !== 10000) {
22
throw new Error("Post models failed, status: " + response.status.description);
23
}
24
}
25
);
Copied!
1
# Insert here the initialization code as outlined on this page:
2
# https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
post_models_response = stub.PostModels(
5
service_pb2.PostModelsRequest(
6
models=[
7
resources_pb2.Model(
8
id="petsID",
9
output_info=resources_pb2.OutputInfo(
10
data=resources_pb2.Data(
11
concepts=[resources_pb2.Concept(id="boscoe", value=1)]
12
),
13
)
14
)
15
]
16
),
17
metadata=metadata
18
)
19
20
if post_models_response.status.code != status_code_pb2.SUCCESS:
21
print("There was an error with your request!")
22
print("\tCode: {}".format(post_models_response.outputs[0].status.code))
23
print("\tDescription: {}".format(post_models_response.outputs[0].status.description))
24
print("\tDetails: {}".format(post_models_response.outputs[0].status.details))
25
raise Exception("Post models failed, status: " + post_models_response.status.description)
Copied!
1
curl -X POST \
2
-H "Authorization: Key YOUR_API_KEY" \
3
-H "Content-Type: application/json" \
4
-d '
5
{
6
"model": {
7
"id": "petsID",
8
"output_info": {
9
"data": {
10
"concepts": [
11
{
12
"id": "boscoe",
13
"value": 1
14
}
15
]
16
}
17
}
18
}
19
}'\
20
https://api.clarifai.com/v2/models
Copied!
1
const raw = JSON.stringify({
2
"user_app_id": {
3
"user_id": "{YOUR_USER_ID}",
4
"app_id": "{YOUR_APP_ID}"
5
},
6
"model": {
7
"id": "petsID",
8
"output_info": {
9
"data": {
10
"concepts": [
11
{
12
"id": "boscoe",
13
"value": 1
14
}
15
]
16
}
17
}
18
}
19
});
20
21
const requestOptions = {
22
method: 'POST',
23
headers: {
24
'Accept': 'application/json',
25
'Authorization': 'Key {YOUR_PERSONAL_TOKEN}'
26
},
27
body: raw
28
};
29
30
fetch("https://api.clarifai.com/v2/models", requestOptions)
31
.then(response => response.text())
32
.then(result => console.log(result))
33
.catch(error => console.log('error', error));
Copied!

Add Concepts To A Model

You can add concepts to a model at any point. As you add concepts to inputs, you may want to add them to your model.
Java
NodeJS
Python
cURL
Javascript (REST)
1
import com.clarifai.grpc.api.*;
2
import com.clarifai.grpc.api.status.*;
3
4
...
5
6
MultiModelResponse patchModelsResponse = stub.patchModels(
7
PatchModelsRequest.newBuilder()
8
.setAction("merge") // Supported actions: overwrite, merge, remove
9
.addModels(
10
Model.newBuilder()
11
.setId("petsID")
12
.setOutputInfo(
13
OutputInfo.newBuilder().setData(
14
Data.newBuilder().addConcepts(Concept.newBuilder().setId("charlie"))
15
)
16
)
17
)
18
.build()
19
);
20
21
if (patchModelsResponse.getStatus().getCode() != StatusCode.SUCCESS) {
22
throw new RuntimeException("Patch models failed, status: " + patchModelsResponse.getStatus());
23
}
Copied!
1
// Insert here the initialization code as outlined on this page:
2
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
stub.PatchModels(
5
{
6
action: "merge", // Supported actions: overwrite, merge, remove
7
models: [
8
{
9
id: "petsID",
10
output_info: {data: {concepts: [{id: "charlie"}]}}
11
}
12
]
13
},
14
metadata,
15
(err, response) => {
16
if (err) {
17
throw new Error(err);
18
}
19
20
if (response.status.code !== 10000) {
21
throw new Error("Patch models failed, status: " + response.status.description);
22
}
23
}
24
);
Copied!
1
# Insert here the initialization code as outlined on this page:
2
# https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
patch_models_response = stub.PatchModels(
5
service_pb2.PatchModelsRequest(
6
action="merge", # Supported actions: overwrite, merge, remove
7
models=[
8
resources_pb2.Model(
9
id="petsID",
10
output_info=resources_pb2.OutputInfo(
11
data=resources_pb2.Data(
12
concepts=[resources_pb2.Concept(id="charlie")]
13
),
14
)
15
)
16
]
17
),
18
metadata=metadata
19
)
20
21
if patch_models_response.status.code != status_code_pb2.SUCCESS:
22
print("There was an error with your request!")
23
print("\tCode: {}".format(patch_models_response.outputs[0].status.code))
24
print("\tDescription: {}".format(patch_models_response.outputs[0].status.description))
25
print("\tDetails: {}".format(patch_models_response.outputs[0].status.details))
26
raise Exception("Patch models failed, status: " + patch_models_response.status.description)
Copied!
1
curl -X PATCH \
2
-H "Authorization: Key YOUR_API_KEY" \
3
-H "Content-Type: application/json" \
4
-d '
5
{
6
"models": [
7
{
8
"id": "petsID",
9
"output_info": {
10
"data": {
11
"concepts": [
12
{
13
"id": "charlie"
14
}
15
]
16
}
17
}
18
}
19
],
20
"action": "merge"
21
}'\
22
https://api.clarifai.com/v2/models/
Copied!
1
const raw = JSON.stringify({
2
"user_app_id": {
3
"user_id": "{YOUR_USER_ID}",
4
"app_id": "{YOUR_APP_ID}"
5
},
6
"models": [
7
{
8
"id": "petsID",
9
"output_info": {
10
"data": {
11
"concepts": [
12
{
13
"id": "charlie"
14
}
15
]
16
}
17
}
18
}
19
],
20
"action": "merge"
21
});
22
23
const requestOptions = {
24
method: 'PATCH',
25
headers: {
26
'Accept': 'application/json',
27
'Authorization': 'Key {YOUR_PERSONAL_TOKEN}'
28
},
29
body: raw
30
};
31
32
fetch("https://api.clarifai.com/v2/models", requestOptions)
33
.then(response => response.text())
34
.then(result => console.log(result))
35
.catch(error => console.log('error', error));
Copied!

Remove Concepts From A Model

Conversely, if you'd like to remove concepts from a model, you can also do that.
Java
NodeJS
Python
cURL
Javascript (REST)
1
import com.clarifai.grpc.api.*;
2
import com.clarifai.grpc.api.status.*;
3
4
// Insert here the initialization code as outlined on this page:
5
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
6
7
MultiModelResponse patchModelsResponse = stub.patchModels(
8
PatchModelsRequest.newBuilder()
9
.setAction("remove") // Supported actions: overwrite, merge, remove
10
.addModels(
11
Model.newBuilder()
12
.setId("petsID")
13
.setOutputInfo(
14
OutputInfo.newBuilder().setData(
15
Data.newBuilder().addConcepts(Concept.newBuilder().setId("charlie"))
16
)
17
)
18
)
19
.build()
20
);
21
22
if (patchModelsResponse.getStatus().getCode() != StatusCode.SUCCESS) {
23
throw new RuntimeException("Patch models failed, status: " + patchModelsResponse.getStatus());
24
}
Copied!
1
// Insert here the initialization code as outlined on this page:
2
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
stub.PatchModels(
5
{
6
action: "remove", // Supported actions: overwrite, merge, remove
7
models: [
8
{
9
id: "petsID",
10
output_info: {data: {concepts: [{id: "charlie"}]}}
11
}
12
]
13
},
14
metadata,
15
(err, response) => {
16
if (err) {
17
throw new Error(err);
18
}
19
20
if (response.status.code !== 10000) {
21
throw new Error("Patch models failed, status: " + response.status.description);
22
}
23
}
24
);
Copied!
1
# Insert here the initialization code as outlined on this page:
2
# https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
patch_models_response = stub.PatchModels(
5
service_pb2.PatchModelsRequest(
6
action="remove", # Supported actions: overwrite, merge, remove
7
models=[
8
resources_pb2.Model(
9
id="petsID",
10
output_info=resources_pb2.OutputInfo(
11
data=resources_pb2.Data(
12
concepts=[resources_pb2.Concept(id="charlie")]
13
),
14
)
15
)
16
]
17
),
18
metadata=metadata
19
)
20
21
if patch_models_response.status.code != status_code_pb2.SUCCESS:
22
print("There was an error with your request!")
23
print("\tCode: {}".format(patch_models_response.outputs[0].status.code))
24
print("\tDescription: {}".format(patch_models_response.outputs[0].status.description))
25
print("\tDetails: {}".format(patch_models_response.outputs[0].status.details))
26
raise Exception("Patch models failed, status: " + patch_models_response.status.description)
Copied!
1
curl -X PATCH \
2
-H "Authorization: Key YOUR_API_KEY" \
3
-H "Content-Type: application/json" \
4
-d '
5
{
6
"models": [
7
{
8
"id": "petsID",
9
"output_info": {
10
"data": {
11
"concepts": [
12
{
13
"id": "charlie"
14
}
15
]
16
}
17
}
18
}
19
],
20
"action": "remove"
21
}'\
22
https://api.clarifai.com/v2/models/
Copied!
1
const raw = JSON.stringify({
2
"user_app_id": {
3
"user_id": "{YOUR_USER_ID}",
4
"app_id": "{YOUR_APP_ID}"
5
},
6
"models": [
7
{
8
"id": "petsID",
9
"output_info": {
10
"data": {
11
"concepts": [
12
{
13
"id": "charlie"
14
}
15
]
16
}
17
}
18
}
19
],
20
"action": "remove"
21
});
22
23
const requestOptions = {
24
method: 'PATCH',
25
headers: {
26
'Accept': 'application/json',
27
'Authorization': 'Key {YOUR_PERSONAL_TOKEN}'
28
},
29
body: raw
30
};
31
32
fetch("https://api.clarifai.com/v2/models", requestOptions)
33
.then(response => response.text())
34
.then(result => console.log(result))
35
.catch(error => console.log('error', error));
Copied!

Update Model Name and Configuration

Here we will change the model name to 'newname' and the model's configuration to have concepts_mutually_exclusive=true and closed_environment=true.
Java
NodeJS
Python
cURL
Javascript (REST)
1
import com.clarifai.grpc.api.*;
2
import com.clarifai.grpc.api.status.*;
3
4
// Insert here the initialization code as outlined on this page:
5
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
6
7
MultiModelResponse patchModelsResponse = stub.patchModels(
8
PatchModelsRequest.newBuilder()
9
.setAction("overwrite")
10
.addModels(
11
Model.newBuilder()
12
.setId("petsID")
13
.setName("newname")
14
.setOutputInfo(
15
OutputInfo.newBuilder()
16
.setData(
17
Data.newBuilder()
18
.addConcepts(Concept.newBuilder().setId("birds"))
19
.addConcepts(Concept.newBuilder().setId("hurd"))
20
)
21
.setOutputConfig(
22
OutputConfig.newBuilder()
23
.setConceptsMutuallyExclusive(true)
24
.setClosedEnvironment(true)
25
)
26
)
27
).build()
28
);
29
30
if (patchModelsResponse.getStatus().getCode() != StatusCode.SUCCESS) {
31
throw new RuntimeException("Patch models failed, status: " + patchModelsResponse.getStatus());
32
}
Copied!
1
// Insert here the initialization code as outlined on this page:
2
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
stub.PatchModels(
5
{
6
action: "overwrite",
7
models: [
8
{
9
id: "petsID",
10
name: "newname",
11
output_info: {
12
data: {concepts: [{id: "birds"}, {id: "hurd"}]},
13
output_config: {concepts_mutually_exclusive: true, closed_environment: true}
14
}
15
}
16
]
17
},
18
metadata,
19
(err, response) => {
20
if (err) {
21
throw new Error(err);
22
}
23
24
if (response.status.code !== 10000) {
25
throw new Error("Patch models failed, status: " + response.status.description);
26
}
27
}
28
);
Copied!
1
# Insert here the initialization code as outlined on this page:
2
# https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
patch_models_response = stub.PatchModels(
5
service_pb2.PatchModelsRequest(
6
action="overwrite",
7
models=[
8
resources_pb2.Model(
9
id="petsID",
10
name="newname",
11
output_info=resources_pb2.OutputInfo(
12
data=resources_pb2.Data(
13
concepts=[
14
resources_pb2.Concept(id="birds"),
15
resources_pb2.Concept(id="hurd")
16
]
17
),
18
output_config=resources_pb2.OutputConfig(
19
concepts_mutually_exclusive=True,
20
closed_environment=True,
21
)
22
)
23
)
24
]
25
),
26
metadata=metadata
27
)
28
29
if patch_models_response.status.code != status_code_pb2.SUCCESS:
30
print("There was an error with your request!")
31
print("\tCode: {}".format(patch_models_response.outputs[0].status.code))
32
print("\tDescription: {}".format(patch_models_response.outputs[0].status.description))
33
print("\tDetails: {}".format(patch_models_response.outputs[0].status.details))
34
raise Exception("Patch models failed, status: " + patch_models_response.status.description)
Copied!
1
curl -X PATCH \
2
-H "Authorization: Key YOUR_API_KEY" \
3
-H "Content-Type: application/json" \
4
-d '
5
{
6
"models": [
7
{
8
"id": "petsID",
9
"name": "newname",
10
"output_info": {
11
"data": {"concepts": [{"id": "birds"}, {"id": "hurd"}]},
12
"output_config": {
13
"concepts_mutually_exclusive": true,
14
"closed_environment": true
15
}
16
}
17
}
18
],
19
"action": "overwrite"
20
}'\
21
https://api.clarifai.com/v2/models/
Copied!
1
const raw = JSON.stringify({
2
"user_app_id": {
3
"user_id": "{YOUR_USER_ID}",
4
"app_id": "{YOUR_APP_ID}"
5
},
6
"models": [
7
{
8
"id": "petsID",
9
"name": "newname",
10
"output_info": {
11
"data": {"concepts": [{"id": "birds"}, {"id": "hurd"}]},
12
"output_config": {
13
"concepts_mutually_exclusive": true,
14
"closed_environment": true
15
}
16
}
17
}
18
],
19
"action": "overwrite"
20
});
21
22
const requestOptions = {
23
method: 'PATCH',
24
headers: {
25
'Accept': 'application/json',
26
'Authorization': 'Key {YOUR_PERSONAL_TOKEN}'
27
},
28
body: raw
29
};
30
31
fetch("https://api.clarifai.com/v2/models", requestOptions)
32
.then(response => response.text())
33
.then(result => console.log(result))
34
.catch(error => console.log('error', error));
Copied!

Get

List Model Types

Learn about available model types and their hyperparameters. This endpoint lists all the possible models that are creatable (when creatable=true), or in general in the platform (the others ones have creatable=false).
Java
NodeJS
gRPC Python
cURL
Javascript (REST)
1
import com.clarifai.grpc.api.*;
2
import com.clarifai.grpc.api.status.*;
3
4
// Insert here the initialization code as outlined on this page:
5
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
6
7
MultiModelTypeResponse listModelTypesResponse = stub.listModelTypes(ListModelTypesRequest.newBuilder().build());
8
9
for (ModelType modelType : listModelTypesResponse.getModelTypesList()) {
10
System.out.println(modelType);
11
}
Copied!
1
// Insert here the initialization code as outlined on this page:
2
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
stub.ListModelTypes(
5
{
6
page: 1,
7
per_page: 500
8
},
9
metadata,
10
(err, response) => {
11
if (err) {
12
throw new Error(err);
13
}
14
15
if (response.status.code !== 10000) {
16
throw new Error("Received status: " + response.status.description + "\n" + response.status.details);
17
}
18
19
for (const model_type of response.model_types) {
20
console.log(model_type)
21
}
22
}
23
);
Copied!
1
# Insert here the initialization code as outlined on this page:
2
# https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
response = stub.ListModelTypes(
5
service_pb2.ListModelTypesRequest(),
6
metadata=metadata
7
)
8
9
if response.status.code != status_code_pb2.SUCCESS:
10
print("There was an error with your request!")
11
print("\tCode: {}".format(response.outputs[0].status.code))
12
print("\tDescription: {}".format(response.outputs[0].status.description))
13
print("\tDetails: {}".format(response.outputs[0].status.details))
14
raise Exception("Patch models failed, status: " + response.status.description)
15
16
for model_type in response.model_types:
17
print(model_type)
Copied!
1
curl -X GET 'https://api.clarifai.com/v2/models/types?per_page=20&page=1' \
2
-H 'Authorization: Key YOUR_API_KEY'
Copied!
1
const appId = '{YOUR_APP_ID}'
2
3
const requestOptions = {
4
method: 'GET',
5
headers: {
6
'Accept': 'application/json',
7
'Authorization': 'Key {YOUR_PERSONAL_TOKEN}'
8
}
9
};
10
11
fetch(`https://api.clarifai.com/v2/users/me/apps/${appId}/models/types?per_page=20&page=1`, requestOptions)
12
.then(response => response.text())
13
.then(result => console.log(result))
14
.catch(error => console.log('error', error));
Copied!

Get Models

To get a list of all models including models you've created as well as Clarifai models:
Java
NodeJS
Python
cURL
Javascript (REST)
1
import com.clarifai.grpc.api.*;
2
import com.clarifai.grpc.api.status.*;
3
import java.util.List;
4
5
// Insert here the initialization code as outlined on this page:
6
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
7
8
MultiModelResponse listModelsResponse = stub.listModels(
9
ListModelsRequest.newBuilder().build()
10
);
11
12
if (listModelsResponse.getStatus().getCode() != StatusCode.SUCCESS) {
13
throw new RuntimeException("List models failed, status: " + listModelsResponse.getStatus());
14
}
15
16
List<Model> models = listModelsResponse.getModelsList();
17
for (Model model : models) {
18
System.out.println(model);
19
}
Copied!
1
// Insert here the initialization code as outlined on this page:
2
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
stub.ListModels(
5
{},
6
metadata,
7
(err, response) => {
8
if (err) {
9
throw new Error(err);
10
}
11
12
if (response.status.code !== 10000) {
13
throw new Error("List models failed, status: " + response.status.description);
14
}
15
16
for (const model of response.models) {
17
console.log(JSON.stringify(model, null, 2));
18
}
19
}
20
);
Copied!
1
# Insert here the initialization code as outlined on this page:
2
# https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
list_models_response = stub.ListModels(
5
service_pb2.ListModelsRequest(),
6
metadata=metadata
7
)
8
9
if list_models_response.status.code != status_code_pb2.SUCCESS:
10
print("There was an error with your request!")
11
print("\tCode: {}".format(list_models_response.outputs[0].status.code))
12
print("\tDescription: {}".format(list_models_response.outputs[0].status.description))
13
print("\tDetails: {}".format(list_models_response.outputs[0].status.details))
14
raise Exception("List models failed, status: " + list_models_response.status.description)
15
16
for model in list_models_response.models:
17
print(model)
Copied!
1
curl -X GET \
2
-H "Authorization: Key YOUR_API_KEY" \
3
https://api.clarifai.com/v2/models
Copied!
1
const appId = '{YOUR_APP_ID}'
2
3
const requestOptions = {
4
method: 'GET',
5
headers: {
6
'Accept': 'application/json',
7
'Authorization': 'Key {YOUR_PERSONAL_TOKEN}'
8
}
9
};
10
11
fetch(`https://api.clarifai.com/v2/users/me/apps/${appId}/models`, requestOptions)
12
.then(response => response.text())
13
.then(result => console.log(result))
14
.catch(error => console.log('error', error));
Copied!

Get Model By Id

All models have unique Ids. You can get a specific model by its id:
Java
NodeJS
Python
cURL
Javascript (REST)
1
import com.clarifai.grpc.api.*;
2
import com.clarifai.grpc.api.status.*;
3
4
// Insert here the initialization code as outlined on this page:
5
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
6
7
SingleModelResponse getModelResponse = stub.getModel(
8
GetModelRequest.newBuilder()
9
.setModelId("petsID")
10
.build()
11
);
12
13
if (getModelResponse.getStatus().getCode() != StatusCode.SUCCESS) {
14
throw new RuntimeException("Get model failed, status: " + getModelResponse.getStatus());
15
}
16
17
Model model = getModelResponse.getModel();
18
System.out.println(model);
Copied!
1
// Insert here the initialization code as outlined on this page:
2
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
stub.GetModel(
5
{model_id: "petsID"},
6
metadata,
7
(err, response) => {
8
if (err) {
9
throw new Error(err);
10
}
11
12
if (response.status.code !== 10000) {
13
throw new Error("List models failed, status: " + response.status.description);
14
}
15
16
const model = response.model;
17
console.log(JSON.stringify(model, null, 2));
18
}
19
);
Copied!
1
# Insert here the initialization code as outlined on this page:
2
# https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
get_model_response = stub.GetModel(
5
service_pb2.GetModelRequest(model_id="petsID"),
6
metadata=metadata
7
)
8
9
if get_model_response.status.code != status_code_pb2.SUCCESS:
10
print("There was an error with your request!")
11
print("\tCode: {}".format(get_model_response.outputs[0].status.code))
12
print("\tDescription: {}".format(get_model_response.outputs[0].status.description))
13
print("\tDetails: {}".format(get_model_response.outputs[0].status.details))
14
raise Exception("Get model failed, status: " + get_model_response.status.description)
15
16
model = get_model_response.model
17
print(model)
Copied!
1
curl -X GET \
2
-H "Authorization: Key YOUR_API_KEY" \
3
https://api.clarifai.com/v2/models/petsID
Copied!
1
const appId = '{YOUR_APP_ID}'
2
const modelId = '{MODEL_ID}'
3
4
const requestOptions = {
5
method: 'GET',
6
headers: {
7
'Accept': 'application/json',
8
'Authorization': 'Key {YOUR_PERSONAL_TOKEN}'
9
}
10
};
11
12
fetch(`https://api.clarifai.com/v2/users/me/apps/${appId}/models/${modelId}`, requestOptions)
13
.then(response => response.text())
14
.then(result => console.log(result))
15
.catch(error => console.log('error', error));
Copied!

Get Model Output Info By Id

The output info of a model lists what concepts it contains.
Java
NodeJS
Python
cURL
Javascript (REST)
1
import com.clarifai.grpc.api.*;
2
import com.clarifai.grpc.api.status.*;
3
4
// Insert here the initialization code as outlined on this page:
5
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
6
7
SingleModelResponse getModelOutputInfoResponse = stub.getModelOutputInfo(
8
GetModelRequest.newBuilder()
9
.setModelId("petsID")
10
.build()
11
);
12
13
if (getModelOutputInfoResponse.getStatus().getCode() != StatusCode.SUCCESS) {
14
throw new RuntimeException("Get model output info failed, status: " + getModelOutputInfoResponse.getStatus());
15
}
16
17
Model model = getModelOutputInfoResponse.getModel();
18
System.out.println(model);
Copied!
1
// Insert here the initialization code as outlined on this page:
2
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
stub.GetModelOutputInfo(
5
{model_id: "petsID"},
6
metadata,
7
(err, response) => {
8
if (err) {
9
throw new Error(err);
10
}
11
12
if (response.status.code !== 10000) {
13
throw new Error("List models failed, status: " + response.status.description);
14
}
15
16
const model = response.model;
17
console.log(JSON.stringify(model, null, 2));
18
}
19
);