
To invoke Azure AI methods, instantiate a Model Client. You have two options.

## Option 1: (Recommended) using Statsig Dynamic Config

Using Statsig's Dynamic Config lets you adjust AI invocation parameters and the endpoint without modifying code, giving you maximum flexibility.

In your Statsig console, go to https://console.statsig.com/dynamic\_configs and click **Create** to create a new **Dynamic Config**.

{% figure %}
![Dynamic Config creation interface](/images/integrations/azureai/model-client/29357d6f-c356-461c-afc7-e1673ba97f92.png)
{% /figure %}

After creation, fill in the properties of this deployment:

{% figure %}
![Dynamic Config properties configuration screen](/images/integrations/azureai/model-client/e4d20573-9d1f-4d62-af11-408435d02f90.png)
{% /figure %}

The JSON of this looks like this:

```
{
  endpoint: "https://FILL_IN_YOUR_ENDPOINT",
  key: "FILL_IN_YOUR_KEY",
  completion_defaults: {
    frequency_penalty: 0,
    presence_penalty: 0,
    temperature: 1,
    top_p: 1,
    max_tokens: 0,
    stop: [],
    seed: 0,
  },
}
```

After saving the Dynamic Config, instantiate your Model Client using the **id** of that config:

{% tabs %}
{% tab title="NodeJS" %}
```js
const client = AzureAI.getModelClient("<dynamic_config_id>");
```
{% /tab %}

{% tab title="Python" %}
```python
client = AzureAI.get_model_client("<dynamic_config_id>")
```
{% /tab %}

{% tab title=".NET" %}
```csharp
var client = Server.GetModelClient("<dynamic_config_id>");
```
{% /tab %}
{% /tabs %}

## Option 2: Using hard-coded endpoint and key

This option instantiates an AI model client directly. You must embed the endpoint and key in your code or load them using another mechanism, such as an environment variable.

{% tabs %}
{% tab title="NodeJS" %}
```js
const modelClient = AzureAI.getModelClientFromEndpoint(
    "<DEPLOYMENT_ENDPOINT_URL>",
    "<DEPLOYMENT_KEY>"
);
```
{% /tab %}

{% tab title="Python" %}
```python
modelClient = AzureAI.get_model_client_from_endpoint("<DEPLOYMENT_ENDPOINT_URL>", "<DEPLOYMENT_KEY>")
```
{% /tab %}

{% tab title=".NET" %}
```csharp
var modelClient = Server.GetModelClientFromEndpoint(
    "<DEPLOYMENT_ENDPOINT_URL>",
    "<DEPLOYMENT_KEY>"
);
```
{% /tab %}
{% /tabs %}
