> For the complete documentation index, see [llms.txt](https://docs.eyepop.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eyepop.ai/deploying/on-premise/applications.md). Agents can also search and read this documentation through its [MCP server](https://docs.eyepop.ai/~gitbook/mcp).

# Call It From Your Application

Send an instance media from the CLI, over HTTP, or with the SDKs

<figure><img src="https://1072321683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDoCvfjveqiJFmk0cnXCp%2Fuploads%2Fgit-blob-7b66321b0fa1f49aade777b8d0c63dfd69578bae%2Fapplications-overview.svg?alt=media" alt="Two separate flows. First, once: the EyePop CLI sets up the EyePop on-premise instance with instance init or instance set and the pop it serves, and the instance runs, serving that pop on the machine&#x27;s own hardware at http://127.0.0.1:8080. Second, as often as you like: your application, using eyepop run, the Python or Node SDK, or HTTP, sends the instance media, a file or a url, and gets the predictions back as the response."><figcaption><p>Setting up the instance decides what it serves; your application only sends media and gets predictions back.</p></figcaption></figure>

## From the CLI

With no target, `run` uses the pop the instance serves:

```bash
eyepop run --media-path image.jpg
```

You can also name the ability the instance serves. If you name a different ability, `run` refuses instead of answering with the wrong model:

```bash
eyepop run --ability eyepop.person:latest --media-path image.jpg
```

To serve something else, change it with `eyepop instance set`; see [Serve a different model](https://docs.eyepop.ai/deploying/on-premise/getting-started.md#5-serve-a-different-model).

Runs with `--ability`, `--pop`, or no target never leave the machine. `--model` also runs on the instance when it names a model, but it looks the name up with EyePop first. A `--model` that names a VLM ability is not served by an instance at all: it runs in EyePop's cloud and is billed there. Prefer `--ability` and `--pop` on an on-premise machine.

If the instance is stopped, `run` says it is not responding and does not fall back to the cloud. Start it with `eyepop instance start`.

[Run Inference](https://docs.eyepop.ai/cli/run.md) covers everything `run` can do, which also works against an instance.

## From your code

Applications on the machine reach the instance at `http://127.0.0.1:8080`, over plain HTTP or through the EyePop SDKs. Both run on the pipeline the instance is set up with, so you do not pass a pop: the instance serves the one you chose with `eyepop instance init`, and `eyepop instance set` changes it.

{% tabs %}
{% tab title="curl" %}
The instance serves its pop on a pipeline. Find it, then send media to it:

```bash
PIPELINE_ID=$(curl -sS http://127.0.0.1:8080/pipelines | jq -r '.[0].id')

# A local file, as raw bytes
curl -sS -X POST \
  "http://127.0.0.1:8080/pipelines/$PIPELINE_ID/source?mode=queue&processing=sync" \
  -H 'Content-Type: image/jpeg' \
  -H 'Accept: application/jsonl' \
  --data-binary @image.jpg

# A URL the instance fetches itself
curl -sS -X PATCH \
  "http://127.0.0.1:8080/pipelines/$PIPELINE_ID/source?mode=queue&processing=sync" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/jsonl' \
  -d '{"sourceType": "URL", "url": "https://example.com/image.jpg"}'
```

Predictions come back as JSON Lines: one line for an image, one per frame for a video.
{% endtab %}

{% tab title="Python" %}

```python
from eyepop import EyePopSdk

with EyePopSdk.sync_worker(is_local_mode=True) as endpoint:
    result = endpoint.upload("image.jpg").predict()
    print(result)
```

This needs `eyepop` 4.1.2 or later, or 3.25.2 to 3.x. Versions 4.0.0 to 4.1.1 look for a pipeline API in local mode, which an instance does not run, unless you also pass `is_pipeline_mode=False`.

To reach an instance on another host or port, pass `eyepop_url`, such as `eyepop_url="http://192.168.1.20:8080"`. See [local mode in the Python SDK](https://docs.eyepop.ai/sdks/python/configuration.md#local-mode).
{% endtab %}

{% tab title="Node" %}

```typescript
import { EyePop } from '@eyepop.ai/eyepop'

async function main() {
    const endpoint = await EyePop.workerEndpoint({ isLocalMode: true }).connect()

    try {
        const results = await endpoint.process({ source: { path: 'image.jpg' } })
        for await (const result of results) {
            console.log(result)
        }
    } finally {
        await endpoint.disconnect()
    }
}

main().catch(console.error)
```

This needs `@eyepop.ai/eyepop` 4.2.3 or later. Versions 4.0.0 to 4.2.2 look for a pipeline API in local mode, which an instance does not run, unless you also pass `isPipelineMode: false`. Node's local mode always uses port 8080 on this machine. It also sends an `EYEPOP_API_KEY` found in the environment; unset it to connect without one. See [local mode in the Node SDK](https://docs.eyepop.ai/sdks/node/configuration.md#local-mode).
{% endtab %}
{% endtabs %}

**Local mode** is what points an SDK at the instance instead of EyePop's cloud. It needs no account credentials, and `EYEPOP_LOCAL_MODE=true` in the environment turns it on without changing the code.

The SDK runs on the instance's own pipeline and leaves it running when it disconnects. Reuse one connected endpoint for many images instead of connecting for each one.

The first request for an ability is slower while the instance downloads the model. After that it is served from the machine.

The instance asks callers for no credential, so whoever can reach port 8080 can use it; see [`--bind`](https://docs.eyepop.ai/deploying/on-premise/settings.md#bind).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.eyepop.ai/deploying/on-premise/applications.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
