API Documentation
The OmniTensor API provides developers with powerful tools to interact with the decentralized AI ecosystem. With a variety of endpoints available for managing AI models, performing inference tasks, and leveraging decentralized compute resources, the API is designed to facilitate seamless integration of AI functionalities into your decentralized applications (dApps). Below is an example of key API endpoints, usage patterns, and best practices.
1. Authentication
All API requests must include an authentication token in the headers. This token verifies the identity of the user and authorizes access to the OmniTensor network resources.
Endpoint:
/auth/token
Method: POST
Description: Generates an authentication token required for all subsequent API calls.
Request Example:
Response Example:
2. AI Model Management
2.1 Upload AI Model
This endpoint allows developers to upload custom AI models to the OmniTensor network for decentralized hosting and inference.
Endpoint:
/ai/models/upload
Method: POST
Description: Uploads a new AI model to the decentralized infrastructure.
Request Example:
Response Example:
2.2 List Available Models
Retrieve a list of all AI models available to your account.
Endpoint:
/ai/models
Method: GET
Description: Lists all AI models currently uploaded to the OmniTensor infrastructure.
Response Example:
2.3 Model Inference
Run inference on a deployed AI model using OmniTensor's decentralized GPU network.
Endpoint:
/ai/models/{model_id}/inference
Method: POST
Description: Submit an input to an AI model and receive an inference result.
Request Example:
Response Example:
3. Decentralized Compute Management
3.1 Allocate GPU Compute Resources
This endpoint allocates decentralized GPU resources for a given AI task.
Endpoint:
/compute/allocate
Method: POST
Description: Request decentralized GPU resources for AI model training or inference.
Request Example:
Response Example:
4. Data Management
4.1 Upload Dataset
Upload a dataset for model training or validation. The dataset will be stored in the decentralized infrastructure and can be used by AI models across the network.
Endpoint:
/data/upload
Method: POST
Description: Upload a new dataset to the network.
Request Example:
Response Example:
4.2 Retrieve Dataset Metadata
Fetch metadata for a specific dataset stored on the OmniTensor network.
Endpoint:
/data/{dataset_id}/metadata
Method: GET
Description: Get metadata details for a particular dataset.
Response Example:
5. Token and Payment Management
5.1 Check Token Balance
Retrieve the OMNIT token balance for the authenticated account.
Endpoint:
/account/balance
Method: GET
Description: Get the OMNIT token balance of your account.
Response Example:
5.2 Transfer Tokens
Transfer OMNIT tokens to another user on the OmniTensor network.
Endpoint:
/account/transfer
Method: POST
Description: Transfer OMNIT tokens to another account.
Request Example:
Response Example:
6. Error Handling
All API responses include a standardized error format in case of failures. Below is an example of an error response:
Error Response Example:
Best Practices
Always ensure your authentication token is valid and refreshed periodically to avoid unauthorized access errors.
When uploading large models or datasets, split them into manageable chunks to avoid timeouts or memory issues.
Monitor compute resource allocation closely for long-running tasks to optimize costs.
Use pagination when retrieving large datasets or model lists to avoid overwhelming your application.
Last updated