ai() API Provider, model, routing, media, and embedding APIs. cpp api api/ai packages/cpp/axir-api.json api ai() API

ai() API

LLM provider, model, media, routing, and embedding APIs.

Most Used

axllm::ai

Create a provider client from a provider name and options.

FieldValue
Kindfunction
Ax conceptai
API sectionAxAI
Formaxllm::ai(provider, options)
ReturnsAI client/service

Important Options

  • api key
  • model
  • api URL
  • headers
  • transport

Examples

C++
auto client = axllm::ai("openai", axllm::object({{"apiKey", std::getenv("OPENAI_API_KEY")}}));

Full reference

axllm::OpenAICompatibleClient

OpenAI-compatible chat, stream, embedding, audio, and realtime provider boundary.

FieldValue
Kindtype
Ax conceptOpenAICompatibleClient
API sectionAxAI
Formaxllm::OpenAICompatibleClient(options, transport)
Returnsprovider client

Important Options

  • api key
  • model
  • base URL
  • transport

Full reference

axllm::OpenAIResponsesClient

OpenAI Responses provider mapping using the same Core-owned request and response contract.

FieldValue
Kindtype
Ax conceptOpenAIResponsesClient
API sectionAxAI
Formaxllm::OpenAIResponsesClient(options, transport)
Returnsprovider client

Important Options

  • api key
  • model
  • audio
  • realtime

Full reference

axllm::GoogleGeminiClient

Gemini provider mapping for chat, streaming, media, tools, embeddings, and usage normalization.

FieldValue
Kindtype
Ax conceptGoogleGeminiClient
API sectionAxAI
Formaxllm::GoogleGeminiClient(options, transport)
Returnsprovider client

Important Options

  • api key
  • model
  • embed model

Full reference

axllm::AnthropicClient

Anthropic provider mapping for messages, thinking, cache control, streaming, and usage normalization.

FieldValue
Kindtype
Ax conceptAnthropicClient
API sectionAxAI
Formaxllm::AnthropicClient(options, transport)
Returnsprovider client

Important Options

  • api key
  • model
  • thinking
  • cache control

Full reference

axllm::AxBalancer

Retry and route requests across multiple provider services, with opt-in adaptive cost, reliability, and deadline routing.

FieldValue
Kindtype
Ax conceptAxBalancer
API sectionAxAI
Formaxllm::AxBalancer(services, options)
ReturnsAI service

Important Options

  • services
  • retry policy
  • capability requirements
  • adaptive strategy

Full reference

axllm::MultiServiceRouter

Choose a service by capability or model routing policy.

FieldValue
Kindtype
Ax conceptMultiServiceRouter
API sectionAxAI
Formaxllm::MultiServiceRouter(services)
ReturnsAI service

Important Options

  • services
  • routing

Full reference

axllm::ProviderRouter

Route provider requests to registered provider clients.

FieldValue
Kindtype
Ax conceptProviderRouter
API sectionAxAI
Formaxllm::ProviderRouter(providers, routing, processing)
ReturnsAI service

Important Options

  • providers
  • routing
  • processing

Full reference

Advanced / internals / full reference

axllm::AxUsageContext

Application attribution merged from service defaults and per-call overrides.

FieldValue
Kindtype
Ax conceptAxUsageContext
API sectionAxAI
Formaxllm::AxUsageContext
Returnsusage context

Important Options

  • tenant
  • user
  • request
  • run
  • feature
  • attributes

Full reference

axllm::AxUsageEvent

Normalized token usage and correlation data for one completed chat or embedding operation.

FieldValue
Kindtype
Ax conceptAxUsageEvent
API sectionAxAI
Formaxllm::AxUsageEvent
Returnsusage event

Important Options

  • provider
  • model
  • tokens
  • context
  • correlation IDs
  • streaming

Full reference

axllm::AxUsageObserver

Best-effort process-wide callback for normalized usage events.

FieldValue
Kindinterface
Ax conceptAxUsageObserver
API sectionAxAI
Formaxllm::AxUsageObserver
Returnsusage observer

Important Options

  • fail-open delivery
  • synchronous enqueue

Full reference

axllm::set_usage_observer

Register, replace, or clear the process-wide usage observer.

FieldValue
Kindfunction
Ax conceptset_usage_observer
API sectionAxAI
Formaxllm::set_usage_observer(observer)
Returnsvoid

Important Options

  • observer
  • clear

Examples

C++
axllm::set_usage_observer([&](auto event) { events.push_back(event); });

Full reference

axllm::AxBalancerAdaptiveStrategy

Configure adaptive provider routing without changing the ordered default.

FieldValue
Kindtype
Ax conceptAxBalancerAdaptiveStrategy
API sectionAxAI
Formaxllm::AxBalancerAdaptiveStrategy
Returnsadaptive strategy

Important Options

  • deadline
  • bad outcome cost
  • expected tokens
  • stable route keys
  • slice
  • stats store
  • routing events

Full reference

axllm::AxBalancerStatsStore

Store shared adaptive decision state with atomic observations.

FieldValue
Kindinterface
Ax conceptAxBalancerStatsStore
API sectionAxAI
Formaxllm::AxBalancerStatsStore
Returnsstats store

Important Options

  • get
  • observe

Full reference

axllm::AxInMemoryBalancerStatsStore

Thread-safe in-memory adaptive stats store.

FieldValue
Kindtype
Ax conceptAxInMemoryBalancerStatsStore
API sectionAxAI
Formaxllm::AxInMemoryBalancerStatsStore
Returnsstats store

Full reference

axllm::create_balancer_route_stats

Create neutral adaptive route statistics.

FieldValue
Kindfunction
Ax conceptcreate_balancer_route_stats
API sectionAxAI
Formaxllm::create_balancer_route_stats
Returnsroute stats

Full reference

axllm::update_balancer_route_stats

Purely reduce one success or failure observation into route statistics.

FieldValue
Kindfunction
Ax conceptupdate_balancer_route_stats
API sectionAxAI
Formaxllm::update_balancer_route_stats
Returnsroute stats

Important Options

  • current stats
  • observation

Full reference

axllm::sample_balancer_route_health

Sample failure and deadline-miss probability for adaptive exploration.

FieldValue
Kindfunction
Ax conceptsample_balancer_route_health
API sectionAxAI
Formaxllm::sample_balancer_route_health
Returnssampled health

Important Options

  • route stats
  • deadline

Full reference

Full Reference

Open the full C++ reference. This page highlights the ai symbols most relevant to everyday use.

Docs