ai() API
LLM provider, model, media, routing, and embedding APIs.
Most Used
axllm::ai
Create a provider client from a named deployment profile and options.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | ai |
| API section | AxAI |
| Form | axllm::ai(provider, options) |
| Returns | AI client/service |
Important Options
api key or credential providermodelapi URLheaderstransport
Examples
auto client = axllm::ai("openai", axllm::object({{"apiKey", std::getenv("OPENAI_API_KEY")}}));axllm::OpenAICompatibleClient
OpenAI-compatible chat, stream, embedding, audio, and realtime provider boundary.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | OpenAICompatibleClient |
| API section | AxAI |
| Form | axllm::OpenAICompatibleClient(options, transport) |
| Returns | provider client |
Important Options
api keymodelbase URLtransport
axllm::OpenAIResponsesClient
OpenAI Responses provider mapping using the same Core-owned request and response contract.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | OpenAIResponsesClient |
| API section | AxAI |
| Form | axllm::OpenAIResponsesClient(options, transport) |
| Returns | provider client |
Important Options
api keymodelaudiorealtime
axllm::GoogleGeminiClient
Gemini provider mapping for chat, streaming, media, tools, embeddings, and usage normalization.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | GoogleGeminiClient |
| API section | AxAI |
| Form | axllm::GoogleGeminiClient(options, transport) |
| Returns | provider client |
Important Options
api keymodelembed model
axllm::AnthropicClient
Anthropic provider mapping for messages, thinking, cache control, streaming, and usage normalization.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AnthropicClient |
| API section | AxAI |
| Form | axllm::AnthropicClient(options, transport) |
| Returns | provider client |
Important Options
api keymodelthinkingcache control
axllm::AxBalancer
Retry and route requests across multiple provider services, with opt-in adaptive cost, reliability, and deadline routing.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxBalancer |
| API section | AxAI |
| Form | axllm::AxBalancer(services, options) |
| Returns | AI service |
Important Options
servicesretry policycapability requirementsadaptive strategy
axllm::MultiServiceRouter
Choose a service by capability or model routing policy.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | MultiServiceRouter |
| API section | AxAI |
| Form | axllm::MultiServiceRouter(services) |
| Returns | AI service |
Important Options
servicesrouting
axllm::ProviderRouter
Route requests by capability, preserving native media for supporting providers and degrading only when required.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | ProviderRouter |
| API section | AxAI |
| Form | axllm::ProviderRouter(providers, routing, processing) |
| Returns | AI service |
Important Options
providersroutingprocessing
Advanced / internals / full reference
axllm::get_supported_ai_models
Return the AxIR-backed provider and model catalog, including dynamic named profiles and portable capability metadata.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | get_supported_ai_models |
| API section | AxAI |
| Form | axllm::get_supported_ai_models(options) |
| Returns | provider catalog entries |
Important Options
type filterthinkingLevelsserviceTiersisDynamic
Examples
auto catalog = axllm::get_supported_ai_models();axllm::AxCredentialRequest
Request metadata passed to a renewable credential callback for every transport attempt.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxCredentialRequest |
| API section | AxAI |
| Form | axllm::AxCredentialRequest |
| Returns | credential request |
Important Options
profileoperationmethodURL
axllm::AxCredentialProvider
Return fresh request headers that override static profile authentication.
| Field | Value |
|---|---|
| Kind | interface |
| Ax concept | AxCredentialProvider |
| API section | AxAI |
| Form | axllm::AxCredentialProvider |
| Returns | header map or credential error |
Important Options
chatstreamembeddingsResponsesaudioretries
axllm::AxStreamHandler
Incremental, closeable provider event stream. Retry and failover stop once content is delivered.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxProviderStream |
| API section | AxAI |
| Form | client.stream_each(request, handler) |
| Returns | incremental chat events |
Important Options
next eventterminal errorconsumer cancellationupstream close
Examples
client.stream_each(request, [&](const auto& event) { handle(event); return true; });axllm::AxUsageContext
Application attribution merged from service defaults and per-call overrides.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxUsageContext |
| API section | AxAI |
| Form | axllm::AxUsageContext |
| Returns | usage context |
Important Options
tenantuserrequestrunfeatureattributes
axllm::AxUsageEvent
Normalized token usage and correlation data for one completed chat or embedding operation.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxUsageEvent |
| API section | AxAI |
| Form | axllm::AxUsageEvent |
| Returns | usage event |
Important Options
providermodeltokenscontextcorrelation IDsstreaming
axllm::AxUsageObserver
Best-effort process-wide callback for normalized usage events.
| Field | Value |
|---|---|
| Kind | interface |
| Ax concept | AxUsageObserver |
| API section | AxAI |
| Form | axllm::AxUsageObserver |
| Returns | usage observer |
Important Options
fail-open deliverysynchronous enqueue
axllm::set_usage_observer
Register, replace, or clear the process-wide usage observer.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | set_usage_observer |
| API section | AxAI |
| Form | axllm::set_usage_observer(observer) |
| Returns | void |
Important Options
observerclear
Examples
axllm::set_usage_observer([&](auto event) { events.push_back(event); });axllm::AxRuntimeHooks
Non-serializable rate limiter, tracer, and meter overrides for one service or program execution.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxRuntimeHooks |
| API section | AxAI |
| Form | axllm::AxRuntimeHooks |
| Returns | runtime hooks |
Important Options
rate limitertracermeterprecedence
Examples
axllm::AxRuntimeHooks hooks{limiter, tracer, meter};axllm::AxRateLimitInfo
Provider and model metadata supplied to a request-wrapper rate limiter.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxRateLimitInfo |
| API section | AxAI |
| Form | axllm::AxRateLimitInfo |
| Returns | rate-limit context |
Important Options
operationprovidermodelstreamingprevious usage
axllm::AxRateLimiter
Request wrapper that can delay, reject, or execute a chat or embedding request.
| Field | Value |
|---|---|
| Kind | interface |
| Ax concept | AxRateLimiter |
| API section | AxAI |
| Form | axllm::AxRateLimiter |
| Returns | provider result |
Important Options
nextmetadataerrors
axllm::AxTracer
Dependency-neutral tracer that creates metadata-only Ax spans.
| Field | Value |
|---|---|
| Kind | interface |
| Ax concept | AxTracer |
| API section | AxAI |
| Form | axllm::AxTracer |
| Returns | span |
Important Options
start spanparent spanfail-open
axllm::AxMeter
Dependency-neutral meter for Ax counters, histograms, and gauges.
| Field | Value |
|---|---|
| Kind | interface |
| Ax concept | AxMeter |
| API section | AxAI |
| Form | axllm::AxMeter |
| Returns | instrument |
Important Options
counterhistogramgaugefail-open
axllm::AxGlobals
Process-wide live defaults for runtime hooks and usage observation.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxGlobals |
| API section | AxAI |
| Form | axllm::AxGlobals |
| Returns | global hooks |
Important Options
rate limitertracermeterusage observer
axllm::set_rate_limiter
Register, replace, or clear the process-wide request-wrapper rate limiter.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | set_rate_limiter |
| API section | AxAI |
| Form | axllm::set_rate_limiter(limiter) |
| Returns | void |
Important Options
limiterclear
Examples
axllm::set_rate_limiter(limiter);axllm::set_tracer
Register, replace, or clear the process-wide dependency-neutral tracer.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | set_tracer |
| API section | AxAI |
| Form | axllm::set_tracer(tracer) |
| Returns | void |
Important Options
tracerclear
Examples
axllm::set_tracer(tracer);axllm::set_meter
Register, replace, or clear the process-wide dependency-neutral meter.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | set_meter |
| API section | AxAI |
| Form | axllm::set_meter(meter) |
| Returns | void |
Important Options
meterclear
Examples
axllm::set_meter(meter);axllm::AxBalancerAdaptiveStrategy
Configure adaptive provider routing without changing the ordered default.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxBalancerAdaptiveStrategy |
| API section | AxAI |
| Form | axllm::AxBalancerAdaptiveStrategy |
| Returns | adaptive strategy |
Important Options
deadlinebad outcome costexpected tokensstable route keysslicestats storerouting events
axllm::AxBalancerStatsStore
Store shared adaptive decision state with atomic observations.
| Field | Value |
|---|---|
| Kind | interface |
| Ax concept | AxBalancerStatsStore |
| API section | AxAI |
| Form | axllm::AxBalancerStatsStore |
| Returns | stats store |
Important Options
getobserve
axllm::AxInMemoryBalancerStatsStore
Thread-safe in-memory adaptive stats store.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxInMemoryBalancerStatsStore |
| API section | AxAI |
| Form | axllm::AxInMemoryBalancerStatsStore |
| Returns | stats store |
axllm::create_balancer_route_stats
Create neutral adaptive route statistics.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | create_balancer_route_stats |
| API section | AxAI |
| Form | axllm::create_balancer_route_stats |
| Returns | route stats |
axllm::update_balancer_route_stats
Purely reduce one success or failure observation into route statistics.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | update_balancer_route_stats |
| API section | AxAI |
| Form | axllm::update_balancer_route_stats |
| Returns | route stats |
Important Options
current statsobservation
axllm::sample_balancer_route_health
Sample failure and deadline-miss probability for adaptive exploration.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | sample_balancer_route_health |
| API section | AxAI |
| Form | axllm::sample_balancer_route_health |
| Returns | sampled health |
Important Options
route statsdeadline
Full Reference
Open the full C++ reference. This page highlights the ai symbols most relevant to everyday use.