Input Nodes
Connect your models together.
The outputs from one model can be used as the inputs in another model. This allows you to link together the models in a graph. Linking models helps you build sophisticated AI solutions, that can zero-in on a specific use case.

Supported input and output types

To view your available models, just open your app and click Model Mode icon on the left hand side of the screen. From here just click the Create a Custom Model button in the top righthand corner of the screen.
Different models accept different types of inputs and return different types of outputs. They are named after the fields in the Data object of our API. This object is uses in inputs, annotations, models and workflows. Some examples include:

Inputs

    Concepts
    Embeddings
    Image
    Image or video
    Regions

Outputs

    Concepts
    Clusters
    Regions

The building blocks

You can create workflows out of any Clarifai Models or custom models that you have created for your app. The inputs and outputs supported by your custom models will depend on the inputs and outputs supported by the Clarifai Models, or model templates that you have used to build them.

Sample workflow with multiple connected nodes

The The following is an example of how to build a workflow with multiple connected nodes. Note that model IDs and model version IDs from the public clarifai/main application are fixed, so they are already hard-coded in the code examples below. It is possible to use other public model or model version IDs.
Python
Java
NodeJS
cURL
Javascript (REST)
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_workflows_response = stub.PostWorkflows(
5
service_pb2.PostWorkflowsRequest(
6
user_app_id=userDataObject, # The userDataObject is created in the overview and is required when using a PAT
7
workflows=[
8
resources_pb2.Workflow(
9
id="auto-annotation-workflow-id",
10
nodes=[
11
resources_pb2.WorkflowNode(
12
id="general-embed",
13
model=resources_pb2.Model(
14
id="bbb5f41425b8468d9b7a554ff10f8581",
15
model_version=resources_pb2.ModelVersion(
16
id="bb186755eda04f9cbb6fe32e816be104"
17
)
18
)
19
),
20
resources_pb2.WorkflowNode(
21
id="general-concept",
22
model=resources_pb2.Model(
23
id="aaa03c23b3724a16a56b629203edc62c",
24
model_version=resources_pb2.ModelVersion(
25
id="aa7f35c01e0642fda5cf400f543e7c40"
26
)
27
)
28
),
29
resources_pb2.WorkflowNode(
30
id="general-cluster",
31
model=resources_pb2.Model(
32
id="cccbe437d6e54e2bb911c6aa292fb072",
33
model_version=resources_pb2.ModelVersion(
34
id="cc2074cff6dc4c02b6f4e1b8606dcb54"
35
)
36
),
37
),
38
resources_pb2.WorkflowNode(
39
id="mapper",
40
model=resources_pb2.Model(
41
id="synonym-model-id",
42
model_version=resources_pb2.ModelVersion(
43
id="{YOUR_SYNONYM_MODEL_VERSION_ID}"
44
)
45
),
46
node_inputs=[
47
resources_pb2.NodeInput(node_id="general-concept")
48
]
49
),
50
resources_pb2.WorkflowNode(
51
id="greater-than",
52
model=resources_pb2.Model(
53
id="greater-than-model-id",
54
model_version=resources_pb2.ModelVersion(
55
id="{YOUR_GREATER_THAN_MODEL_VERSION_ID}"
56
)
57
),
58
node_inputs=[
59
resources_pb2.NodeInput(node_id="mapper")
60
]
61
),
62
resources_pb2.WorkflowNode(
63
id="less-than",
64
model=resources_pb2.Model(
65
id="less-than-model-id",
66
model_version=resources_pb2.ModelVersion(
67
id="{YOUR_LESS_THAN_MODEL_VERSION_ID}"
68
)
69
),
70
node_inputs=[
71
resources_pb2.NodeInput(node_id="mapper")
72
]
73
),
74
]
75
)
76
]
77
),
78
metadata=metadata
79
)
80
81
if post_workflows_response.status.code != status_code_pb2.SUCCESS:
82
raise Exception("Post workflows failed, status: " + post_workflows_response.status.description)
Copied!
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
MultiWorkflowResponse postWorkflowsResponse = stub.postWorkflows(
8
PostWorkflowsRequest.newBuilder()
9
.setUserAppId(UserAppIDSet.newBuilder().setAppId("{YOUR_APP_ID}"))
10
.addWorkflows(
11
Workflow.newBuilder()
12
.setId("auto-annotation-workflow-id")
13
.addNodes(
14
WorkflowNode.newBuilder()
15
.setId("general-embed")
16
.setModel(
17
Model.newBuilder()
18
.setId("bbb5f41425b8468d9b7a554ff10f8581")
19
.setModelVersion(
20
ModelVersion.newBuilder()
21
.setId("bb186755eda04f9cbb6fe32e816be104")
22
)
23
)
24
)
25
.addNodes(
26
WorkflowNode.newBuilder()
27
.setId("general-concept")
28
.setModel(
29
Model.newBuilder()
30
.setId("aaa03c23b3724a16a56b629203edc62c")
31
.setModelVersion(
32
ModelVersion.newBuilder()
33
.setId("aa7f35c01e0642fda5cf400f543e7c40")
34
)
35
)
36
)
37
.addNodes(
38
WorkflowNode.newBuilder()
39
.setId("general-cluster")
40
.setModel(
41
Model.newBuilder()
42
.setId("cccbe437d6e54e2bb911c6aa292fb072")
43
.setModelVersion(
44
ModelVersion.newBuilder()
45
.setId("cc2074cff6dc4c02b6f4e1b8606dcb54")
46
)
47
)
48
)
49
.addNodes(
50
WorkflowNode.newBuilder()
51
.setId("mapper")
52
.setModel(
53
Model.newBuilder()
54
.setId("synonym-model-id")
55
.setModelVersion(
56
ModelVersion.newBuilder()
57
.setId("{YOUR_SYNONYM_MODEL_VERSION_ID}")
58
)
59
)
60
.addNodeInputs(NodeInput.newBuilder().setNodeId("general-concept"))
61
)
62
.addNodes(
63
WorkflowNode.newBuilder()
64
.setId("greater-than")
65
.setModel(
66
Model.newBuilder()
67
.setId("greater-than-model-id")
68
.setModelVersion(
69
ModelVersion.newBuilder()
70
.setId("{YOUR_GREATER_THAN_MODEL_VERSION_ID}")
71
)
72
)
73
.addNodeInputs(NodeInput.newBuilder().setNodeId("mapper"))
74
)
75
.addNodes(
76
WorkflowNode.newBuilder()
77
.setId("less-than")
78
.setModel(
79
Model.newBuilder()
80
.setId("less-than-model-id")
81
.setModelVersion(
82
ModelVersion.newBuilder()
83
.setId("{YOUR_LESS_THAN_MODEL_VERSION_ID}")
84
)
85
)
86
.addNodeInputs(NodeInput.newBuilder().setNodeId("mapper"))
87
)
88
)
89
.build()
90
);
91
92
if (postWorkflowsResponse.getStatus().getCode() != StatusCode.SUCCESS) {
93
throw new RuntimeException("Post workflows failed, status: " + postWorkflowsResponse.getStatus());
94
}
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.PostWorkflows(
5
{
6
user_app_id: {
7
app_id: "e83440590d104cee97ef84af1856837d"
8
},
9
workflows: [
10
{
11
id: "auto-annotation-workflow-id",
12
nodes: [
13
{
14
id: "general-embed",
15
model: {
16
id: "bbb5f41425b8468d9b7a554ff10f8581",
17
model_version: {
18
id: "bb186755eda04f9cbb6fe32e816be104"
19
}
20
}
21
},
22
{
23
id: "general-concept",
24
model: {
25
id: "aaa03c23b3724a16a56b629203edc62c",
26
model_version: {
27
id: "aa7f35c01e0642fda5cf400f543e7c40"
28
}
29
}
30
},
31
{
32
id: "general-cluster",
33
model: {
34
id: "cccbe437d6e54e2bb911c6aa292fb072",
35
model_version: {
36
id: "cc2074cff6dc4c02b6f4e1b8606dcb54"
37
}
38
}
39
},
40
{
41
id: "mapper",
42
model: {
43
id: "synonym-model-id",
44
model_version: {
45
id: "{YOUR_SYNONYM_MODEL_VERSION_ID}"
46
}
47
},
48
node_inputs: [
49
{node_id: "general-concept"}
50
]
51
},
52
{
53
id: "greater-than",
54
model: {
55
id: "greater-than-model-id",
56
model_version: {
57
id: "{YOUR_GREATER_THAN_MODEL_VERSION_ID}"
58
}
59
},
60
node_inputs: [
61
{node_id: "mapper"}
62
]
63
},
64
{
65
id: "less-than",
66
model: {
67
id: "less-than-model-id",
68
model_version: {
69
id: "{YOUR_LESS_THAN_MODEL_VERSION_ID}"
70
}
71
},
72
node_inputs: [
73
{node_id: "mapper"}
74
]
75
},
76
]
77
}
78
]
79
},
80
metadata,
81
(err, response) => {
82
if (err) {
83
throw new Error(err);
84
}
85
86
if (response.status.code !== 10000) {
87
console.log(response.status);
88
throw new Error("Post workflows failed, status: " + response.status.description);
89
}
90
}
91
);
Copied!
1
curl -X POST 'https://api.clarifai.com/v2/users/me/apps/{{app}}/workflows' \
2
-H 'Authorization: Key {{PAT}}' \
3
-H 'Content-Type: application/json' \
4
--data-raw '{
5
"workflows": [
6
{
7
"id": "auto-annotation-workflow-id",
8
"nodes": [
9
{
10
"id": "general-embed",
11
"model": {
12
"id": "{YOUR_GENERAL_EMBED_MODEL_ID}",
13
"model_version": {
14
"id": "{YOUR_GENERAL_EMBED_MODEL_VERSION_ID}"
15
}
16
}
17
},
18
{
19
"id": "general-concept",
20
"model": {
21
"id": "{YOUR_GENERAL_CONCEPT_MODEL_ID}",
22
"model_version": {
23
"id": "{YOUR_GENERAL_CONCEPT_MODEL_VERSION_ID}"
24
}
25
}
26
},
27
{
28
"id": "general-cluster",
29
"model": {
30
"id": "{YOUR_GENERAL_CLUSTER_MODEL_ID}",
31
"model_version": {
32
"id": "{YOUR_GENERAL_CLUSTER_MODEL_VERSION_ID}"
33
}
34
}
35
},
36
{
37
"id": "mapper",
38
"model": {
39
"id": "synonym-model-id",
40
"model_version": {
41
"id": "{YOUR_MAPPER_MODEL_VERSION_ID}"
42
}
43
},
44
"node_inputs": [
45
{
46
"node_id": "general-concept"
47
}
48
]
49
},
50
{
51
"id": "greater-than",
52
"model": {
53
"id": "greater-than-model-id",
54
"model_version": {
55
"id": "{YOUR_GREATER_THAN_MODEL_VERSION_ID}"
56
}
57
},
58
"node_inputs": [
59
{
60
"node_id": "mapper"
61
}
62
]
63
},
64
{
65
"id": "less-than",
66
"model": {
67
"id": "less-than-model-id",
68
"model_version": {
69
"id": "{YOUR_LESS_THAN_MODEL_VERSION_ID}"
70
}
71
},
72
"node_inputs": [
73
{
74
"node_id": "mapper"
75
}
76
]
77
},
78
]
79
}
80
]
81
}'
Copied!
1
const raw = JSON.stringify({
2
"user_app_id": {
3
"user_id": "{YOUR_USER_ID}",
4
"app_id": "{YOUR_APP_ID}"
5
},
6
"workflows": [
7
{
8
"id": "auto-annotation-workflow-id",
9
"nodes": [
10
{
11
"id": "general-embed",
12
"model": {
13
"id": "{YOUR_GENERAL_EMBED_MODEL_ID}",
14
"model_version": {
15
"id": "{YOUR_GENERAL_EMBED_MODEL_VERSION_ID}"
16
}
17
}
18
},
19
{
20
"id": "general-concept",
21
"model": {
22
"id": "{YOUR_GENERAL_CONCEPT_MODEL_ID}",
23
"model_version": {
24
"id": "{YOUR_GENERAL_CONCEPT_MODEL_VERSION_ID}"
25
}
26
}
27
},
28
{
29
"id": "general-cluster",
30
"model": {
31
"id": "{YOUR_GENERAL_CLUSTER_MODEL_ID}",
32
"model_version": {
33
"id": "{YOUR_GENERAL_CLUSTER_MODEL_VERSION_ID}"
34
}
35
}
36
},
37
{
38
"id": "mapper",
39
"model": {
40
"id": "synonym-model-id",
41
"model_version": {
42
"id": "{YOUR_MAPPER_MODEL_VERSION_ID}"
43
}
44
},
45
"node_inputs": [
46
{
47
"node_id": "general-concept"
48
}
49
]
50
},
51
{
52
"id": "greater-than",
53
"model": {
54
"id": "greater-than-model-id",
55
"model_version": {
56
"id": "{YOUR_GREATER_THAN_MODEL_VERSION_ID}"
57
}
58
},
59
"node_inputs": [
60
{
61
"node_id": "mapper"
62
}
63
]
64
},
65
{
66
"id": "less-than",
67
"model": {
68
"id": "less-than-model-id",
69
"model_version": {
70
"id": "{YOUR_LESS_THAN_MODEL_VERSION_ID}"
71
}
72
},
73
"node_inputs": [
74
{
75
"node_id": "mapper"
76
}
77
]
78
},
79
]
80
}
81
]
82
});
83
84
const requestOptions = {
85
method: 'POST',
86
headers: {
87
'Accept': 'application/json',
88
'Authorization': 'Key {YOUR_PERSONAL_TOKEN}'
89
},
90
body: raw
91
};
92
93
fetch(`https://api.clarifai.com/v2/workflows`, requestOptions)
94
.then(response => response.text())
95
.then(result => console.log(result))
96
.catch(error => console.log('error', error));
Copied!

