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

# Install SDK

> Install the SDK, evaluate a video, and submit jobs to retrieve later.

## Install

<Tabs>
  <Tab title="Python">
    Requires **Python 3.10+**. Install in your project's virtual environment:

    ```bash theme={null}
    python -m venv .venv
    source .venv/bin/activate
    pip install --pre physionlabs
    ```

    Save a Python example below as `example.py` and run `python example.py`.
  </Tab>

  <Tab title="TypeScript / JavaScript">
    Requires **Node.js 20+**:

    ```bash theme={null}
    npm install @physionlabs/galileo@next
    ```

    The package includes TypeScript types. The examples also run as JavaScript:
    save one as `example.mjs` and run `node example.mjs`.

    For CommonJS, use `const { Client } = require("@physionlabs/galileo")`
    and run calls that use `await` inside an async function.
  </Tab>
</Tabs>

Create an [API key](https://playground.physionlabs.ai/api-keys). Each example below
is standalone: replace `YOUR_API_KEY` and the video source before running it.

## Evaluate a local video

`create()` uploads the file, starts the evaluation, and waits for the result.
Use this for scripts that need the answer before continuing.

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from physionlabs import Client

    client = Client(api_key="YOUR_API_KEY")
    evaluation = client.evaluations.create(
        model="galileo-1.0",
        input={
            "video": {"path": "./video.mp4"},
            "prompt": "A red ball bounces twice.",
        },
    )
    print(evaluation.result)
    ```
  </Tab>

  <Tab title="TypeScript">
    ```ts theme={null}
    import { Client } from "@physionlabs/galileo";

    const client = new Client({ apiKey: "YOUR_API_KEY" });
    const evaluation = await client.evaluations.create({
      model: "galileo-1.0",
      input: {
        video: { path: "./video.mp4" },
        prompt: "A red ball bounces twice.",
      },
    });
    console.log(evaluation.result);
    ```
  </Tab>
</Tabs>

Use an H.264 MP4, up to 15 seconds and 50 MiB. Omit `prompt` for visual-glitch detection only.

## Submit a job

`submit()` returns an evaluation ID without waiting for the analysis to finish.
Use it when your application needs to continue working while Galileo evaluates the video.

This example uses a public video URL. You can also pass a local `path`; the SDK
finishes uploading and validating the file before returning the ID.

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from physionlabs import Client

    client = Client(api_key="YOUR_API_KEY")
    job = client.evaluations.submit(
        model="galileo-1.0",
        input={
            "video": {"url": "https://example.com/video.mp4"},
            "prompt": "A red ball bounces twice.",
        },
    )
    print(job.id)
    ```
  </Tab>

  <Tab title="TypeScript">
    ```ts theme={null}
    import { Client } from "@physionlabs/galileo";

    const client = new Client({ apiKey: "YOUR_API_KEY" });
    const job = await client.evaluations.submit({
      model: "galileo-1.0",
      input: {
        video: { url: "https://example.com/video.mp4" },
        prompt: "A red ball bounces twice.",
      },
    });
    console.log(job.id);
    ```
  </Tab>
</Tabs>

Store `job.id`. You can retrieve that evaluation from another process or after a restart.
In TypeScript, both `create()` and `submit()` return promises; only `create()` waits
for the evaluation to finish.

## Retrieve the result

Replace `EVALUATION_ID` with the ID printed above. `retrieve()` fetches the current
status once; a queued or processing evaluation may not have a result yet.

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from physionlabs import Client

    client = Client(api_key="YOUR_API_KEY")
    evaluation = client.evaluations.retrieve("EVALUATION_ID")

    print(evaluation.status.value)
    if evaluation.result:
        print(evaluation.result)
    if evaluation.error:
        print(evaluation.error.message)
    ```
  </Tab>

  <Tab title="TypeScript">
    ```ts theme={null}
    import { Client } from "@physionlabs/galileo";

    const client = new Client({ apiKey: "YOUR_API_KEY" });
    const evaluation = await client.evaluations.retrieve("EVALUATION_ID");

    console.log(evaluation.status);
    if (evaluation.result) console.log(evaluation.result);
    if (evaluation.error) console.error(evaluation.error.message);
    ```
  </Tab>
</Tabs>

If it is still running, retrieve the same ID later. To let the SDK wait instead,
replace the `retrieve()` line above with:

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    evaluation = client.evaluations.wait_until_settled("EVALUATION_ID")
    ```
  </Tab>

  <Tab title="TypeScript">
    ```ts theme={null}
    const evaluation = await client.evaluations.waitUntilSettled("EVALUATION_ID");
    ```
  </Tab>
</Tabs>

Both wait helpers return at `completed`, `partial`, or `failed`.
See [Evaluations](/guides/evaluations) for status meanings, findings, and history.

Keep API keys in server-side code. [API keys](/authentication) covers environment-variable
setup; the [changelog](/resources/changelog) lists SDK updates.
