# StableDiffusionCppResource

- Module: [CommunityToolkit.Aspire.Hosting.StableDiffusionCpp](/reference/api/typescript/communitytoolkit.aspire.hosting.stablediffusioncpp.md)
- Version: `13.5.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/tree/4ff8268fbd97ddd23cb73dc8eff9cc92718156d1)

Represents a stable-diffusion.cpp HTTP server container.

## Definition

```typescript
interface StableDiffusionCppResource
  extends IComputeResource,
    IExpressionValue,
    IManifestExpressionProvider,
    IResource,
    IResourceWithArgs,
    IResourceWithConnectionString,
    IResourceWithEndpoints,
    IResourceWithEnvironment,
    IResourceWithProbes,
    IResourceWithWaitSupport,
    IValueProvider,
    IValueWithReferences {
  readonly connectionStringExpression: ReferenceExpression;
  readonly imageVariant: StableDiffusionCppImageVariant;
  model: StableDiffusionCppModelResource;
  readonly primaryEndpoint: EndpointReference;
  readonly uriExpression: ReferenceExpression;
  addHuggingFaceModel(
      repository: string,
      fileName: string,
      revision?: string): StableDiffusionCppModelResource;
  addNamedHuggingFaceModel(
      name: string,
      repository: string,
      fileName: string,
      revision?: string): StableDiffusionCppModelResource;
  withGPUSupport(): StableDiffusionCppResource;
  withHuggingFaceToken(token: ParameterResource): StableDiffusionCppResource;
  withVaeTiling(): StableDiffusionCppResource;
}
```

## Properties

- `connectionStringExpression`: `ReferenceExpression` `get` -- Gets the ConnectionStringExpression property
- `imageVariant`: [StableDiffusionCppImageVariant](/reference/api/typescript/communitytoolkit.aspire.hosting.stablediffusioncpp/stablediffusioncppimagevariant.md) `get` -- Gets the selected official container image variant.
- `model`: [StableDiffusionCppModelResource](/reference/api/typescript/communitytoolkit.aspire.hosting.stablediffusioncpp/stablediffusioncppmodelresource.md) `get - set` -- Gets the configured Hugging Face model.
- `primaryEndpoint`: `EndpointReference` `get` -- Gets the primary HTTP endpoint.
- `uriExpression`: `ReferenceExpression` `get` -- Gets the HTTP server URI.

## Methods

- [addHuggingFaceModel](/reference/api/typescript/communitytoolkit.aspire.hosting.stablediffusioncpp/stablediffusioncppresource/addhuggingfacemodel.md) -- `method` -- Adds a Hugging Face model that is downloaded before the container starts.
    ```typescript
  addHuggingFaceModel(repository: string, fileName: string, revision?: string): StableDiffusionCppModelResource
  ```
- [addNamedHuggingFaceModel](/reference/api/typescript/communitytoolkit.aspire.hosting.stablediffusioncpp/stablediffusioncppresource/addnamedhuggingfacemodel.md) -- `method` -- Adds a named Hugging Face model that is downloaded before the container starts.
    ```typescript
  addNamedHuggingFaceModel(name: string, repository: string, fileName: string, revision?: string): StableDiffusionCppModelResource
  ```
- [withGPUSupport](/reference/api/typescript/communitytoolkit.aspire.hosting.stablediffusioncpp/stablediffusioncppresource/withgpusupport.md) -- `method` -- Adds the container runtime arguments required by the selected GPU backend.
    ```typescript
  withGPUSupport(): StableDiffusionCppResource
  ```
- [withHuggingFaceToken](/reference/api/typescript/communitytoolkit.aspire.hosting.stablediffusioncpp/stablediffusioncppresource/withhuggingfacetoken.md) -- `method` -- Supplies a Hugging Face access token for gated or private repositories.
    ```typescript
  withHuggingFaceToken(token: ParameterResource): StableDiffusionCppResource
  ```
- [withVaeTiling](/reference/api/typescript/communitytoolkit.aspire.hosting.stablediffusioncpp/stablediffusioncppresource/withvaetiling.md) -- `method` -- Processes VAE images in tiles to reduce peak memory usage during image decoding.
    ```typescript
  withVaeTiling(): StableDiffusionCppResource
  ```
