Nexus

Azure OpenAI

Use Azure-hosted OpenAI models with Nexus — deployment-based URL and api-key auth.

The Azure OpenAI provider connects to Azure-hosted OpenAI deployments. It uses the same request/response format as OpenAI but with a different URL structure (/openai/deployments/{id}/...) and api-key header authentication.

Installation

import "github.com/xraph/nexus/providers/azureopenai"

Quick Start

provider := azureopenai.New(
    os.Getenv("AZURE_OPENAI_API_KEY"),
    azureopenai.WithResourceName("my-resource"),
    azureopenai.WithDeploymentID("gpt-4o"),
)

gw := nexus.New(
    nexus.WithProvider(provider),
)

Options

OptionDescription
azureopenai.WithResourceName(name)Azure resource name (used to construct the base URL)
azureopenai.WithDeploymentID(id)Deployment ID for the model
azureopenai.WithAPIVersion(version)API version (default: 2024-08-01-preview)
azureopenai.WithBaseURL(url)Override the full base URL directly

Capabilities

CapabilitySupported
ChatYes
StreamingYes
EmbeddingsYes
VisionYes
ToolsYes
ThinkingNo

Models

ModelContextMax OutputInput PriceOutput Price
gpt-4o128K16,384$2.50/M$10.00/M
gpt-4o-mini128K16,384$0.15/M$0.60/M
text-embedding-3-small8,191$0.02/M

On this page