# WithHealthCheck

- Module: [Aspire.Hosting.OpenAI](/reference/api/go/aspire.hosting.openai.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`OpenAIModelResource`](/reference/api/go/aspire.hosting.openai/openaimodelresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Adds a health check to the OpenAI Model resource.

## Remarks

This method adds a health check that verifies the OpenAI endpoint is accessible,
the API key is valid, and the specified model is available. The health check will:
-
-
-
Because health checks are included in the rate limit of the OpenAI API,
it is recommended to use this health check sparingly, such as when you are having issues understanding the reason
the model is not working as expected. Furthermore, the health check will run a single time per application instance.

## Definition

```go
func (OpenAIModelResource) WithHealthCheck() OpenAIModelResource
```

## Returns

[`OpenAIModelResource`](/reference/api/go/aspire.hosting.openai/openaimodelresource.md) -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`OpenAIModelResource`](/reference/api/go/aspire.hosting.openai/openaimodelresource.md)
