System Resource
API methods for system operations.
Methods
metrics_metrics
Metrics Endpoint that serves Prometheus metrics.
Method: GET
Path: /metrics
response = client.system.metrics_metrics()
Parameters
Responses
200 - Successful Response
ping
Ping Ping endpoint (public, no authentication required).
Method: GET
Path: /ping
response = client.system.ping()
Parameters
Responses
200 - Successful Response
- Content-Type:
application/json - Schema:
PingResponse
Usage Examples
Here's a complete example using the metrics_metrics method:
import asyncio
from credoai import
async def main():
# Initialize client
client = (
base_url="https://api.credo.ai",
api_key="test_password-your-api-key"
)
try:
# Metrics
response = await client.system.metrics_metrics()
print(f"Success: {response}")
except Exception as e:
print(f"Error: {e}")
finally:
await client.close()
# Run the example
asyncio.run(main())
Error Handling
All methods in this resource can raise the following exceptions:
ValidationError- Invalid request dataAPIError- Server-side errorsAuthenticationError- Invalid or missing API keyNotFoundError- Resource not found (404)RateLimitError- Too many requests
from credoai.errors import APIError, ValidationError
try:
response = client.system.metrics_metrics()
except ValidationError as e:
print(f"Invalid request: {e}")
except APIError as e:
print(f"API error {e.status_code}: {e.message}")