{"id":9498,"library":"athina-client","title":"Athina Client SDK","description":"Athina Client is a lightweight Python SDK designed to interact with Athina's datasets and API. It enables users to log LLM inferences, evaluations, and experiments for monitoring, analysis, and debugging AI applications. The current version is 0.2.11, with new releases occurring regularly, typically a few times a month, especially for minor fixes and feature additions.","status":"active","version":"0.2.11","language":"en","source_language":"en","source_url":"https://github.com/athina-ai/athina-python-client","tags":["AI","LLM","Evaluation","Monitoring","Observability","SDK"],"install":[{"cmd":"pip install athina-client","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"AthinaClient","correct":"from athina.client import AthinaClient"},{"note":"Pydantic models like AthinaInference are typically found in the interfaces submodule, not directly under client.","wrong":"from athina.client import AthinaInference","symbol":"AthinaInference","correct":"from athina.interfaces.athina import AthinaInference"}],"quickstart":{"code":"import os\nfrom athina.client import AthinaClient\n\n# Initialize the Athina client with your API key\nathina_client = AthinaClient(api_key=os.environ.get(\"ATHINA_API_KEY\", \"\"))\n\n# Example 1: Log an inference\ntry:\n    response = athina_client.log_inference(\n        prompt=\"What is the capital of France?\",\n        response=\"Paris\",\n        external_reference_id=\"my-app-inference-123\",\n        user_query=\"Capital question\"\n    )\n    print(f\"Inference logged successfully: {response.json()}\")\nexcept Exception as e:\n    print(f\"Error logging inference: {e}\")\n\n# Example 2: Log a simple evaluation\ntry:\n    response = athina_client.log_evaluation(\n        external_reference_id=\"my-app-evaluation-456\",\n        metric=\"correctness\",\n        score=1, # 1 for correct, 0 for incorrect\n        details=\"The response was accurate.\",\n        language_model_id=\"gpt-4\"\n    )\n    print(f\"Evaluation logged successfully: {response.json()}\")\nexcept Exception as e:\n    print(f\"Error logging evaluation: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize the Athina client and use its core functionality to log an LLM inference and a corresponding evaluation. Ensure the ATHINA_API_KEY environment variable is set."},"warnings":[{"fix":"Initialize `athina_client = AthinaClient(...)` and call methods like `athina_client.log_inference(...)`.","message":"The methods `log_inference` and `log_evaluation` were moved from directly under the `athina` module to be methods of the `AthinaClient` instance. If you were calling `athina.log_inference(...)`, you now need an instantiated client: `athina_client.log_inference(...)`.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Set `export ATHINA_API_KEY='your-api-key'` in your environment or explicitly pass it during client initialization: `AthinaClient(api_key='your-api-key')`.","message":"Failure to set the `ATHINA_API_KEY` environment variable or pass it directly to `AthinaClient(api_key=...)` will result in authentication errors (401 Unauthorized) when making API calls.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Remove the `batch_size` argument if you are calling `log_experiment`.","message":"The `log_experiment` method in `AthinaClient` removed the `batch_size` parameter.","severity":"breaking","affected_versions":">=0.2.10"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Verify that the `ATHINA_API_KEY` environment variable is correctly set with a valid key, or ensure the `api_key` argument is passed correctly during `AthinaClient` initialization.","cause":"The provided Athina API key is either missing, invalid, or expired.","error":"requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url:"},{"fix":"Initialize `athina_client = AthinaClient(...)` and then use `athina_client.log_inference(...)`.","cause":"Attempting to call `log_inference` (or `log_evaluation`) directly from the `athina` module, which was deprecated in favor of calling it on an `AthinaClient` instance.","error":"AttributeError: 'module' object has no attribute 'log_inference'"},{"fix":"Check for errors during `AthinaClient` initialization, especially related to the `api_key`. Ensure the client object is valid before calling its methods.","cause":"This often occurs if the `AthinaClient` object was not correctly instantiated (e.g., due to an error during `__init__`) or if a method was called on a `None` object, which can happen if `AthinaClient(...)` failed to return an instance.","error":"TypeError: 'NoneType' object is not callable"}]}