Overview
ThevalidateModelAccessActivity checks whether a user has permission to use a specific AI model and system. This validation ensures proper access control and billing before executing AI operations.
Purpose
- Verify user permissions for AI models
- Enforce access control policies
- Prevent unauthorized model usage
- Ensure billing is properly configured
When itβs executed
This activity is called before executing any AI model operations:- Before text generation: Validates access before calling AI models
- Model-specific operations: Before any operation that requires a specific model
- Access verification: As part of the workflow validation phase
Signature
Inputs
| Parameter | Type | Description |
|---|---|---|
flowId | string | ID of the flow requesting model access |
model | string | Name/identifier of the AI model to validate |
aiSystem | string | AI system/provider (e.g., openai, anthropic) |
Outputs
Returnstrue if the user has access to the model, false otherwise. The workflow should throw an error if validation fails.
Implementation details
The activity makes an HTTP POST request to the main APIβs validation endpoint:flowId: Flow identifiermodel: Model nameaiSystem: AI system/provider
INTERNAL_API_KEY header.
Example usage in workflow
Error handling
The activity returnsfalse if:
- The user doesnβt have access to the specified model
- The flow doesnβt have permission for the model
- The model is not available in the userβs plan
- The API request fails
API integration
The activity communicates with the main APIβs internal endpoint:- Endpoint:
/worker/validate-model-access - Method: POST
- Authentication: Internal API key (
INTERNAL_API_KEY) - Request body:
{ flowId, model, aiSystem } - Response:
{ success: boolean }