AxAIChromeAI Generated TypeScript API reference. typescript api api/reference build/apidocs/Class.AxAIChromeAI.md class AxAIChromeAI

AxAIChromeAI

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/chrome-ai/api.ts#L527

AxAIChromeAI: Adapter for Chrome’s built-in AI (Prompt API)

Chrome ships with Gemini Nano, accessible via the LanguageModel API. This adapter enables ax-llm to use Chrome’s built-in model for chat completions with structured output support.

Key characteristics:

  • TypeScript/JavaScript only, running inside Chrome (not an AxIR provider)
  • No API key required — runs locally
  • Supports structured outputs via responseConstraint (JSON schema)
  • No function/tool calling support
  • No embeddings support
  • Fresh session per request (no context leakage)

Example

TypeScript
const chromeAI = ai({ name: 'chrome-ai' });
const gen = ax('question -> answer');
const result = await gen.forward(chromeAI, { question: 'What is 2+2?' });

Extends

Type Parameters

Type ParameterDefault type
TModelKeyAxAIChromeAIModelId

Constructors

Constructor

TypeScript
new AxAIChromeAI<TModelKey>(__namedParameters: Readonly<Omit<AxAIChromeAIArgs<TModelKey>, "name">>): AxAIChromeAI<TModelKey>;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/chrome-ai/api.ts#L537

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIChromeAIArgs<TModelKey>, "name">>

Returns

AxAIChromeAI<TModelKey>

Overrides

AxBaseAI.constructor

Accessors

debug

Get Signature

TypeScript
get debug(): boolean;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L941

Returns

boolean

Inherited from

AxBaseAI.debug

Methods

chat()

TypeScript
chat(req: Readonly<AxChatRequest<TModel | TModelKey>>, options?: Readonly<AxAIServiceOptions>): Promise<
  | AxChatResponse
| ReadableStream<AxChatResponse>>;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L1759

Parameters

ParameterType
reqReadonly<AxChatRequest<TModel | TModelKey>>
options?Readonly<AxAIServiceOptions>

Returns

Promise< | AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxBaseAI.chat


embed()

TypeScript
embed(req: Readonly<AxEmbedRequest<TEmbedModel>>, options?: Readonly<AxAIServiceOptions>): Promise<AxEmbedResponse>;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L2732

Parameters

ParameterType
reqReadonly<AxEmbedRequest<TEmbedModel>>
options?Readonly<AxAIServiceOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxBaseAI.embed


getEstimatedCost()

TypeScript
getEstimatedCost(modelUsage?: AxModelUsage): number;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L1754

Parameters

ParameterType
modelUsage?AxModelUsage

Returns

number

Inherited from

AxBaseAI.getEstimatedCost


getFeatures()

TypeScript
getFeatures(model?: AxAIChromeAIModelId): AxAIFeatures;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L1068

Parameters

ParameterType
model?AxAIChromeAIModelId

Returns

AxAIFeatures

Inherited from

AxBaseAI.getFeatures


getId()

TypeScript
getId(): string;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L916

Returns

string

Inherited from

AxBaseAI.getId


getLastUsedChatModel()

TypeScript
getLastUsedChatModel(): AxAIChromeAIModelId | undefined;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L1074

Returns

AxAIChromeAIModelId | undefined

Inherited from

AxBaseAI.getLastUsedChatModel


getLastUsedEmbedModel()

TypeScript
getLastUsedEmbedModel(): undefined;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L1078

Returns

undefined

Inherited from

AxBaseAI.getLastUsedEmbedModel


getLastUsedModelConfig()

TypeScript
getLastUsedModelConfig(): AxModelConfig | undefined;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L1082

Returns

AxModelConfig | undefined

Inherited from

AxBaseAI.getLastUsedModelConfig


getLogger()

TypeScript
getLogger(): AxLoggerFunction;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L1016

Returns

AxLoggerFunction

Inherited from

AxBaseAI.getLogger


getMetrics()

TypeScript
getMetrics(): AxAIServiceMetrics;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L1749

Returns

AxAIServiceMetrics

Inherited from

AxBaseAI.getMetrics


getModelList()

TypeScript
getModelList(): (
  | {
  description: string;
  embedModel?: undefined;
  key: TModelKey;
  model: string;
}
  | {
  description: string;
  embedModel: string;
  key: TModelKey;
  model?: undefined;
})[];

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L1037

Returns

( | { description: string; embedModel?: undefined; key: TModelKey; model: string; } | { description: string; embedModel: string; key: TModelKey; model?: undefined; })[]

Inherited from

AxBaseAI.getModelList


getName()

TypeScript
getName(): string;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L1064

Returns

string

Inherited from

AxBaseAI.getName


getOptions()

TypeScript
getOptions(): Readonly<AxAIServiceOptions>;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L985

Returns

Readonly<AxAIServiceOptions>

Inherited from

AxBaseAI.getOptions


setAPIURL()

TypeScript
setAPIURL(apiURL: string): void;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L920

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxBaseAI.setAPIURL


setHeaders()

TypeScript
setHeaders(headers: () => Promise<Record<string, string>>): void;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L924

Parameters

ParameterType
headers() => Promise<Record<string, string>>

Returns

void

Inherited from

AxBaseAI.setHeaders


setName()

TypeScript
setName(name: string): void;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L912

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxBaseAI.setName


setOptions()

TypeScript
setOptions(options: Readonly<AxAIServiceOptions>): void;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L950

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.setOptions


speak()

TypeScript
speak(req: Readonly<AxSpeechRequest<TModel | TModelKey>>, options?: Readonly<AxAIServiceOptions>): Promise<AxChatAudioOutput>;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L1105

Parameters

ParameterType
reqReadonly<AxSpeechRequest<TModel | TModelKey>>
options?Readonly<AxAIServiceOptions>

Returns

Promise<AxChatAudioOutput>

Inherited from

AxBaseAI.speak


transcribe()

TypeScript
transcribe(req: Readonly<AxTranscriptionRequest<TModel | TModelKey>>, options?: Readonly<AxAIServiceOptions>): Promise<AxTranscriptionResponse>;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L1086

Parameters

ParameterType
reqReadonly<AxTranscriptionRequest<TModel | TModelKey>>
options?Readonly<AxAIServiceOptions>

Returns

Promise<AxTranscriptionResponse>

Inherited from

AxBaseAI.transcribe


validateChatRequest()

TypeScript
validateChatRequest(req: Readonly<AxChatRequest<TModel | TModelKey>>, options?: Readonly<AxAIServiceOptions>): void;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/base.ts#L1988

Check request compatibility without network calls, credentials, or state changes.

Parameters

ParameterType
reqReadonly<AxChatRequest<TModel | TModelKey>>
options?Readonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.validateChatRequest

Docs