Suppressing the output from nodes

It is possible to turn the outputs from given nodes in your workflow on and off with the suppress_output endpoint. This can be helpful when you want to hide outputs for expensive return values like image crops or embedding. By default, this endpoint will be set to false, meaning that we do not suppress any model's output.
Python
Java
NodeJS
cURL
Javascript (REST)
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_workflows_response = stub.PostWorkflows(
5
service_pb2.PostWorkflowsRequest(
6
user_app_id=userDataObject, # The userDataObject is created in the overview and is required when using a PAT
7
workflows=[
8
resources_pb2.Workflow(
9
id="predict-cluster-only",
10
nodes=[
11
resources_pb2.WorkflowNode(
12
id="general-embed",
13
model=resources_pb2.Model(
14
id="bbb5f41425b8468d9b7a554ff10f8581",
15
model_version=resources_pb2.ModelVersion(
16
id="bb186755eda04f9cbb6fe32e816be104"
17
)
18
),
19
suppress_output = True
20
),
21
resources_pb2.WorkflowNode(
22
id="general-cluster",
23
model=resources_pb2.Model(
24
id="cccbe437d6e54e2bb911c6aa292fb072",
25
model_version=resources_pb2.ModelVersion(
26
id="cc2074cff6dc4c02b6f4e1b8606dcb54"
27
)
28
),
29
node_inputs=[
30
resources_pb2.NodeInput(node_id="general-concept")
31
]
32
),
33
]
34
)
35
]
36
),
37
metadata=metadata
38
)
39
40
if post_workflows_response.status.code != status_code_pb2.SUCCESS:
41
raise Exception("Post workflows failed, status: " + post_workflows_response.status.description)
Copied!
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
MultiWorkflowResponse postWorkflowsResponse = stub.postWorkflows(
8
PostWorkflowsRequest.newBuilder()
9
.setUserAppId(UserAppIDSet.newBuilder().setAppId("{YOUR_APP_ID}"))
10
.addWorkflows(
11
Workflow.newBuilder()
12
.setId("auto-annotation-workflow-id")
13
.addNodes(
14
WorkflowNode.newBuilder()
15
.setId("general-embed")
16
.setModel(
17
Model.newBuilder()
18
.setId("bbb5f41425b8468d9b7a554ff10f8581")
19
.setModelVersion(
20
ModelVersion.newBuilder()
21
.setId("bb186755eda04f9cbb6fe32e816be104")
22
)
23
)
24
)
25
.addNodes(
26
WorkflowNode.newBuilder()
27
.setId("general-cluster")
28
.setModel(
29
Model.newBuilder()
30
.setId("cccbe437d6e54e2bb911c6aa292fb072")
31
.setModelVersion(
32
ModelVersion.newBuilder()
33
.setId("cc2074cff6dc4c02b6f4e1b8606dcb54")
34
)
35
)
36
.addNodeInputs(NodeInput.newBuilder().setNodeId("general-cluster"))
37
)
38
)
39
.build()
40
);
41
42
if (postWorkflowsResponse.getStatus().getCode() != StatusCode.SUCCESS) {
43
throw new RuntimeException("Post workflows failed, status: " + postWorkflowsResponse.getStatus());
44
}
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.PostWorkflows(
5
{
6
user_app_id: {
7
app_id: "{YOUR_APP_ID}"
8
},
9
workflows: [
10
{
11
id: "predict-cluster-only",
12
nodes: [
13
{
14
id: "general-embed",
15
model: {
16
id: "bbb5f41425b8468d9b7a554ff10f8581",
17
model_version: {
18
id: "bb186755eda04f9cbb6fe32e816be104"
19
}
20
}
21
suppress_output: true;
22
},
23
{
24
id: "general-cluster",
25
model: {
26
id: "cccbe437d6e54e2bb911c6aa292fb072",
27
model_version: {
28
id: "cc2074cff6dc4c02b6f4e1b8606dcb54"
29
}
30
},
31
node_inputs: [
32
{node_id: "mapper"}
33
]
34
},
35
]
36
}
37
]
38
},
39
metadata,
40
(err, response) => {
41
if (err) {
42
throw new Error(err);
43
}
44
45
if (response.status.code !== 10000) {
46
console.log(response.status);
47
throw new Error("Post workflows failed, status: " + response.status.description);
48
}
49
}
50
);
Copied!
1
POST /v2/workflows HTTP/1.1
2
Host: https://api-dev.clarifai.com
3
Content-Type: application/json
4
Authorization: Key f897095e22b144f482b9a13a2151e5bd
5
6
{
7
"workflows": [
8
{
9
"id": "predict-cluster-only",
10
"nodes": [
11
{
12
"id": "general-embed",
13
"model": {
14
"id": "bbb5f41425b8468d9b7a554ff10f8581",
15
"model_version": {
16
"id": "bb186755eda04f9cbb6fe32e816be104"
17
}
18
},
19
"suppress_output": true
20
},
21
{
22
"id": "general-cluster",
23
"node_inputs": [
24
{
25
"node_id": "general-embed"
26
}
27
],
28
"model": {
29
"id": "cccbe437d6e54e2bb911c6aa292fb072",
30
"model_version": {
31
"id": "cc2074cff6dc4c02b6f4e1b8606dcb54"
32
}
33
}
34
}
35
]
36
}
37
]
38
}
Copied!
1
const raw = JSON.stringify({
2
"user_app_id": {
3
"user_id": "{YOUR_USER_ID}",
4
"app_id": "{YOUR_APP_ID}"
5
},
6
"workflows": [
7
{
8
"id": "predict-cluster-only",
9
"nodes": [
10
{
11
"id": "general-embed",
12
"model": {
13
"id": "bbb5f41425b8468d9b7a554ff10f8581",
14
"model_version": {
15
"id": "bb186755eda04f9cbb6fe32e816be104"
16
}
17
},
18
"suppress_output": true
19
},
20
{
21
"id": "general-cluster",
22
"node_inputs": [
23
{
24
"node_id": "general-embed"
25
}
26
],
27
"model": {
28
"id": "cccbe437d6e54e2bb911c6aa292fb072",
29
"model_version": {
30
"id": "cc2074cff6dc4c02b6f4e1b8606dcb54"
31
}
32
}
33
}
34
]
35
}
36
]
37
});
38
39
const requestOptions = {
40
method: 'POST',
41
headers: {
42
'Accept': 'application/json',
43
'Authorization': 'Key {YOUR_PERSONAL_TOKEN}'
44
},
45
body: raw
46
};
47
48
fetch(`https://api.clarifai.com/v2/workflows`, requestOptions)
49
.then(response => response.text())
50
.then(result => console.log(result))
51
.catch(error => console.log('error', error));
Copied!
Last modified 1mo ago