# Manage Dedicated Deployments

[Dedicated Deployments](https://docs.roboflow.com/deploy/dedicated-deployments) are managed GPU machines that run your Roboflow models with predictable latency and high throughput. The SDK manages them through the `roboflow.adapters.deploymentapi` adapter — the high-level `Workspace` class doesn't currently expose deployment methods.

Each function returns a `(status_code, body)` tuple so you can branch on the HTTP result:

```python
from roboflow.adapters import deploymentapi

status, body = deploymentapi.list_deployment("YOUR_API_KEY")
if status == 200:
    for d in body.get("deployments", []):
        print(d["deployment_name"], d["status"])
else:
    print("Failed:", body)
```

## List available machine types

```python
from roboflow.adapters import deploymentapi

status, body = deploymentapi.list_machine_types("YOUR_API_KEY")
for m in body.get("machine_types", []):
    print(m["name"], m.get("description"))
```

## Create a deployment

```python
status, body = deploymentapi.add_deployment(
    api_key="YOUR_API_KEY",
    creator_email="me@company.com",          # must be a workspace member
    machine_type="gpu-small",
    duration=8,                                # hours
    delete_on_expiration=True,
    deployment_name="my-deployment",
    inference_version=None,                    # None → latest
)
```

The deployment provisions asynchronously. Poll `get_deployment` until `status == "ready"`.

## Get deployment details

```python
status, body = deploymentapi.get_deployment("YOUR_API_KEY", "my-deployment")
print(body["status"], body.get("public_url"))
```

## Pause / resume / delete

```python
deploymentapi.pause_deployment("YOUR_API_KEY", "my-deployment")
deploymentapi.resume_deployment("YOUR_API_KEY", "my-deployment")
deploymentapi.delete_deployment("YOUR_API_KEY", "my-deployment")
```

## Logs

```python
import datetime as dt

status, body = deploymentapi.get_deployment_log(
    api_key="YOUR_API_KEY",
    deployment_name="my-deployment",
    from_timestamp=dt.datetime.utcnow() - dt.timedelta(hours=1),
    to_timestamp=dt.datetime.utcnow(),
    max_entries=200,
)
for entry in body.get("logs", []):
    print(entry["timestamp"], entry["message"])
```

## Usage

```python
status, ws_usage = deploymentapi.get_workspace_usage(
    api_key="YOUR_API_KEY",
    from_timestamp=dt.datetime(2026, 4, 1),
    to_timestamp=dt.datetime(2026, 5, 1),
)

status, dep_usage = deploymentapi.get_deployment_usage(
    api_key="YOUR_API_KEY",
    deployment_name="my-deployment",
    from_timestamp=dt.datetime(2026, 4, 1),
    to_timestamp=dt.datetime(2026, 5, 1),
)
```

## Running inference against a dedicated deployment

Once a deployment is ready, point inference SDK calls at its `public_url` (returned by `get_deployment`):

```python
from inference_sdk import InferenceHTTPClient

client = InferenceHTTPClient(api_url=body["public_url"], api_key="YOUR_API_KEY")
result = client.infer("photo.jpg", model_id="my-detector/3")
```

## REST and CLI equivalents

* REST: see [Dedicated Deployments (REST)](/developer/rest-api/dedicated-deployments.md).
* CLI: see [Manage Deployments (CLI)](/developer/command-line-interface/manage-deployments.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roboflow.com/developer/python-sdk/manage-dedicated-deployments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
