Skip to main content

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


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 data
  • APIError - Server-side errors
  • AuthenticationError - Invalid or missing API key
  • NotFoundError - 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}")