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

# endpoint_model

Client-agnostic endpoint model.

Provides a single `EndpointModel` that pairs a `ModelSpec` with any `Client` implementation (HTTP, AWS SageMaker, GCP, Azure, …).  This eliminates the need for per-backend model subclasses.

## EndpointModel

```python theme={null}
class EndpointModel()
```

Model endpoint backed by a pluggable client.

Combines a `ModelSpec` (what the model expects and produces) with a `Client` (how to reach it).

Supports both synchronous (`predict` / `embed`) and asynchronous (`predict_async` / `embed_async`) dispatch.

<ParamField body="model_spec">
  Model specification describing input requirements and output shape.
</ParamField>

<ParamField body="transport">
  A configured `Client` instance (e.g. `HTTPClient`, `AWSClient`).
</ParamField>

<ParamField body="input_gene_names">
  Optional ordered Ensembl IDs expected as bulk RNA input (M-Optimus ).
</ParamField>

<ParamField body="output_gene_names">
  Optional ordered Ensembl IDs of predicted output genes (M-Optimus).
</ParamField>

**Example:**

```python theme={null}
from bioptimus.models.clients.http import HTTPClient

client = HTTPClient(
    "http://localhost:8080",
    endpoints={"embedding": "/api/embed/h1"},
)
model = EndpointModel(H1_SPEC, client)
response = model(request)
```

#### model\_spec

```python theme={null}
@property
def model_spec() -> ModelSpec
```

Model specification including tile and output config.

#### input\_gene\_names

```python theme={null}
@property
def input_gene_names() -> list[str] | None
```

Ordered Ensembl IDs expected as bulk RNA input.

#### output\_gene\_names

```python theme={null}
@property
def output_gene_names() -> list[str] | None
```

Ordered Ensembl IDs of predicted output genes.

#### predict

```python theme={null}
def predict(request: ModelRequest) -> ModelResponse
```

Send a prediction request to the endpoint.

<ParamField body="request" type="ModelRequest" required>
  Tile request payload to send.
</ParamField>

<ResponseField name="returns" type="ModelResponse">
  Parsed model response with predictions.
</ResponseField>

#### embed

```python theme={null}
def embed(request: ModelRequest) -> ModelResponse
```

Send an embedding request to the endpoint.

<ParamField body="request" type="ModelRequest" required>
  Tile request payload to send.
</ParamField>

<ResponseField name="returns" type="ModelResponse">
  Parsed model response with embeddings.
</ResponseField>

#### predict\_async

```python theme={null}
async def predict_async(request: ModelRequest,
                        session: Any = None) -> ModelResponse
```

Send a prediction request asynchronously.

<ParamField body="request" type="ModelRequest" required>
  Tile request payload to send.
</ParamField>

<ParamField body="session" type="Any">
  An `ClientSession` for connection pooling.
</ParamField>

<ResponseField name="returns" type="ModelResponse">
  Parsed model response with predictions.
</ResponseField>

#### embed\_async

```python theme={null}
async def embed_async(request: ModelRequest,
                      session: Any = None) -> ModelResponse
```

Send an embedding request asynchronously.

<ParamField body="request" type="ModelRequest" required>
  Tile request payload to send.
</ParamField>

<ParamField body="session" type="Any">
  An `ClientSession` for connection pooling.
</ParamField>

<ResponseField name="returns" type="ModelResponse">
  Parsed model response with embeddings.
</ResponseField>
