API Client Classes
This section documents all API client classes for interacting with the HoneyHive platform.
Note
For tracing and observability, use HoneyHiveTracer API Reference (HoneyHiveTracer). This page documents the HoneyHive API client for managing platform resources (datasets, projects, etc.) - typically used in scripts and automation.
HoneyHive Client
The main client class for interacting with the HoneyHive API.
- class honeyhive.api.client.HoneyHive(api_key=None, *, base_url=None, cp_base_url=None, server_url=None, timeout=None, retry_config=None, rate_limit_calls=None, rate_limit_window=None, max_connections=None, max_keepalive=None, test_mode=None, verbose=None, tracer_instance=None)[source]
Bases:
objectMain HoneyHive API client.
Provides an ergonomic interface to the HoneyHive API with both sync and async methods.
- Usage:
client = HoneyHive(api_key=”hh-example”)
# Sync configs = client.configurations.list(project=”my-project”)
# Async configs = await client.configurations.list_async(project=”my-project”)
- Parameters:
api_key (str | None)
base_url (str | None)
cp_base_url (str | None)
server_url (str | None)
timeout (float | None)
retry_config (Any | None)
rate_limit_calls (int | None)
rate_limit_window (float | None)
max_connections (int | None)
max_keepalive (int | None)
test_mode (bool | None)
verbose (bool | None)
tracer_instance (Any | None)
- configurations
API for managing configurations.
- datapoints
API for managing datapoints.
- datasets
API for managing datasets.
- events
API for managing events.
- experiments
API for managing experiment runs.
- metrics
API for managing metrics.
- projects
API for managing projects.
- sessions
API for managing sessions.
- tools
API for managing tools.
- __init__(api_key=None, *, base_url=None, cp_base_url=None, server_url=None, timeout=None, retry_config=None, rate_limit_calls=None, rate_limit_window=None, max_connections=None, max_keepalive=None, test_mode=None, verbose=None, tracer_instance=None)[source]
Initialize the HoneyHive client.
- Parameters:
api_key (str | None) – HoneyHive API key (typically starts with
hh_). Falls back to HH_API_KEY environment variable.base_url (str | None) – API base URL for Data Plane/ingestion. Falls back to HH_API_URL env var, then https://api.honeyhive.ai.
cp_base_url (str | None) – Control Plane API URL for query endpoints. Falls back to HH_CP_API_URL, then HH_API_URL env var.
server_url (str | None) – Deprecated alias for base_url (for backwards compatibility).
timeout (float | None) – Request timeout in seconds (accepted for backwards compat, not used).
retry_config (Any | None) – Retry configuration (accepted for backwards compat, not used).
rate_limit_calls (int | None) – Max calls per time window (accepted for backwards compat).
rate_limit_window (float | None) – Time window in seconds (accepted for backwards compat).
max_connections (int | None) – Max connections in pool (accepted for backwards compat).
max_keepalive (int | None) – Max keepalive connections (accepted for backwards compat).
test_mode (bool | None) – Enable test mode (accepted for backwards compat, not used).
verbose (bool | None) – Enable verbose logging (accepted for backwards compat, not used).
tracer_instance (Any | None) – Tracer instance (accepted for backwards compat, not used).
- Return type:
None
- property test_mode: bool
Return whether client is in test mode.
- property verbose: bool
Return whether verbose mode is enabled.
- property api_config: APIConfig
Access the underlying API configuration.
- property api_key: str
Get the HoneyHive API key.
- property server_url: str
Get the HoneyHive API server URL.
Usage Example
from honeyhive import HoneyHive
# Initialize the client
client = HoneyHive(api_key="your-api-key")
# Access API endpoints
datasets = client.datasets.list(project="your-project")
metrics = client.metrics.list(project="your-project")
BaseAPI
Base class for all API endpoint clients. All API classes (DatasetsAPI, EventsAPI, etc.) inherit from BaseAPI.
DatasetsAPI
API client for dataset operations.
- class honeyhive.api.client.DatasetsAPI(api_config)[source]
Bases:
BaseAPIDatasets API.
- Parameters:
api_config (APIConfig)
- list(project=None, type=None, dataset_id=None)[source]
List datasets.
- Parameters:
- Return type:
- create(request)[source]
Create a dataset.
- Parameters:
request (CreateDatasetRequest)
- Return type:
- update(request)[source]
Update a dataset.
- Parameters:
request (UpdateDatasetRequest)
- Return type:
None
- add_datapoints(dataset_id, request)[source]
Add datapoints to a dataset.
- Parameters:
dataset_id (str)
request (AddDatapointsToDatasetRequest | Dict[str, Any])
- Return type:
- async list_async(project=None, type=None, dataset_id=None)[source]
List datasets asynchronously.
- Parameters:
- Return type:
- async create_async(request)[source]
Create a dataset asynchronously.
- Parameters:
request (CreateDatasetRequest)
- Return type:
- async update_async(request)[source]
Update a dataset asynchronously.
- Parameters:
request (UpdateDatasetRequest)
- Return type:
None
- async delete_async(id)[source]
Delete a dataset asynchronously.
- Parameters:
id (str)
- Return type:
None
- async add_datapoints_async(dataset_id, request)[source]
Add datapoints to a dataset asynchronously.
- Parameters:
dataset_id (str)
request (AddDatapointsToDatasetRequest | Dict[str, Any])
- Return type:
- get_dataset(id, project=None)[source]
Get a dataset by ID (backwards compatible alias).
- Parameters:
- Return type:
- create_dataset(request)[source]
Create a dataset (backwards compatible alias for create()).
- Parameters:
request (CreateDatasetRequest)
- Return type:
- update_dataset(request)[source]
Update a dataset (backwards compatible alias for update()).
- Parameters:
request (UpdateDatasetRequest)
- Return type:
None
- delete_dataset(id)[source]
Delete a dataset (backwards compatible alias for delete()).
- Parameters:
id (str)
- Return type:
None
- list_datasets(project=None, **kwargs)[source]
List datasets (backwards compatible alias).
- Parameters:
- Return type:
Methods
create_dataset
- DatasetsAPI.create_dataset(request)[source]
Create a dataset (backwards compatible alias for create()).
- Parameters:
request (CreateDatasetRequest)
- Return type:
create_async
- async DatasetsAPI.create_async(request)[source]
Create a dataset asynchronously.
- Parameters:
request (CreateDatasetRequest)
- Return type:
list_datasets
get_dataset
update_dataset
- DatasetsAPI.update_dataset(request)[source]
Update a dataset (backwards compatible alias for update()).
- Parameters:
request (UpdateDatasetRequest)
- Return type:
None
delete_dataset
Example
from honeyhive import HoneyHive
from honeyhive.models import CreateDatasetRequest
client = HoneyHive(api_key="your-api-key")
# Create a dataset
dataset = client.datasets.create_dataset(
CreateDatasetRequest(
project="your-project",
name="test-dataset",
description="Test dataset for evaluation"
)
)
# List datasets
datasets = client.datasets.list_datasets(project="your-project")
# Get a specific dataset response by ID
dataset_response = client.datasets.get_dataset("dataset-id")
DatapointsAPI
API client for datapoint operations. Datapoints are individual records within datasets.
- class honeyhive.api.client.DatapointsAPI(api_config)[source]
Bases:
BaseAPIDatapoints API.
- Parameters:
api_config (APIConfig)
- list(project=None, datapoint_ids=None, dataset_name=None)[source]
List datapoints.
- Parameters:
- Return type:
- create(request)[source]
Create a datapoint.
- Parameters:
request (CreateDatapointRequest)
- Return type:
- update(id, request)[source]
Update a datapoint.
- Parameters:
id (str)
request (UpdateDatapointRequest)
- Return type:
None
- async list_async(project=None, datapoint_ids=None, dataset_name=None)[source]
List datapoints asynchronously.
- Parameters:
- Return type:
- async get_async(id)[source]
Get a datapoint by ID asynchronously.
- Parameters:
id (str)
- Return type:
- async create_async(request)[source]
Create a datapoint asynchronously.
- Parameters:
request (CreateDatapointRequest)
- Return type:
- async update_async(id, request)[source]
Update a datapoint asynchronously.
- Parameters:
id (str)
request (UpdateDatapointRequest)
- Return type:
None
- async delete_async(id)[source]
Delete a datapoint asynchronously.
- Parameters:
id (str)
- Return type:
- get_datapoint(id)[source]
Get a datapoint by ID (backwards compatible alias for get()).
- Parameters:
id (str)
- Return type:
- create_datapoint(request)[source]
Create a datapoint (backwards compatible alias for create()).
- Parameters:
request (CreateDatapointRequest)
- Return type:
- update_datapoint(id, request)[source]
Update a datapoint (backwards compatible alias for update()).
- Parameters:
id (str)
request (UpdateDatapointRequest)
- Return type:
None
- delete_datapoint(id)[source]
Delete a datapoint (backwards compatible alias for delete()).
- Parameters:
id (str)
- Return type:
Example
from honeyhive import HoneyHive
from honeyhive.models import CreateDatapointRequest
client = HoneyHive(api_key="your-api-key")
# Create a datapoint
datapoint = client.datapoints.create_datapoint(
CreateDatapointRequest(
inputs={"query": "What is machine learning?"},
ground_truth="Machine learning is a subset of AI...",
linked_datasets=["dataset-id"]
)
)
# List datapoints for a project
datapoints = client.datapoints.list(project="your-project")
# Get specific datapoint
datapoint = client.datapoints.get("datapoint-id")
ConfigurationsAPI
API client for configuration operations.
- class honeyhive.api.client.ConfigurationsAPI(api_config)[source]
Bases:
BaseAPIConfigurations API.
- Parameters:
api_config (APIConfig)
- create(request)[source]
Create a configuration.
- Parameters:
request (CreateConfigurationRequest)
- Return type:
None
- update(id, request)[source]
Update a configuration.
- Parameters:
id (str)
request (UpdateConfigurationRequest)
- Return type:
None
- async list_async(project=None, env=None, name=None)[source]
List configurations asynchronously.
- Parameters:
- Return type:
- async create_async(request)[source]
Create a configuration asynchronously.
- Parameters:
request (CreateConfigurationRequest)
- Return type:
None
- async update_async(id, request)[source]
Update a configuration asynchronously.
- Parameters:
id (str)
request (UpdateConfigurationRequest)
- Return type:
None
- async delete_async(id)[source]
Delete a configuration asynchronously.
- Parameters:
id (str)
- Return type:
None
- create_configuration(request)[source]
Create a configuration (backwards compatible alias).
- Parameters:
request (CreateConfigurationRequest)
- Return type:
None
- update_configuration(id, request)[source]
Update a configuration (backwards compatible alias).
- Parameters:
id (str)
request (UpdateConfigurationRequest)
- Return type:
None
MetricsAPI
API client for metrics operations.
- class honeyhive.api.client.MetricsAPI(api_config)[source]
Bases:
BaseAPIMetrics API.
- Parameters:
api_config (APIConfig)
- update(request)[source]
Update a metric.
- Parameters:
request (UpdateMetricRequest)
- Return type:
None
- async create_async(request)[source]
Create a metric asynchronously.
- Parameters:
request (Metric)
- Return type:
None
- async update_async(request)[source]
Update a metric asynchronously.
- Parameters:
request (UpdateMetricRequest)
- Return type:
None
- async delete_async(id)[source]
Delete a metric asynchronously.
- Parameters:
id (str)
- Return type:
None
- create_metric(request)[source]
Create a metric (backwards compatible alias).
- Parameters:
request (Metric)
- Return type:
None
- update_metric(request)[source]
Update a metric (backwards compatible alias).
- Parameters:
request (UpdateMetricRequest)
- Return type:
None
Example
from honeyhive import HoneyHive
client = HoneyHive(api_key="your-api-key")
# List metrics for a project
metrics = client.metrics.list(project="your-project")
ProjectsAPI
API client for project operations.
- class honeyhive.api.client.ProjectsAPI(api_config)[source]
Bases:
BaseAPIProjects API.
- Parameters:
api_config (APIConfig)
- create(data)[source]
Create a project.
- Parameters:
data (CreateProjectRequest)
- Return type:
- update(data)[source]
Update a project.
- Parameters:
data (UpdateProjectRequest)
- Return type:
None
- async list_async(name=None)[source]
List projects asynchronously.
- async create_async(data)[source]
Create a project asynchronously.
- Parameters:
data (CreateProjectRequest)
- Return type:
- async update_async(data)[source]
Update a project asynchronously.
- Parameters:
data (UpdateProjectRequest)
- Return type:
None
- async delete_async(name)[source]
Delete a project asynchronously.
- Parameters:
name (str)
- Return type:
None
- get_project(id)[source]
Get a project (backwards compatible alias).
- create_project(data)[source]
Create a project (backwards compatible alias).
- update_project(data)[source]
Update a project (backwards compatible alias).
Methods
create_project
list_projects
get_project
update_project
delete_project
Example
from honeyhive import HoneyHive
from honeyhive.models import CreateProjectRequest
client = HoneyHive(api_key="your-api-key")
# Create a project
project = client.projects.create(
CreateProjectRequest(
name="my-llm-project",
description="Production LLM application"
)
)
# List all projects
projects = client.projects.list_projects()
SessionsAPI
API client for session operations.
- class honeyhive.api.client.SessionsAPI(api_config)[source]
Bases:
BaseAPISessions API.
Supports startSession and getSession operations.
- Parameters:
api_config (APIConfig)
- start(data)[source]
Start a new session.
- Parameters:
data (StartSessionRequestBody | SessionStartRequest | Dict[str, Any])
- Return type:
- async get_async(session_id)[source]
Get a session by ID asynchronously.
- async start_async(data)[source]
Start a new session asynchronously.
- Parameters:
data (StartSessionRequestBody | SessionStartRequest | Dict[str, Any])
- Return type:
- create_session(request)[source]
Create/start a session (backwards compatible alias for start()).
- Parameters:
request (StartSessionRequestBody | SessionStartRequest | Dict[str, Any])
- Return type:
- start_session(request)[source]
Start a session (backwards compatible alias for start()).
- Parameters:
request (StartSessionRequestBody | SessionStartRequest | Dict[str, Any])
- Return type:
Example
from honeyhive import HoneyHive
client = HoneyHive(api_key="your-api-key")
from honeyhive.models import StartSessionRequestBody, SessionStartRequest
# Start a session
session = client.sessions.start(
StartSessionRequestBody(
session=SessionStartRequest(
project="your-project",
session_name="user-interaction"
)
)
)
# Get a session by ID
event = client.sessions.get(session.session_id)
ToolsAPI
API client for tool operations.
- class honeyhive.api.client.ToolsAPI(api_config)[source]
Bases:
BaseAPITools API.
- Parameters:
api_config (APIConfig)
- create(request)[source]
Create a tool.
- Parameters:
request (CreateToolRequest)
- Return type:
- update(request)[source]
Update a tool.
- Parameters:
request (UpdateToolRequest)
- Return type:
None
- async create_async(request)[source]
Create a tool asynchronously.
- Parameters:
request (CreateToolRequest)
- Return type:
- async update_async(request)[source]
Update a tool asynchronously.
- Parameters:
request (UpdateToolRequest)
- Return type:
None
- get_tool(id)[source]
Get a tool (backwards compatible alias).
- create_tool(request)[source]
Create a tool (backwards compatible alias).
- Parameters:
request (CreateToolRequest)
- Return type:
- update_tool(request)[source]
Update a tool (backwards compatible alias).
- Parameters:
request (UpdateToolRequest)
- Return type:
None
Methods
create_tool
- ToolsAPI.create_tool(request)[source]
Create a tool (backwards compatible alias).
- Parameters:
request (CreateToolRequest)
- Return type:
list_tools
get_tool
update_tool
- ToolsAPI.update_tool(request)[source]
Update a tool (backwards compatible alias).
- Parameters:
request (UpdateToolRequest)
- Return type:
None
delete_tool
Example
from honeyhive import HoneyHive
from honeyhive.models import CreateToolRequest
client = HoneyHive(api_key="your-api-key")
# Create a tool
tool = client.tools.create_tool(
CreateToolRequest(
project="your-project",
name="calculator",
description="Performs mathematical calculations",
parameters={
"type": "object",
"properties": {
"operation": {"type": "string"},
"a": {"type": "number"},
"b": {"type": "number"}
}
}
)
)
ExperimentsAPI
API client for experiment run operations. Also accessible as client.evaluations (backwards compatibility alias).
- class honeyhive.api.client.ExperimentsAPI(api_config)[source]
Bases:
BaseAPIExperiments API.
- Parameters:
api_config (APIConfig)
- list_runs(project=None)[source]
List experiment runs.
- Parameters:
project (str | None) – Optional project name filter.
- Return type:
- create_run(request)[source]
Create an experiment run.
- Parameters:
request (PostExperimentRunRequest)
- Return type:
- update_run(run_id, request)[source]
Update an experiment run.
- Parameters:
run_id (str)
request (PutExperimentRunRequest)
- Return type:
- compare_runs(new_run_id, old_run_id, project_id=None, aggregate_function=None)[source]
Compare two experiment runs.
- Parameters:
- Return type:
- async list_runs_async(project=None)[source]
List experiment runs asynchronously.
- Parameters:
project (str | None)
- Return type:
- async get_run_async(run_id)[source]
Get an experiment run by ID asynchronously.
- Parameters:
run_id (str)
- Return type:
- async create_run_async(request)[source]
Create an experiment run asynchronously.
- Parameters:
request (PostExperimentRunRequest)
- Return type:
- async update_run_async(run_id, request)[source]
Update an experiment run asynchronously.
- Parameters:
run_id (str)
request (PutExperimentRunRequest)
- Return type:
- async delete_run_async(run_id)[source]
Delete an experiment run asynchronously.
- Parameters:
run_id (str)
- Return type:
- async get_result_async(run_id, project_id=None, aggregate_function=None)[source]
Get experiment run result asynchronously.
Note
client.evaluations is an alias to client.experiments for backwards compatibility.
Neither exposes a top-level evaluate() method — use honeyhive.experiments.evaluate()
to run experiments. See Core Functions.
Example
from honeyhive import HoneyHive
client = HoneyHive(api_key="your-api-key")
# List experiment runs
runs = client.experiments.list_runs(project="your-project")
# Get a specific run
run = client.experiments.get_run(run_id="run-123")
# Compare two runs
comparison = client.experiments.compare_runs(
new_run_id="run-123",
old_run_id="run-456",
project_id="your-project"
)
EventsAPI
API client for event operations.
- class honeyhive.api.client.EventsAPI(api_config)[source]
Bases:
BaseAPIEvents API.
- Parameters:
api_config (APIConfig)
- list(query)[source]
Get events (POST /events/export).
- Parameters:
query (GetEventsRequest | Dict[str, Any])
- Return type:
- create(request)[source]
Create an event.
- Parameters:
request (PostEventRequestBody | PostEventRequest | Dict[str, Any])
- Return type:
- update(data)[source]
Update an event.
- Parameters:
data (UpdateEventRequest | Dict[str, Any])
- Return type:
None
- create_batch(data)[source]
Create events in batch.
- Parameters:
data (CreateEventBatchRequest | Dict[str, Any])
- Return type:
- create_model_event(data)[source]
Create a model event.
- Parameters:
data (CreateModelEventRequestBody | CreateModelEvent | Dict[str, Any])
- Return type:
- create_model_event_batch(data)[source]
Create model events in batch.
- Parameters:
data (CreateModelEventBatchRequest | Dict[str, Any])
- Return type:
- async list_async(query)[source]
Get events asynchronously.
- Parameters:
query (GetEventsRequest | Dict[str, Any])
- Return type:
- async create_async(request)[source]
Create an event asynchronously.
- Parameters:
request (PostEventRequestBody | PostEventRequest | Dict[str, Any])
- Return type:
- async update_async(data)[source]
Update an event asynchronously.
- Parameters:
data (UpdateEventRequest | Dict[str, Any])
- Return type:
None
- async create_batch_async(data)[source]
Create events in batch asynchronously.
- Parameters:
data (CreateEventBatchRequest | Dict[str, Any])
- Return type:
- create_event(request)[source]
Create an event (backwards compatible alias for create()).
- Parameters:
request (PostEventRequestBody | PostEventRequest | Dict[str, Any])
- Return type:
- update_event(data)[source]
Update an event (backwards compatible alias for update()).
- Parameters:
data (UpdateEventRequest | Dict[str, Any])
- Return type:
None
- list_events(query)[source]
List events (backwards compatible alias for list()).
- Parameters:
query (GetEventsRequest | Dict[str, Any])
- Return type:
- get_events(query)[source]
Get events (backwards compatible alias for list()).
- Parameters:
query (GetEventsRequest | Dict[str, Any])
- Return type:
Example
from honeyhive import HoneyHive
client = HoneyHive(api_key="your-api-key")
from honeyhive.models import PostEventRequest
# Create an event
response = client.events.create(
PostEventRequest(
project="your-project",
event_type="model",
event_name="gpt-4-call",
inputs={"prompt": "Hello"},
outputs={"completion": "Hi there!"},
metrics={"latency": 250}
)
)
See Also
Data Models Reference - Request and response models
Error Handling Reference - Error handling
HoneyHiveTracer API Reference - Tracer API