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

# Azure

> Python API reference for the azure llm plugin.

<Card title="Usage guide" icon="book" href="/plugins/llm/azure" horizontal>
  Setup, environment variables, and Python/JavaScript/Go usage examples.
</Card>

## AzureOpenAILLM

Azure OpenAI LLM plugin.

Wraps Azure-hosted OpenAI chat-completion models (GPT-4o, o-series, etc.)
with streaming generation, tool/function calling, and structured-output
support via a user-managed Azure deployment.

### Constructor

```python theme={null}
AzureOpenAILLM(*, api_key: 'str | None' = None, azure_endpoint: 'str | None' = None, deployment: 'AzureOpenAILLMModel | str | None' = None, api_version: 'str' = '2024-10-21', temperature: 'float' = 0.7, max_output_tokens: 'int' = 1024, top_p: 'float | None' = None, frequency_penalty: 'float | None' = None, presence_penalty: 'float | None' = None, seed: 'int | None' = None, stop: 'str | None' = None, user: 'str | None' = None, tool_choice: 'str | None' = None, parallel_tool_calls: 'bool | None' = None, response_format=None, reasoning_effort: 'str | None' = None, **kwargs) -> 'None'
```

<ParamField path="api_key" type="str | None">
  Azure OpenAI API key. Falls back to the `AZURE_OPENAI_API_KEY` environment variable when omitted.
</ParamField>

<ParamField path="azure_endpoint" type="str | None">
  Full Azure OpenAI resource endpoint URL, e.g. `"https://&lt;resource>.openai.azure.com/"`. Falls back to the `AZURE_OPENAI_ENDPOINT` environment variable when omitted.
</ParamField>

<ParamField path="deployment" type="AzureOpenAILLMModel | str | None">
  Name of the Azure OpenAI **deployment** (not the underlying model name). This is the custom name you chose when deploying a model in the Azure portal or AI Foundry, e.g. `"gpt-4o-deployment"`. Accepts any `AzureOpenAILLMModel` enum value or a raw string. Defaults to `None` (empty string, must be provided).
</ParamField>

<ParamField path="api_version" type="str" default="2024-10-21">
  Azure OpenAI REST API version date string. Defaults to `"2024-10-21"` (GA stable release for chat completions). Use `"2025-03-01-preview"` or later to access preview features.
</ParamField>

<ParamField path="temperature" type="float" default="0.7">
  Sampling temperature in `[0.0, 2.0]`. Lower values produce more deterministic output. Defaults to `0.7`.
</ParamField>

<ParamField path="max_output_tokens" type="int" default="1024">
  Maximum tokens the model may generate per response. Defaults to `1024`.
</ParamField>

<ParamField path="top_p" type="float | None">
  Nucleus sampling probability mass in `(0.0, 1.0]`. Mutually exclusive with `temperature`; set one or the other. Defaults to `None` (disabled).
</ParamField>

<ParamField path="frequency_penalty" type="float | None">
  Float in `[-2.0, 2.0]`. Penalises token repetition based on cumulative frequency in the output so far. Positive values reduce repetition. Defaults to `None`.
</ParamField>

<ParamField path="presence_penalty" type="float | None">
  Float in `[-2.0, 2.0]`. Penalises tokens that have already appeared at least once, encouraging topic diversity. Defaults to `None`.
</ParamField>

<ParamField path="seed" type="int | None">
  Integer seed for deterministic sampling. When set, the API makes a best effort to return the same result for identical inputs. Defaults to `None`.
</ParamField>

<ParamField path="stop" type="str | None">
  String (or up to four strings) at which the model stops generating further tokens. Defaults to `None`.
</ParamField>

<ParamField path="user" type="str | None">
  Opaque end-user identifier forwarded to Azure for abuse monitoring. Defaults to `None`.
</ParamField>

<ParamField path="tool_choice" type="str | None">
  Controls how the model selects tools. One of `"none"` (no tools), `"auto"` (model decides), or `"required"` (must call a tool). Also accepts a named tool dict. Defaults to `None` (`"auto"` when tools are present).
</ParamField>

<ParamField path="parallel_tool_calls" type="bool | None">
  When `True`, the model may emit multiple tool calls in a single response turn. Defaults to `None` (provider default, currently `True`).
</ParamField>

<ParamField path="response_format">
  Enforce a structured output schema. Pass `&#123;"type": "json_object"&#125;` for JSON mode or a JSON Schema dict for strict structured outputs. Defaults to `None` (plain text).
</ParamField>

<ParamField path="reasoning_effort" type="str | None">
  Controls reasoning token budget for o-series (reasoning) models. One of `"low"`, `"medium"`, or `"high"`. Ignored for non-reasoning models. Defaults to `None`.
</ParamField>

### aclose

```python theme={null}
def aclose(self) -> 'None'
```

Release any resources held by the provider.

### cancel\_current\_generation

```python theme={null}
def cancel_current_generation(self) -> 'None'
```

Cancel the in-progress generation for the active session, if any.

### chat

```python theme={null}
def chat(self, messages: 'Any', tools: 'Any' = None, conversational_graph: 'Any' = None, **kwargs: 'Any') -> 'AsyncIterator[LLMResponse]'
```

Generate a streamed chat completion.

<ParamField path="messages" type="Any" required>
  The conversation history to send to the model.
</ParamField>

<ParamField path="tools" type="Any">
  Optional tool definitions the model may call.
</ParamField>

<ParamField path="conversational_graph" type="Any">
  Optional conversational graph guiding the exchange.
</ParamField>

<ResponseField name="returns" type="AsyncIterator[LLMResponse]">
  LLMResponse: Response chunks produced as the model generates output.
</ResponseField>

### emit

```python theme={null}
def emit(self, event: 'T', *args: 'Any') -> 'None'
```

Emit an event, invoking all registered handlers with the given arguments.

Handlers are called in registration order. Coroutine handlers are
scheduled on the running event loop. If the emitter is closed, the call
is a no-op.

<ParamField path="event" type="T" required>
  The event to emit.
</ParamField>

### off

```python theme={null}
def off(self, event: 'T', callback: 'Callable[..., Any]') -> 'None'
```

Remove a previously registered handler for an event.

If the handler is not registered for the event, the call is a no-op.

<ParamField path="event" type="T" required>
  The event the handler was registered for.
</ParamField>

<ParamField path="callback" type="Callable[..., Any]" required>
  The handler to remove.
</ParamField>

### on

```python theme={null}
def on(self, event: 'T', callback: 'Callable[..., Any] | None' = None) -> 'Callable[..., Any]'
```

Register a handler for an event.

Can be used directly by passing a callback, or as a decorator when
`callback` is omitted.

<ParamField path="event" type="T" required>
  The event to listen for.
</ParamField>

<ParamField path="callback" type="Callable[..., Any] | None">
  The handler to invoke when the event is emitted. If `None`, a decorator is returned that registers the decorated function.
</ParamField>

<ResponseField name="returns" type="Callable[..., Any]">
  The registered callback when `callback` is provided, otherwise a decorator that registers and returns the function it wraps.
</ResponseField>

***

## AzureOpenAILLMModel

```python theme={null}
AzureOpenAILLMModel = typing.Literal['gpt-5.5', 'gpt-5.4', 'gpt-5.4-mini', 'gpt-5.4-nano', 'gpt-4.1', 'gpt-4.1-mini', 'gpt-4.1-nano', 'o4-mini', 'o3', 'gpt-4o']
```
