Skip to main content

Validate AI Model

Used to validate an AI model's API configuration by testing the connection to the model provider. This ensures that the model credentials and configuration are correct before using it in production.

API Endpoint

PropertyValue
Request MethodPOST
Request URLhttps://api.seliseblocks.com/models/{model_id}/validate

Request

Request Example

curl -X POST 'https://api.seliseblocks.com/models/model_123/validate?project_key=YOUR_PROJECT_KEY' \
-H 'accept: application/json'

Path Parameters

FieldTypeRequiredDescription
model_idstringYesThe unique identifier of the model to validate.

Query Parameters

FieldTypeRequiredDescription
project_keystringNoThe project key for your project.

Request Headers

FieldTypeRequiredDescription
acceptstringYesAccepted response format. Use application/json
tip

When to validate your AI model:

  • After initial model creation to verify configuration
  • Before deploying to production environment
  • After updating API keys or credentials
  • When troubleshooting connection issues
  • After changing provider settings or base URLs
  • Periodically to ensure continued connectivity

The validation process:

  • Tests authentication with the provider's API
  • Verifies the model exists and is accessible
  • Checks API quota and rate limits
  • Validates custom headers and parameters
  • Confirms base URL connectivity
  • Returns detailed error messages for debugging

Response

Success Response (200 OK)

Returns an object containing the validation results.

{
"is_valid": true,
"provider": "openai",
"model_name": "gpt-4-turbo-preview",
"connection_status": "successful",
"api_version": "v1",
"timestamp": "2025-01-12T10:30:00Z"
}

Response Fields

FieldTypeDescription
is_validbooleanIndicates whether the model configuration is valid.
providerstringThe AI model provider name.
model_namestringThe specific model name being validated.
connection_statusstringStatus of the connection test (e.g., "successful", "failed").
api_versionstringThe API version being used.
timestampstringISO 8601 timestamp of the validation.
note

Response Object Structure

The actual response structure may vary based on the provider. The response returns a flexible object (additionalProp1: {}) that can contain provider-specific validation details such as:

  • Model availability status
  • API endpoint health
  • Quota information
  • Supported features
  • Provider-specific metadata

Error Response (422 Unprocessable Entity)

Returns validation error details when the model configuration is invalid or the connection test fails.

{
"detail": [
{
"loc": [
"path",
"model_id"
],
"msg": "Model not found or invalid model ID",
"type": "value_error.notfound"
}
]
}

Error Response Fields

FieldTypeDescription
detailarrayArray of validation error objects.
locarrayLocation of the error in the request (e.g., path, query).
msgstringHuman-readable error message.
typestringError type identifier.

Common Validation Failures

Failure TypeDescriptionResolution
Invalid API KeyAPI key is incorrect, expired, or revokedUpdate model with valid API key
Model Not FoundModel ID doesn't exist in the systemVerify model_id is correct
Connection TimeoutCannot reach provider's API endpointCheck network connectivity and base_url
Authentication FailedProvider rejected the credentialsVerify API key permissions and account status
Quota ExceededAPI usage limits reachedUpgrade plan or wait for quota reset
Invalid ConfigurationMissing required provider-specific fieldsCheck Azure deployment_name or other required fields
Provider UnavailableModel provider service is downWait and retry, or check provider status page

Error Codes

Status CodeDescriptionResponse Type
200OK - Model configuration is validSuccess
400Bad Request - Invalid request formatBad Request
401Unauthorized - Invalid API credentialsUnauthorized
404Not Found - Model ID doesn't existNot Found
422Validation Error - Model configuration invalidUnprocessable Entity
503Service Unavailable - Provider API unavailableService Unavailable
warning

Important Considerations

  • Validation tests make actual API calls to the provider, which may count against your quota
  • Some providers charge for validation requests
  • Validation does not guarantee all model features will work, only basic connectivity
  • Failed validation prevents the model from being used in AI agents
  • Always validate after updating model credentials or configuration
  • Keep validation frequency reasonable to avoid unnecessary API costs