{"id":3457,"library":"diracx-client","title":"DiracX Client Library","description":"The DiracX Python Client Library, currently at version 0.0.12, provides a Pythonic interface for interacting with the DiracX AI platform. It allows developers to integrate advanced AI functionalities into their applications by accessing features like model listing and AI task creation. The library is under active development, with frequent pre-1.0 releases.","status":"active","version":"0.0.12","language":"en","source_language":"en","source_url":"https://github.com/diracx-ai/diracx-client-python","tags":["AI","API Client","Machine Learning","Generative AI"],"install":[{"cmd":"pip install diracx-client","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"HTTP client for API communication.","package":"httpx","optional":false},{"reason":"JSON Web Token handling for authentication.","package":"pyjwt","optional":false},{"reason":"For loading environment variables (e.g., API keys) from .env files. While common for examples, it's a direct dependency.","package":"python-dotenv","optional":false},{"reason":"Data validation and settings management, specifically requires Pydantic V2.","package":"pydantic","optional":false}],"imports":[{"symbol":"DiracXClient","correct":"from diracx_client import DiracXClient"}],"quickstart":{"code":"import os\nfrom diracx_client import DiracXClient\n\n# Ensure DIRACX_API_KEY and DIRACX_API_SECRET are set as environment variables\n# For local development, you might use a .env file and python-dotenv.\n# e.g., os.environ['DIRACX_API_KEY'] = 'your_key'\n#       os.environ['DIRACX_API_SECRET'] = 'your_secret'\n\napi_key = os.environ.get(\"DIRACX_API_KEY\", \"\")\napi_secret = os.environ.get(\"DIRACX_API_SECRET\", \"\")\n\nif not api_key or not api_secret:\n    print(\"Error: DIRACX_API_KEY and DIRACX_API_SECRET environment variables must be set.\")\n    # In a real application, you might raise an exception or handle this more gracefully.\n    exit(1)\n\n# Initialize the DiracXClient\nclient = DiracXClient(api_key=api_key, api_secret=api_secret)\n\n# Example: Fetch available models\ntry:\n    models_response = client.models.list_all()\n    print(\"Successfully fetched models.\")\n    if models_response.data:\n        print(f\"First model ID: {models_response.data[0].id}\")\n        print(f\"First model Name: {models_response.data[0].name}\")\n    else:\n        print(\"No models found.\")\nexcept Exception as e:\n    print(f\"Error fetching models: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize the DiracX client using API keys from environment variables and fetch a list of available AI models. Ensure 'DIRACX_API_KEY' and 'DIRACX_API_SECRET' are configured in your environment."},"warnings":[{"fix":"Always refer to the latest documentation and examples for your specific `0.0.x` version. Pin exact versions in `requirements.txt` to avoid unexpected breakage in production: `diracx-client==0.0.12`.","message":"The library is currently in a pre-1.0 state (0.0.x versions). This means the API is unstable and subject to frequent breaking changes without adhering to semantic versioning (e.g., a minor version bump might introduce breaking changes).","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Update any other dependencies requiring Pydantic to their V2 compatible versions, or refactor your code to use Pydantic V2 directly. If a conflict is unavoidable, consider isolating environments or using alternative data validation libraries.","message":"The library has a strict dependency on Pydantic V2 (`pydantic>=2.7.0`). If your project also uses Pydantic V1, this will lead to package conflicts or runtime errors due to incompatible APIs. Ensure your project's Pydantic usage is compatible with V2.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Ensure both `DIRACX_API_KEY` and `DIRACX_API_SECRET` are properly configured in your environment before running the application. For local development, `python-dotenv` can be used to load these from a `.env` file.","message":"Authentication relies on `DIRACX_API_KEY` and `DIRACX_API_SECRET` environment variables. If these are not correctly set, the client initialization will fail or API calls will be unauthorized, often leading to `exit(1)` in example scripts.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}