Nexus

OpenAI

Use OpenAI models (GPT-4o, o1, embeddings) with Nexus.

The OpenAI provider connects to the OpenAI API for chat completions, streaming, embeddings, vision, and tool calling.

Installation

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

Quick Start

provider := openai.New(os.Getenv("OPENAI_API_KEY"))

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

Options

OptionDescription
openai.WithBaseURL(url)Override the API base URL (default: https://api.openai.com/v1)
openai.WithOrgID(id)Set the OpenAI-Organization header

Capabilities

CapabilitySupported
ChatYes
StreamingYes
EmbeddingsYes
VisionYes
ToolsYes
ThinkingYes (o-series models)

Models

ModelContextMax OutputInput PriceOutput Price
gpt-4o128K16,384$2.50/M$10.00/M
gpt-4o-mini128K16,384$0.15/M$0.60/M
gpt-4-turbo128K4,096$10.00/M$30.00/M
o1200K100K$15.00/M$60.00/M
o1-mini128K65,536$3.00/M$12.00/M
text-embedding-3-small8,191$0.02/M
text-embedding-3-large8,191$0.13/M

On this page