The "model_id" field is the best way to reference models when making API calls. This rule of thumb applies whether you are using one of Clarifai's models or one of your own custom models. While it is possible to reference models by other means (the model name field being one possible example), this is not recommended. Model names can potentially change over time, but the hash value found in the model_id field is unique and specific to each model.
Locate your model id by visiting model mode in Portal
You can find your model_id by visiting model mode in Portal. Just log into your account and navigate to the model mode icon on the lefthand side of the window.
You can also find the model_id on the model details page in the upper lefthand column.
The model_id field in action: Making a predict call
The following provides an example of what it looks like to make a predict call on a model using the unique model id. This is example is written in Python. For additional information pease visit our API Guide.
from clarifai_grpc.channel.clarifai_channel import ClarifaiChannel from clarifai_grpc.grpc.api import service_pb2_grpc from clarifai_grpc.grpc.api import service_pb2, resources_pb2 from clarifai_grpc.grpc.api.status import status_code_pb2 stub = service_pb2_grpc.V2Stub(ClarifaiChannel.get_grpc_channel()) # This is how you authenticate. metadata = (('authorization', 'Key YOUR_CLARIFAI_API_KEY'),) request = service_pb2.PostModelOutputsRequest( # This is the model ID of a publicly available General model. You may use any other public or custom model ID. model_id='aaa03c23b3724a16a56b629203edc62c', inputs=[ resources_pb2.Input(data=resources_pb2.Data(image=resources_pb2.Image(url='YOUR_IMAGE_URL'))) ]) response = stub.PostModelOutputs(request, metadata=metadata) if response.status.code != status_code_pb2.SUCCESS: raise Exception("Request failed, status code: " + str(response.status.code)) for concept in response.outputs.data.concepts: print('%12s: %.2f' % (concept.name, concept.value))