> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lazycloud.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Develop a function locally, test it in the cloud, then deploy an HTTP endpoint and call it.

## Install and sign in

Install [uv](https://docs.astral.sh/uv/getting-started/installation/), then:

```bash theme={null}
uv tool install lazycloud-client
lazycloud login
```

`login` prints a link and a code. Open the link, check that the code matches
your terminal, and approve.

## Download the project

```bash theme={null}
lazycloud example download quickstart
cd quickstart
uv sync
```

It contains `quickstart.py`:

```python theme={null}
from pydantic import BaseModel

from lazycloud import App, Image

app = App("quickstart")
image = Image(python_version="3.12")


@app.function(name="hello", image=image, cpu=1.0, memory="256Mi")
def hello(name: str = "world") -> str:
    print(f"Greeting {name} from LazyCloud", flush=True)
    return f"hello {name}"


class Greeting(BaseModel):
    greeting: str


@app.endpoint(name="greet", route="/greet", methods=["POST"], image=image)
def greet(name: str) -> Greeting:
    return Greeting(greeting=hello.local(name))


if __name__ == "__main__":
    print("running local")
    print(hello.local("LazyCloud"))
    print("running remote")
    print(hello.remote("LazyCloud"))
```

## Run it

```bash theme={null}
uv run python quickstart.py
```

`.local()`, like a plain `hello("LazyCloud")` call, runs in your own Python
process for free. `.remote()` uploads your code and runs the same function on a
cloud machine with 1 CPU and 256 MiB, then streams its logs back and returns
`hello LazyCloud`. The first remote call waits for the image to build.

The CLI makes the same cloud call without a `__main__` block:

```bash theme={null}
uv run lazycloud run quickstart:hello LazyCloud
```

## Deploy the endpoint

`greet` is an HTTP endpoint that calls `hello` inside its own container and
returns a `Greeting` model, which LazyCloud sends as JSON.
Deploying the app puts both workloads in the cloud:

```bash theme={null}
uv run lazycloud deploy quickstart
```

The app now runs on LazyCloud, not on your machine, and stays up after you
close the terminal. The deploy output includes the endpoint's HTTPS URL.

## Call it

Over HTTP, with an access token from the
[dashboard](https://lazycloud.dev/dashboard) under Settings, then Tokens:

```bash theme={null}
read -rsp "LazyCloud token: " LAZYCLOUD_TOKEN; echo
curl --fail --show-error "<endpoint-url>" \
  -H "Authorization: Bearer $LAZYCLOUD_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "LazyCloud"}'
```

From code in the same project, the decorated function is the client. It uses
your `lazycloud login` sign-in:

```python theme={null}
from quickstart import greet

print(greet.request("LazyCloud").json())
```

From another project, a generated package gives typed calls without your
source. Run the export there:

```bash theme={null}
uv run lazycloud app export quickstart
```

```python theme={null}
from lazycloud_clients.quickstart import greet

print(greet.request("LazyCloud"))
```

The HTTP and in-project calls return `{"greeting": "hello LazyCloud"}`. The
typed package returns the same fields as a typed object.
[Typed client packages](/concepts/apps#call-deployed-workloads-from-other-projects)
covers regenerating the package after a deploy.

## Clean up

```bash theme={null}
uv run lazycloud app pause quickstart
```

`pause` stops the app's workloads and keeps their definitions.
`uv run lazycloud app delete quickstart` removes the app.

## Next

* [Develop, test, deploy](/concepts/workflow) for live previews and where each call goes.
* [Apps and workloads](/concepts/apps) to lay out your own project.
