> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atlaso.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript API reference

> Generated from public client declarations and JSDoc. Do not edit this page by hand.

Generated by `node scripts/reference.mjs` in the TypeScript package. Covers `atlaso`, `atlaso/ai-sdk`, and `atlaso/testing`, including referenced local types. Run with `--check` to detect drift or missing public documentation.

## AddResult

`safeToRepeat` applies when the returned idempotencyKey is reused with the same text
within 24 hours. A fresh key may store another fact.

```ts theme={null}
export type AddResult =
  | { outcome: "added"; memory: Memory; idempotencyKey: string; safeToRepeat: true }
  /**
   * No answer, or the server could not confirm. Reuse idempotencyKey to resend safely.
   */
  | { outcome: "unknown"; error: ErrorInfo; idempotencyKey: string; safeToRepeat: true }
  /** Nothing was stored: an erase of this user is still running. */
  | { outcome: "rejected"; reason: "erase_in_progress"; error: ErrorInfo; safeToRepeat: true };
```

## AiSdkProviderRouting

The `provider` field as JSON the AI SDK's provider options accept.

```ts theme={null}
export type AiSdkProviderRouting = {
  order?: ProviderName[];
  only?: ProviderName[];
  ignore?: ProviderName[];
  allow_fallbacks?: boolean;
};
```

## AiSdkRoutingOptions

What `routing()` from "atlaso/ai-sdk" returns: pass it as `providerOptions`.

```ts theme={null}
export type AiSdkRoutingOptions = { atlaso?: { provider: AiSdkProviderRouting } };
```

## AiSdkToolOptions

Controls which memory tools the AI SDK adapter exposes.

### AiSdkToolOptions.allowForget

Adds `forget`. Off by default so a model that misreads a turn cannot delete.

```ts theme={null}
allowForget: boolean | undefined
```

### AiSdkToolOptions.receipt

Receipts whose memoryIds `forget` may delete, besides ids the model listed.

```ts theme={null}
receipt: Receipt | Receipt[] | undefined
```

## answeredBy

The provider that answered a call, as a name `routing()` accepts (such as
"bedrock"), read from the receipt's model id; null when no provider answered.
`receipt.providerHost` is the host name of the server that answered.

```ts theme={null}
const backup = answeredBy(tracked.receipt) !== "anthropic";
```

```ts theme={null}
answeredBy(receipt: Pick<Receipt, "model">): ProviderName | null
```

## AnthropicLike

Minimal surface of the official Anthropic client; the package is an optional peer.

### AnthropicLike.baseURL

Anthropic's origin-only base URL.

```ts theme={null}
baseURL: string
```

### AnthropicLike.withOptions

Create a copy that preserves the shared client and transport.

```ts theme={null}
withOptions(options: { fetch?: typeof fetch; [key: string]: unknown; }): unknown
```

## AppUserUsage

One app-user aggregate in the requested date window.

### AppUserUsage.appUserLabel

One-way label for this app user.

```ts theme={null}
appUserLabel: string
```

### AppUserUsage.calls

Number of calls in the window.

```ts theme={null}
calls: number
```

### AppUserUsage.cost\_usd

USD cost, or null when a cost in the window is unknown.

```ts theme={null}
cost_usd: string | null
```

### AppUserUsage.cost\_complete

Whether every billed call has a known cost.

```ts theme={null}
cost_complete: boolean
```

### AppUserUsage.estimated

True when interrupted or other estimated usage contributes to this total.

```ts theme={null}
estimated: boolean | undefined
```

### AppUserUsage.unpriced\_calls

Calls whose price is not yet known.

```ts theme={null}
unpriced_calls: number
```

### AppUserUsage.refused\_calls

Refused calls in the window.

```ts theme={null}
refused_calls: number
```

### AppUserUsage.first\_call

First call timestamp in the window, when the gateway supplies it.

```ts theme={null}
first_call: string | undefined
```

### AppUserUsage.last\_call

Last call timestamp in the window, when the gateway supplies it.

```ts theme={null}
last_call: string | undefined
```

## Atlaso

Client library entry point. Holds no user; create a scope per request.

### Atlaso.calls

Developer-key call lookup.

```ts theme={null}
calls: CallsApi
```

### Atlaso.usage

App-user usage pages.

```ts theme={null}
usage: UsageApi
```

### Atlaso.baseURL

Gateway base URL used for requests and scope validation.

```ts theme={null}
baseURL: string
```

### Atlaso.constructor

Create Atlaso with the supplied configuration.

```ts theme={null}
constructor<O extends OpenAILike = OpenAILike, A extends AnthropicLike = AnthropicLike>(opts?: AtlasoOptions<O, A>): Atlaso<O, A>
```

### Atlaso.clientOptions

Spread into your provider client's constructor. Carries no user.

```ts theme={null}
clientOptions(): { apiKey: string; baseURL: string; defaultHeaders: Record<string, string>; fetch?: typeof fetch; dangerouslyAllowBrowser?: true; }
```

### Atlaso.memory

Your own memory, with a "Me" key: add, addMany, list, search, update and delete. No erase.
A key set to "Memory for each user of my app" uses `forUser(id).memory` instead (this one answers
memory\_scope\_per\_user); a key whose memory is Off answers memory\_off. With a browser token, the
token's fixed user's memory, as before.

```ts theme={null}
memory(): OwnerMemoryApi
```

### Atlaso.shared

Shared facts for this server key's project.

```ts theme={null}
shared(): SharedApi
```

### Atlaso.anthropicOptions

Spread into `new Anthropic(...)`; Anthropic appends `/v1/messages` itself.

```ts theme={null}
anthropicOptions(): { apiKey: string; authToken: null; baseURL: string; fetch?: typeof fetch; }
```

### Atlaso.openai

The shared OpenAI client built on first use from `new Atlaso(&#123; OpenAI &#125;)`. It carries no user.
With a key whose memory is for "Me", calls use your own memory; with a per-user key, a call
without a user goes out with no memory. For your app's users, use `forUser(id).openai()`.

```ts theme={null}
openai(): O
```

### Atlaso.anthropic

The shared Anthropic client built on first use from `new Atlaso(&#123; Anthropic &#125;)`. It carries no user.

```ts theme={null}
anthropic(): A
```

### Atlaso.forUser

Scope one request (or one run) to one app user. Create it per request; do not store it globally.

```ts theme={null}
forUser(userId: string, opts?: ScopeOptions): UserScope<O, A>
```

### Atlaso.revokeBrowserToken

Revoke one browser token by public id on your server.

```ts theme={null}
revokeBrowserToken(tokenId: string): Promise<BrowserTokenRevoke>
```

### Atlaso.readReceipt

Read a call's receipt from `.withResponse()`. Never changes the data or chunks.

```ts theme={null}
readReceipt<T>(r: { data: T; response: Response; }): Tracked<T>
```

### Atlaso.receiptFromHeaders

For frameworks that expose only reply headers.

```ts theme={null}
receiptFromHeaders(h: Headers | Record<string, string>): Receipt
```

### Atlaso.classify

Any error (ours, the provider client's, or a network failure) into typed info.

```ts theme={null}
classify(err: unknown): ErrorInfo
```

### Atlaso.toJSON

Keeps the key out of logs and console output.

```ts theme={null}
toJSON(): Record<string, unknown>
```

## AtlasoAiSdk

Shared AI SDK adapter, with per-user model and memory scopes.

### AtlasoAiSdk.atlaso

The core client: memory API, receipts, classify. Holds no user.

```ts theme={null}
atlaso: CoreAtlaso
```

### AtlasoAiSdk.forUser

Create models and memory tools for this request's user.

```ts theme={null}
forUser(userId: string, opts?: ScopeOptions): AtlasoAiSdkScope
```

### AtlasoAiSdk.forToken

Models and memory bound to a browser token, without a user header.

```ts theme={null}
forToken(): AtlasoAiSdkTokenScope
```

## AtlasoAiSdkScope

AI SDK models and memory tools bound to one user.

### AtlasoAiSdkScope.userId

The user attached to this scope, never a shared client default.

```ts theme={null}
userId: string
```

### AtlasoAiSdkScope.headers

For `streamText(&#123; headers &#125;)` when you keep your own provider.

```ts theme={null}
headers(): Readonly<Record<string, string>>
```

### AtlasoAiSdkScope.chat

Chat Completions model for this user.

```ts theme={null}
chat(modelId: ModelName): AtlasoLanguageModel
```

### AtlasoAiSdkScope.responses

Responses model for this user (needs `@ai-sdk/openai`).

```ts theme={null}
responses(modelId: ModelName): AtlasoLanguageModel
```

### AtlasoAiSdkScope.memory

Memory metadata or operations scoped to this user.

```ts theme={null}
memory: MemoryApiLike
```

### AtlasoAiSdkScope.tools

Memory tools for this user: `remember`, `list_memories`, `search_memories`, and `forget` only with `allowForget`.

```ts theme={null}
tools: { aiSdk(o?: AiSdkToolOptions): ToolSet; }
```

## AtlasoAiSdkTokenScope

AI SDK models for a browser token's fixed user.

### AtlasoAiSdkTokenScope.chat

Chat Completions model using the browser token.

```ts theme={null}
chat(modelId: ModelName): AtlasoLanguageModel
```

### AtlasoAiSdkTokenScope.responses

Responses model using the browser token.

```ts theme={null}
responses(modelId: ModelName): AtlasoLanguageModel
```

### AtlasoAiSdkTokenScope.memory

Memory API bound to the token.

```ts theme={null}
memory: MemoryApiLike
```

### AtlasoAiSdkTokenScope.tools

Memory tools bound to the token.

```ts theme={null}
tools: { aiSdk(o?: AiSdkToolOptions): ToolSet; }
```

## AtlasoError

Base class for every error this library throws.

### AtlasoError.info

Structured error details used by application error handling.

```ts theme={null}
info: ErrorInfo
```

### AtlasoError.idempotencyKey

Write key to reuse with the same body when an idempotent write is uncertain.

```ts theme={null}
idempotencyKey: string | undefined
```

### AtlasoError.constructor

Create AtlasoError with the supplied configuration.

```ts theme={null}
constructor(info: ErrorInfo): AtlasoError
```

### AtlasoError.code

Gateway error code, or null for an unclassified failure.

```ts theme={null}
code(): string | null
```

### AtlasoError.kind

Typed category describing the observed result.

```ts theme={null}
kind(): ErrorKind
```

### AtlasoError.status

Reported status; unavailable HTTP status is null.

```ts theme={null}
status(): number | null
```

## AtlasoLanguageModel

The language model type of the installed AI SDK provider packages.

```ts theme={null}
export type AtlasoLanguageModel = ReturnType<ReturnType<typeof createOpenAICompatible>["chatModel"]>;
```

## AtlasoOptions

Options shared by every scope created from this client.

### AtlasoOptions.OpenAI

The OpenAI class (`import OpenAI from "openai"`), so `forUser(id).openai()` needs no client of your own.

```ts theme={null}
OpenAI: ProviderClass<O> | undefined
```

### AtlasoOptions.Anthropic

The Anthropic class (`import Anthropic from "@anthropic-ai/sdk"`), for `forUser(id).anthropic()`.

```ts theme={null}
Anthropic: ProviderClass<A> | undefined
```

### AtlasoOptions.clientHeader

Set false to omit the automatic library name/version header.

```ts theme={null}
clientHeader: boolean | undefined
```

### AtlasoOptions.apiKey

Defaults to the ATLASO\_KEY environment variable when one is readable.

```ts theme={null}
apiKey: string | undefined
```

### AtlasoOptions.baseURL

Defaults to [https://api.atlaso.ai/v1](https://api.atlaso.ai/v1).

```ts theme={null}
baseURL: string | undefined
```

### AtlasoOptions.fetch

Your own fetch (for tests or a custom agent). Also used by the clients behind openai() and anthropic().

```ts theme={null}
fetch: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined
```

### AtlasoOptions.timeoutMs

Memory API (default 30000), and the clients behind openai() / anthropic() when you set it (else the provider's default).

```ts theme={null}
timeoutMs: number | undefined
```

### AtlasoOptions.maxRetries

Memory API and the clients behind openai() / anthropic(). Default 2.

```ts theme={null}
maxRetries: number | undefined
```

### AtlasoOptions.browserToken

Short-lived bearer value or an async function that returns and refreshes one.

```ts theme={null}
browserToken: BrowserTokenSource | undefined
```

## BrowserToken

The minted token and its server-reported lifetime. Treat token as a secret.

### BrowserToken.id

Public token id for revocation.

```ts theme={null}
id: string
```

### BrowserToken.token

Bearer value. Send this only to the intended user.

```ts theme={null}
token: string
```

### BrowserToken.expiresIn

Seconds remaining at mint.

```ts theme={null}
expiresIn: number
```

### BrowserToken.expiresAt

Unix expiry time in seconds.

```ts theme={null}
expiresAt: number
```

## BrowserTokenLimits

Limits applied by the gateway to a browser token.

### BrowserTokenLimits.models

Exact model ids this token may use.

```ts theme={null}
models: ModelName[] | undefined
```

### BrowserTokenLimits.dailySpendUsd

Maximum daily spend for this user, as decimal USD.

```ts theme={null}
dailySpendUsd: string | null | undefined
```

### BrowserTokenLimits.memory

Memory permission. Defaults to read\_only.

```ts theme={null}
memory: "read_only" | "read_write" | "off" | undefined
```

## BrowserTokenOptions

Options for a server-side token mint.

### BrowserTokenOptions.ttlSeconds

Lifetime in seconds, from 60 to 3600.

```ts theme={null}
ttlSeconds: number | undefined
```

### BrowserTokenOptions.limits

Optional restrictions on the token.

```ts theme={null}
limits: BrowserTokenLimits | undefined
```

## BrowserTokenRevoke

Result of revoking one token.

### BrowserTokenRevoke.id

Public token id.

```ts theme={null}
id: string
```

### BrowserTokenRevoke.revoked

Whether an active token was revoked.

```ts theme={null}
revoked: boolean
```

## BrowserTokenSource

Source for a browser token, including a server route that refreshes it.

```ts theme={null}
export type BrowserTokenSource = string | (() => Promise<{ token: string; expiresIn: number }>);
```

## BrowserTokensRevoke

Result of revoking all tokens for one user.

### BrowserTokensRevoke.revoked

Number of active tokens revoked.

```ts theme={null}
revoked: number
```

## CallsApi

Read a call by id; recent calls may need a short wait for receipt storage.

### CallsApi.get

Poll 404 call\_not\_ready and in\_progress rows until waitMs expires; other 404s are final.

```ts theme={null}
get(callId: string, o?: { waitMs?: number; }, user?: string): Promise<GatewayCall>
```

## ConfigurationError

A setup mistake found before any request left the process.

### ConfigurationError.constructor

Create ConfigurationError with the supplied configuration.

```ts theme={null}
constructor(code: string, message: string): ConfigurationError
```

## ConnectionError

No reply came back (timeout or connection failure).

### ConnectionError.constructor

Create ConnectionError with the supplied configuration.

```ts theme={null}
constructor(info: ErrorInfo): ConnectionError
```

## CoreAtlaso

The part of the core Atlaso this adapter needs.

### CoreAtlaso.baseURL

Gateway base URL used for requests and scope validation.

```ts theme={null}
baseURL: string
```

### CoreAtlaso.clientOptions

Provider constructor options; contains no user header.

```ts theme={null}
clientOptions(): { apiKey: string; baseURL: string; fetch?: typeof fetch; defaultHeaders?: Record<string, string>; }
```

### CoreAtlaso.forUser

Create a scope for one user in the current project.

```ts theme={null}
forUser(userId: string, opts?: ScopeOptions): CoreScope
```

### CoreAtlaso.memory

Your own memory with a "Me" key (no erase), or a browser token's fixed user's memory.

```ts theme={null}
memory: OwnerMemoryApi | undefined
```

### CoreAtlaso.receiptFromHeaders

Parse gateway reply headers into typed metadata.

```ts theme={null}
receiptFromHeaders(h: Headers | Record<string, string>): Receipt
```

### CoreAtlaso.classify

Classify an exception without logging it.

```ts theme={null}
classify(err: unknown): ErrorInfo
```

## CoreOptions

Core Atlaso options accepted by the AI SDK adapter.

```ts theme={null}
export type CoreOptions = AtlasoOptions;
```

## CoreScope

The part of the core UserScope this adapter needs.

### CoreScope.userId

The user attached to this scope, never a shared client default.

```ts theme={null}
userId: string
```

### CoreScope.headers

Copy the scope's headers for a single framework request.

```ts theme={null}
headers(): Readonly<Record<string, string>>
```

### CoreScope.memory

Memory metadata or operations scoped to this user.

```ts theme={null}
memory: MemoryApiLike
```

## createAtlaso

Build an AI SDK adapter. Create its user scope inside each request.

```ts theme={null}
createAtlaso(options?: CreateAtlasoOptions): AtlasoAiSdk
```

## CreateAtlasoOptions

Core client configuration and optional AI SDK provider factories.

### CreateAtlasoOptions.atlaso

Reuse a core client you already built. Its options are not read back:
pass the same `fetch` here too if you gave it a custom one.

```ts theme={null}
atlaso: CoreAtlaso | undefined
```

### CreateAtlasoOptions.includeUsage

Passed to the provider package as is. When true the stream asks for usage
and the receipt gets its cost in-band. Left unset, nothing is added to
the request and stream receipts say `usage_not_requested`.

```ts theme={null}
includeUsage: boolean | undefined
```

### CreateAtlasoOptions.createOpenAI

`createOpenAI` from `@ai-sdk/openai`, for `.responses()`. Optional: without
it the package is imported on the first Responses call. Pass it when your
bundler cannot resolve that lazy import.

```ts theme={null}
createOpenAI: ResponsesFactory | undefined
```

## createFakeGateway

Create an offline gateway using synthetic users, facts, and scripted replies.

```ts theme={null}
createFakeGateway(options?: FakeOptions): FakeGateway
```

## CursorInvalidError

The list cursor no longer exists (400 invalid\_after). The iterator never restarts silently.

### CursorInvalidError.constructor

Create CursorInvalidError with the supplied configuration.

```ts theme={null}
constructor(info: ErrorInfo): CursorInvalidError
```

## DeleteResult

A completed deletion, an absent fact, or a pending deletion with resume().

```ts theme={null}
export type DeleteResult =
  | { outcome: "deleted" }
  | { outcome: "already_gone" }
  | (PendingResult & { resume(o?: { waitMs?: number }): Promise<DeleteResult> });
```

## EngineFacets

Field 3.0 facets. Absent until the wire carries them.

### EngineFacets.polarity

Optional stance of the fact.

```ts theme={null}
polarity: "positive" | "negative" | "cautionary" | "open" | undefined
```

### EngineFacets.evidenceGrade

Optional evidence quality reported by the engine.

```ts theme={null}
evidenceGrade: "anecdotal" | "observed" | "replicated" | "verified" | undefined
```

### EngineFacets.scope

Optional engine scope facets.

```ts theme={null}
scope: Record<string, string> | undefined
```

### EngineFacets.contradicts

Optional identifiers of facts this fact contradicts.

```ts theme={null}
contradicts: string[] | undefined
```

## EraseResult

A completed user erase or a pending erase with resume().

```ts theme={null}
export type EraseResult =
  /** factsDeleted is null when the reply did not say how many. */
  | { outcome: "erased"; factsDeleted: number | null }
  | (PendingResult & { resume(o?: { waitMs?: number }): Promise<EraseResult> });
```

## ErrorInfo

Typed facts about any error. Plain data: safe to compare, never logged by this library.

### ErrorInfo.code

Gateway error code, or null for an unclassified failure.

```ts theme={null}
code: string | null
```

### ErrorInfo.kind

Typed category describing the observed result.

```ts theme={null}
kind: ErrorKind
```

### ErrorInfo.status

Reported status; unavailable HTTP status is null.

```ts theme={null}
status: number | null
```

### ErrorInfo.type

Error type reported by the gateway, or null when absent.

```ts theme={null}
type: string | null
```

### ErrorInfo.param

Parameter associated with the error, or null when absent.

```ts theme={null}
param: string | null
```

### ErrorInfo.message

Error explanation. Treat remote messages as untrusted text.

```ts theme={null}
message: string
```

### ErrorInfo.requestId

Gateway request identifier, or null when unavailable.

```ts theme={null}
requestId: string | null
```

### ErrorInfo.retryable

Eligibility only. An uncertain write (a memory add) is never repeated on this alone.

```ts theme={null}
retryable: boolean
```

### ErrorInfo.retryAfterMs

Suggested delay before another attempt, in milliseconds.

```ts theme={null}
retryAfterMs: number | null
```

### ErrorInfo.docUrl

Documentation URL supplied with the error, or null when absent.

```ts theme={null}
docUrl: string | null
```

### ErrorInfo.known

True only for an exact status and code pair from the wire table.

```ts theme={null}
known: boolean
```

### ErrorInfo.inStream

Whether the error occurred while consuming a stream.

```ts theme={null}
inStream: boolean
```

## ErrorKind

Stable error categories for application handling.

```ts theme={null}
export type ErrorKind =
  | "auth"
  | "user_id"
  | "key_scope"
  | "invalid_request"
  | "rate_limit"
  | "quota"
  | "provider"
  | "memory_unavailable"
  | "not_found"
  | "conflict"
  | "server"
  | "network"
  | "unknown"
  /** The network in front of the gateway refused the request (HTTP 403, no Atlaso request id). */
  | "edge_blocked"
  /** The network in front of the gateway answered instead of Atlaso (no Atlaso request id). */
  | "edge_error";
```

## Fact

The synthetic gateway's wire-format memory fact.

### Fact.id

Stable identifier of the stored fact.

```ts theme={null}
id: string
```

### Fact.text

Stored synthetic fact text.

```ts theme={null}
text: string
```

### Fact.source

Origin label supplied by the gateway.

```ts theme={null}
source: string
```

### Fact.created

Synthetic fact creation time as Unix seconds.

```ts theme={null}
created: number
```

### Fact.app\_user

Synthetic short app-user label.

```ts theme={null}
app_user: string
```

### Fact.object

Wire object discriminator for a fact.

```ts theme={null}
object: string | undefined
```

## FakeGateway

Deterministic in-process gateway. It never contacts a network destination.

### FakeGateway.apiKey

Obviously synthetic key for this offline fake.

```ts theme={null}
apiKey: "sk-at-test-offline"
```

### FakeGateway.baseURL

Gateway base URL used for requests and scope validation.

```ts theme={null}
baseURL: string
```

### FakeGateway.requests

Recorded synthetic requests in arrival order.

```ts theme={null}
requests: RecordedRequest[]
```

### FakeGateway.constructor

Create FakeGateway with the supplied configuration.

```ts theme={null}
constructor(options?: FakeOptions): FakeGateway
```

### FakeGateway.next

Queue a synthetic reply or fault; returns this fake for chaining.

```ts theme={null}
next(script: Script): this
```

### FakeGateway.users

A copied snapshot of the default project's synthetic users.

```ts theme={null}
users(): Record<string, Fact[]>
```

### FakeGateway.snapshot

Copy all synthetic stores belonging to one project.

```ts theme={null}
snapshot(project?: string): Record<string, Fact[]>
```

### FakeGateway.owner

Copy a "Me" key's own facts: a project's, or the personal ones (project null).

```ts theme={null}
owner(project?: string | null): Fact[]
```

### FakeGateway.shared

Copy one project's shared facts.

```ts theme={null}
shared(project?: string): Fact[]
```

### FakeGateway.fetch

Bound function: pass directly as a client's fetch option. Never calls the network.

```ts theme={null}
fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>
```

## FakeOptions

Synthetic gateway stores, keys, deterministic seed, and fault scripts.

### FakeOptions.users

Synthetic facts grouped by user in the default project.

```ts theme={null}
users: Users | undefined
```

### FakeOptions.shared

Initial shared facts grouped by project.

```ts theme={null}
shared: Record<string, (string | Fact)[]> | undefined
```

### FakeOptions.projects

Additional synthetic project stores, each isolated by project and user.

```ts theme={null}
projects: Record<string, Users> | undefined
```

### FakeOptions.seed

Unsigned 32-bit seed controlling deterministic fact identifiers.

```ts theme={null}
seed: number | undefined
```

### FakeOptions.baseURL

Gateway base URL used for requests and scope validation.

```ts theme={null}
baseURL: string | undefined
```

### FakeOptions.keys

Synthetic bearer keys mapped to independent key settings.

```ts theme={null}
keys: Record<string, KeyOptions> | undefined
```

### FakeOptions.scripts

Queued synthetic replies and faults.

```ts theme={null}
scripts: Script[] | undefined
```

### FakeOptions.costUsd

Synthetic cost expressed as a decimal string.

```ts theme={null}
costUsd: string | undefined
```

## GatewayCall

Content-free call record returned by the developer-key lookup.

### GatewayCall.id

Gateway call id.

```ts theme={null}
id: string
```

### GatewayCall.object

Wire object kind.

```ts theme={null}
object: "gateway.call"
```

### GatewayCall.outcome

In-progress calls have not settled. Interrupted calls use the last checkpoint.

```ts theme={null}
outcome: "ok" | "provider_error" | "atlaso_error" | "client_abort" | "key_revoked" | "key_expired" | "in_progress" | "interrupted"
```

### GatewayCall.estimated

True for checkpoints and interrupted estimates; a late final can replace them.

```ts theme={null}
estimated: boolean
```

### GatewayCall.cost

Provider list price, with the estimate explicitly labelled.

```ts theme={null}
cost: { usd: string | null; basis: "list_price"; estimated: boolean; unpriced_reason: string | null; }
```

### GatewayCall.call

Other gateway call fields, including cost, tokens and memory metadata.

```ts theme={null}
call(field: string): unknown
```

## InvalidRequestError

An argument refused before anything was sent (for example a malformed fact id).
Kind `invalid_request`, never retryable: resending the same arguments cannot succeed.

### InvalidRequestError.constructor

Create InvalidRequestError with the supplied configuration.

```ts theme={null}
constructor(code: string, message: string): InvalidRequestError
```

## KeyOptions

Synthetic key scope, memory mode, and project association.

### KeyOptions.project

Project namespace; null selects a namespace private to the key.

```ts theme={null}
project: string | null | undefined
```

### KeyOptions.keyScope

Owner or per-user key behavior to simulate.

```ts theme={null}
keyScope: "owner" | "per_user" | undefined
```

### KeyOptions.required

Whether model calls require an accepted user id.

```ts theme={null}
required: boolean | undefined
```

### KeyOptions.memory

Memory metadata or operations scoped to this user.

```ts theme={null}
memory: "off" | "learn" | "use" | undefined
```

## KnownModelName

A catalog model id. Use this strict type when you want typo checking.

```ts theme={null}
export type KnownModelName = (typeof MODEL_NAMES)[number];
```

## KnownProviderName

One of the provider names the gateway lists today.

```ts theme={null}
export type KnownProviderName = (typeof PROVIDER_NAMES)[number];
```

## LocalHooks

Local callbacks receive Receipt, ErrorInfo, or retirement-notice text. Remote metadata and error text are untrusted.

### LocalHooks.onReceipt

Called with a final receipt after a tracked call or memory page/operation.

```ts theme={null}
onReceipt: ((receipt: Receipt) => void) | undefined
```

### LocalHooks.onError

Called with typed error information on a failed tracked call or memory operation.

```ts theme={null}
onError: ((error: ErrorInfo) => void) | undefined
```

### LocalHooks.onNotice

Called for each reply carrying a validated client retirement notice.

```ts theme={null}
onNotice: ((notice: string) => void) | undefined
```

## Memory

One stored fact returned by the gateway.

### Memory.id

Stable identifier of the stored fact.

```ts theme={null}
id: string
```

### Memory.text

The stored text. Stored text may differ from the input: recognised passwords, API keys and tokens are redacted, but unrecognised secrets and other sensitive details can remain.

```ts theme={null}
text: string
```

### Memory.source

How the fact arrived: "sdk" (saved with this library), "api" (any other direct request),
"learned", "dashboard", or for your own memory also "plugin" or "import".

```ts theme={null}
source: (string & {}) | "sdk" | "api" | "learned" | "dashboard" | "plugin" | "import"
```

### Memory.createdAt

Fact creation time as a Date.

```ts theme={null}
createdAt: Date
```

### Memory.appUserLabel

A short label for the app user. Never the raw user id.

```ts theme={null}
appUserLabel: string
```

### Memory.engine

Optional engine facets, absent until the wire exposes them.

```ts theme={null}
engine: EngineFacets | undefined
```

## MemoryApi

Memory operations scoped to one user and the key's project.

### MemoryApi.export

Collect every page or fail without a partial object; an erase during an export can end it early.

```ts theme={null}
export(o?: { pageSize?: number; }): Promise<MemoryExport>
```

### MemoryApi.exportStream

Iterate newest first with bounded page memory.

```ts theme={null}
exportStream(o?: { pageSize?: number; }): AsyncIterable<Memory>
```

### MemoryApi.add

Save one fact with an automatic idempotency key; reuse the returned key for manual resend.

```ts theme={null}
add(text: string, o?: { signal?: AbortSignal; idempotencyKey?: string; }): Promise<AddResult>
```

### MemoryApi.search

Preview recall for this user. Scores compare only within one answer.

```ts theme={null}
search(query: string, o?: { limit?: number; }): Promise<Array<{ memory: Memory; score: number; }>>
```

### MemoryApi.addMany

Save 1 to 50 facts with per-item results.

```ts theme={null}
addMany(texts: string[], o?: { idempotencyKey?: string; }): Promise<{ results: Array<{ index: number; status: string; fact?: Memory; error?: unknown; }>; complete: boolean; idempotencyKey: string; }>
```

### MemoryApi.update

Replace a fact with a new id; the old id is hidden from list and recall.

```ts theme={null}
update(id: string, text: string): Promise<{ memory: Memory; replaces: string; }>
```

### MemoryApi.list

Read newest-first facts, fetching pages lazily.

```ts theme={null}
list(o?: { limit?: number; after?: string; }): AsyncIterable<Memory> & { page(): Promise<Page>; }
```

### MemoryApi.delete

Delete one fact in this scope; a pending result can be resumed.

```ts theme={null}
delete(memoryId: string, o?: { waitMs?: number; }): Promise<DeleteResult>
```

### MemoryApi.erase

Erase every memory of this user in this project.

```ts theme={null}
erase(o?: { waitMs?: number; }): Promise<EraseResult>
```

## MemoryAPIError

An error reply from the Atlaso memory API.

### MemoryAPIError.replacedBy

Current fact id on fact\_replaced; null means the replacement chain was deleted.

```ts theme={null}
replacedBy: string | null | undefined
```

### MemoryAPIError.constructor

Create MemoryAPIError with the supplied configuration.

```ts theme={null}
constructor(info: ErrorInfo): MemoryAPIError
```

## MemoryApiLike

The part of the core memory API the AI SDK tools use (design 1.2).

### MemoryApiLike.export

Collect all facts for a right-of-access response within this user and project.

```ts theme={null}
export(o?: { pageSize?: number; }): Promise<MemoryExport>
```

### MemoryApiLike.exportStream

Lazily iterate all exported facts, newest first.

```ts theme={null}
exportStream(o?: { pageSize?: number; }): AsyncIterable<Memory>
```

### MemoryApiLike.add

Save one fact with an automatic idempotency key; reuse its key for manual resend.

```ts theme={null}
add(text: string, o?: { signal?: AbortSignal; idempotencyKey?: string; }): Promise<AddResult>
```

### MemoryApiLike.search

Search this user's recall candidates.

```ts theme={null}
search(query: string, o?: { limit?: number; }): Promise<Array<{ memory: Memory; score: number; }>>
```

### MemoryApiLike.addMany

Add 1-50 facts with one idempotency key and per-item results.

```ts theme={null}
addMany(texts: string[], o?: { idempotencyKey?: string; }): Promise<{ results: Array<{ index: number; status: string; fact?: Memory; error?: unknown; }>; complete: boolean; idempotencyKey: string; }>
```

### MemoryApiLike.update

Correct a fact and receive its replacement id.

```ts theme={null}
update(id: string, text: string): Promise<{ memory: Memory; replaces: string; }>
```

### MemoryApiLike.list

Read newest-first facts, fetching pages lazily.

```ts theme={null}
list(o?: { limit?: number; after?: string; }): AsyncIterable<Memory>
```

### MemoryApiLike.delete

Delete one fact in this scope; a pending result can be resumed.

```ts theme={null}
delete(memoryId: string, o?: { waitMs?: number; }): Promise<{ outcome: string; }>
```

## MemoryExport

A complete, newest-first export within this user and key project. Not a transactional snapshot.

### MemoryExport.generatedAt

UTC time when collection completed.

```ts theme={null}
generatedAt: Date
```

### MemoryExport.data

All facts returned by the gateway, newest first.

```ts theme={null}
data: Memory[]
```

### MemoryExport.factCount

Number of exported facts.

```ts theme={null}
factCount: number
```

### MemoryExport.pageCount

Number of pages read, including an empty final page.

```ts theme={null}
pageCount: number
```

## MemoryTools

Tool adapters bound to this user's memory API.

### MemoryTools.forOpenAI

Function definitions for an OpenAI-style `tools:` list (`.definitions`) and their runner (`.run(call)`).

```ts theme={null}
forOpenAI(o?: MemoryToolsOptions): OpenAIMemoryTools
```

## MemoryToolsOptions

Controls whether the model may request deletion of previously seen facts.

### MemoryToolsOptions.allowForget

Expose `forget`. Off by default so a model cannot delete.

```ts theme={null}
allowForget: boolean | undefined
```

### MemoryToolsOptions.format

Tool definition shape: Chat Completions (default) or Responses.

```ts theme={null}
format: "chat" | "responses" | undefined
```

### MemoryToolsOptions.receipt

Ids in this receipt may be forgotten (in addition to ids the tools listed).

```ts theme={null}
receipt: Receipt | null | undefined
```

## MODEL\_NAMES

Callable canonical model ids at this release; availability depends on your key.

```ts theme={null}
MODEL_NAMES: readonly ["anthropic/claude-fable-5", "anthropic/claude-fable-5.1", "anthropic/claude-fable-5.2", "anthropic/claude-haiku-4.5", "anthropic/claude-haiku-5.5", "anthropic/claude-mythos-5", "anthropic/claude-mythos-5.1", "anthropic/claude-mythos-5.2", "anthropic/claude-mythos-preview", "anthropic/claude-opus-4.5", "anthropic/claude-opus-4.6", "anthropic/claude-opus-4.7", "anthropic/claude-opus-4.8", "anthropic/claude-opus-5", "anthropic/claude-opus-5.5", "anthropic/claude-sonnet-4.5", "anthropic/claude-sonnet-4.6", "anthropic/claude-sonnet-5", "anthropic/claude-sonnet-5.5", "azure/chat-latest", "azure/claude-fable-5", "azure/claude-fable-5.1", "azure/claude-fable-5.2", "azure/claude-haiku-4.5", "azure/claude-haiku-5.5", "azure/claude-opus-4.5", "azure/claude-opus-4.6", "azure/claude-opus-4.7", "azure/claude-opus-4.8", "azure/claude-opus-5", "azure/claude-opus-5.5", "azure/claude-sonnet-4.6", "azure/claude-sonnet-5", "azure/claude-sonnet-5.5", "azure/codestral-2501", "azure/cohere-command-a", "azure/deepseek-v3.2", "azure/deepseek-v3.2-speciale", "azure/deepseek-v4-flash", "azure/deepseek-v4-pro", "azure/deepseek-v4.1-flash", "azure/gpt-4o", "azure/gpt-5", "azure/gpt-5-mini", "azure/gpt-5-nano", "azure/gpt-5.1", "azure/gpt-5.2", "azure/gpt-5.4", "azure/gpt-5.4-mini", "azure/gpt-5.4-nano", "azure/gpt-5.5", "azure/gpt-5.6-luna", "azure/gpt-5.6-sol", "azure/gpt-5.6-terra", "azure/gpt-6-astra", "azure/gpt-6-luna", "azure/gpt-6-sol", "azure/gpt-6.1-sol", "azure/gpt-6.1-terra", "azure/gpt-oss-120b", "azure/grok-4", "azure/grok-4.1-fast-non-reasoning", "azure/grok-4.1-fast-reasoning", "azure/grok-4.3", "azure/grok-4.6", "azure/grok-4.7", "azure/grok-code-fast-1", "azure/kimi-k2.5", "azure/kimi-k2.6", "azure/kimi-k2.7-code", "azure/llama-3.3-70b-instruct", "azure/mai-thinking-1", "azure/mistral-large-3", "azure/mistral-medium-3-5", "azure/phi-4", "azure/phi-4-mini-instruct", "azure/phi-4-mini-reasoning", "azure/phi-4-multimodal-instruct", "azure/phi-4-reasoning", "baseten/beam-1.0", "baseten/deepseek-v4-flash-0731", "baseten/deepseek-v4-pro-0813", "baseten/deepseek-v4.1-flash", "baseten/deepseek-v4.1-flash-1017", "baseten/deepseek-v4.1-flash-1017-fast", "baseten/deepseek-v4.1-flash-fast", "baseten/glm-5.2", "baseten/glm-5.2-fast", "baseten/glm-5.3", "baseten/glm-5.3-fast", "baseten/glm-5.3-flash", "baseten/gpt-oss-120b", "baseten/kimi-k3", "baseten/kimi-k3.1-pro", "baseten/muse-spark-open", "baseten/nvidia-nemotron-3-ultra-550b-a55b", "baseten/nvidia-nemotron-3.5-super-vl-120b-a12b", "bedrock/claude-fable-5", "bedrock/claude-fable-5.1", "bedrock/claude-fable-5.2", "bedrock/claude-haiku-4.5", "bedrock/claude-haiku-5.5", "bedrock/claude-mythos-5", "bedrock/claude-mythos-5.1", "bedrock/claude-mythos-5.2", "bedrock/claude-opus-4.1", "bedrock/claude-opus-4.5", "bedrock/claude-opus-4.6", "bedrock/claude-opus-4.7", "bedrock/claude-opus-4.8", "bedrock/claude-opus-5", "bedrock/claude-opus-5.5", "bedrock/claude-sonnet-4.5", "bedrock/claude-sonnet-4.6", "bedrock/claude-sonnet-5", "bedrock/claude-sonnet-5.5", "bedrock/deepseek-r1", "bedrock/deepseek-v3.1", "bedrock/deepseek-v3.2", "bedrock/devstral-2-123b", "bedrock/gemma-3-12b-it", "bedrock/gemma-3-27b-it", "bedrock/gemma-3-4b-it", "bedrock/gemma-4-26b-a4b-it", "bedrock/gemma-4-31b", "bedrock/gemma-4-e2b", "bedrock/glm-4.7", "bedrock/glm-4.7-flash", "bedrock/glm-5", "bedrock/glm-5.3", "bedrock/gpt-5.4", "bedrock/gpt-5.5", "bedrock/gpt-5.6-cyber", "bedrock/gpt-5.6-luna", "bedrock/gpt-5.6-sol", "bedrock/gpt-5.6-terra", "bedrock/gpt-6-astra", "bedrock/gpt-6-luna", "bedrock/gpt-6-sol", "bedrock/gpt-6.1-sol", "bedrock/gpt-6.1-terra", "bedrock/gpt-6.2-astra", "bedrock/gpt-6.2-sol", "bedrock/gpt-daybreak-blue-5.6-sol", "bedrock/gpt-oss-120b", "bedrock/gpt-oss-20b", "bedrock/gpt-oss-safeguard-120b", "bedrock/gpt-oss-safeguard-20b", "bedrock/grok-4.3", "bedrock/grok-4.6", "bedrock/grok-4.7", "bedrock/kimi-k2-thinking", "bedrock/kimi-k2.5", "bedrock/kimi-k3", "bedrock/kimi-k3.1-pro-highspeed", "bedrock/llama-3-70b-instruct", "bedrock/llama-3-8b-instruct", "bedrock/llama-3.1-70b-instruct", "bedrock/llama-3.1-8b-instruct", "bedrock/llama-3.3-70b-instruct", "bedrock/llama-4-maverick-17b-instruct", "bedrock/llama-4-scout-17b-instruct", "bedrock/magistral-small-2509", "bedrock/minimax-m2", "bedrock/minimax-m2.1", "bedrock/minimax-m2.5", "bedrock/ministral-14b-2512", "bedrock/ministral-3b-2512", "bedrock/ministral-8b-2512", "bedrock/mistral-7b-instruct-v0.2", "bedrock/mistral-large-2402", "bedrock/mistral-large-3", "bedrock/mistral-small-2402", "bedrock/mixtral-8x7b-instruct-v0.1", "bedrock/nemotron-nano-12b-v2", "bedrock/nemotron-nano-3-30b", "bedrock/nemotron-nano-9b-v2", "bedrock/nemotron-super-3-120b", "bedrock/nova-2-lite", "bedrock/nova-lite", "bedrock/nova-micro", "bedrock/nova-pro", "bedrock/palmyra-vision-7b", "bedrock/palmyra-x4", "bedrock/palmyra-x5", "bedrock/pixtral-large-2502", "bedrock/qwen3-235b-a22b-instruct-2507", "bedrock/qwen3-32b", "bedrock/qwen3-coder-30b-a3b-instruct", "bedrock/qwen3-coder-480b-a35b-instruct", "bedrock/qwen3-coder-next", "bedrock/qwen3-next-80b-a3b-instruct", "bedrock/qwen3-vl-235b-a22b-instruct", "bedrock/voxtral-mini-3b-2507", "bedrock/voxtral-small-24b-2507", "coreweave/beam-1.0-501b-a23b", "digitalocean/deepseek-v4.1-flash", "digitalocean/glm-5.2", "digitalocean/glm-5.3", "digitalocean/glm-5.3-flash", "digitalocean/mimo-v2.5-pro", "digitalocean/qwen3.8-max", "fireworks/deepseek-v4.1-flash", "fireworks/deepseek-v4.1-flash-1017", "fireworks/ember-1", "fireworks/glm-5.3", "fireworks/glm-5.3-flash", "fireworks/gpt-oss-120b", "fireworks/inkling", "fireworks/kimi-k3", "fireworks/kimi-k3.1-pro", "fireworks/minimax-m3", "fireworks/minimax-m3.1-flash", "fireworks/muse-spark-open", "fireworks/nemotron-3-ultra-550b-a55b", "fireworks/nemotron-lightning-3.5-30b-a3b", "fireworks/qwen3.8-max", "fireworks/ultramarine-1-flash", "google/gemini-3-flash-preview", "google/gemini-3.1-flash-lite", "google/gemini-3.1-pro-preview", "google/gemini-3.1-pro-preview-customtools", "google/gemini-3.5-flash-lite", "google/gemini-3.6-flash", "google/gemini-3.8-flash", "google/gemini-4-argon", "groq/gpt-oss-120b", "groq/gpt-oss-20b", "groq/gpt-oss-safeguard-20b", "groq/llama-prompt-guard-2-22m", "groq/llama-prompt-guard-2-86m", "groq/qwen3.8-27b", "minimax/minimax-m3", "minimax/minimax-m3.1-flash", "novita/apodex-1.1-mini", "novita/autoglm-phone-9b-multilingual", "novita/deepseek-ocr-2", "novita/deepseek-r1-turbo", "novita/deepseek-v4-flash-0731", "novita/deepseek-v4-pro", "novita/deepseek-v4-pro-0813", "novita/deepseek-v4.1-flash", "novita/deepseek-v4.1-flash-1017", "novita/deepseek-v4.1-flash-dst", "novita/deepseek_v3", "novita/gemma-3-27b-it", "novita/gemma-4-26b-a4b-it", "novita/gemma-4-31b-it", "novita/glm-4.5-air", "novita/glm-4.5v", "novita/glm-4.6", "novita/glm-4.6v", "novita/glm-4.7", "novita/glm-4.7-flash", "novita/glm-5", "novita/glm-5.1", "novita/glm-5.2", "novita/glm-5.3", "novita/glm-5.3-flash", "novita/glm-5.3-flashx", "novita/gpt-oss-120b", "novita/hy3", "novita/hy4", "novita/hy4-preview", "novita/kimi-k2-0905", "novita/kimi-k2-instruct", "novita/kimi-k2.5", "novita/kimi-k2.6", "novita/kimi-k2.7-code", "novita/kimi-k3.1-pro", "novita/kimi-k3.1-pro-highspeed", "novita/l3-8b-stheno-v3.2", "novita/ling-3.0-flash", "novita/ling-3.1-flash", "novita/llama-3.1-8b-instruct", "novita/llama-4-maverick-17b-128e-instruct-fp8", "novita/llama-4-scout-17b-16e-instruct", "novita/macaron-v1-tall", "novita/macaron-v1-venti", "novita/mimo-v2.6-flash", "novita/mimo-v2.6-pro", "novita/minimax-m1-80k", "novita/minimax-m2.5", "novita/minimax-m2.7", "novita/minimax-m2.7-highspeed", "novita/minimax-m3.1-flash", "novita/nemotron-3-nano-30b-a3b", "novita/qwen-mt-plus", "novita/qwen3-omni-30b-a3b-thinking", "novita/qwen3-vl-30b-a3b-instruct", "novita/qwen3.8-2.4t-a95b", "novita/step-3.7-flash", "novita/step-5-preview", "novita/wizardlm-2-8x22b", "openai/chat-latest", "openai/gpt-4.1", "openai/gpt-4.1-2025-04-14", "openai/gpt-4.1-mini", "openai/gpt-4.1-mini-2025-04-14", "openai/gpt-4o", "openai/gpt-4o-2024-08-06", "openai/gpt-4o-2024-11-20", "openai/gpt-4o-mini", "openai/gpt-4o-mini-2024-07-18", "openai/gpt-5", "openai/gpt-5-2025-08-07", "openai/gpt-5-mini", "openai/gpt-5-mini-2025-08-07", "openai/gpt-5-nano", "openai/gpt-5-nano-2025-08-07", "openai/gpt-5.1", "openai/gpt-5.1-2025-11-13", "openai/gpt-5.2", "openai/gpt-5.2-2025-12-11", "openai/gpt-5.4", "openai/gpt-5.4-2026-03-05", "openai/gpt-5.4-mini", "openai/gpt-5.4-mini-2026-03-17", "openai/gpt-5.4-nano", "openai/gpt-5.4-nano-2026-03-17", "openai/gpt-5.5", "openai/gpt-5.5-2026-04-23", "openai/gpt-5.6", "openai/gpt-5.6-luna", "openai/gpt-5.6-sol", "openai/gpt-5.6-terra", "openai/gpt-6-astra", "openai/gpt-6-cyber", "openai/gpt-6-luna", "openai/gpt-6-sol", "openai/gpt-6.1-sol", "openai/gpt-6.1-terra", "openai/gpt-6.2-astra", "openai/gpt-6.2-sol", "openai/o3", "openai/o3-2025-04-16", "qwen/deepseek-v4-pro", "qwen/deepseek-v4-pro-0813", "qwen/deepseek-v4.1-flash", "qwen/deepseek-v4.1-flash-1017", "qwen/glm-5.1", "qwen/glm-5.2", "qwen/glm-5.3", "qwen/kimi-k2.5", "qwen/kimi-k2.6", "qwen/kimi-k2.7-code", "qwen/kimi-k3", "qwen/kimi-k3.1-pro", "qwen/mindlab/macaron-v1-tall", "qwen/mindlab/macaron-v1.1-coding-venti", "qwen/mindlab/macaron-v1.1-venti", "qwen/qwen-doc-turbo", "qwen/qwen-flash", "qwen/qwen-flash-2025-07-28", "qwen/qwen-max", "qwen/qwen-plus", "qwen/qwen-plus-2025-01-25", "qwen/qwen-plus-2025-04-28", "qwen/qwen-plus-2025-07-14", "qwen/qwen-plus-2025-12-01", "qwen/qwen-plus-latest", "qwen/qwen-vl-ocr", "qwen/qwen-vl-ocr-2025-11-20", "qwen/qwen3-coder-flash", "qwen/qwen3-coder-flash-2025-07-28", "qwen/qwen3-vl-plus", "qwen/qwen3.5-122b-a10b", "qwen/qwen3.5-27b", "qwen/qwen3.5-35b-a3b", "qwen/qwen3.5-flash", "qwen/qwen3.5-flash-2026-02-23", "qwen/qwen3.5-ocr", "qwen/qwen3.6-27b", "qwen/qwen3.6-35b-a3b", "qwen/qwen3.6-flash", "qwen/qwen3.6-flash-2026-04-16", "qwen/qwen3.6-plus", "qwen/qwen3.6-plus-2026-04-02", "qwen/qwen3.7-flash", "qwen/qwen3.7-flash-2026-07-15", "qwen/qwen3.7-max", "qwen/qwen3.7-max-2026-05-17", "qwen/qwen3.7-max-2026-05-20", "qwen/qwen3.7-max-2026-06-08", "qwen/qwen3.7-max-preview", "qwen/qwen3.7-plus", "qwen/qwen3.7-plus-2026-05-26", "qwen/qwen3.8-2.4t-a95b", "qwen/qwen3.8-27b", "qwen/qwen3.8-flash", "qwen/qwen3.8-max", "qwen/qwen3.8-max-0902", "qwen/qwen3.8-omni-flash", "qwen/qwen4-max", "siliconflow/deepseek-r1", "siliconflow/deepseek-v3", "siliconflow/deepseek-v3.1", "siliconflow/deepseek-v3.1-terminus", "siliconflow/deepseek-v3.2", "siliconflow/deepseek-v3.2-exp", "siliconflow/deepseek-v4-flash", "siliconflow/deepseek-v4-flash-0731", "siliconflow/deepseek-v4-flash-vision-exp", "siliconflow/deepseek-v4-pro", "siliconflow/deepseek-v4-pro-0813", "siliconflow/deepseek-v4.1-flash", "siliconflow/gemma-4-26b-a4b-it", "siliconflow/gemma-4-31b-it", "siliconflow/glm-4.5-air", "siliconflow/glm-5.1", "siliconflow/glm-5.2", "siliconflow/glm-5.3", "siliconflow/glm-5.3-flash", "siliconflow/glm-5v-turbo", "siliconflow/gpt-oss-120b", "siliconflow/gpt-oss-20b", "siliconflow/hunyuan-a13b-instruct", "siliconflow/hy3", "siliconflow/hy4-preview", "siliconflow/kimi-k2.6", "siliconflow/kimi-k2.7-code", "siliconflow/kimi-k3", "siliconflow/ling-flash-2.0", "siliconflow/longcat-2.0", "siliconflow/minimax-m3", "siliconflow/qwen2.5-72b-instruct", "siliconflow/qwen2.5-7b-instruct", "siliconflow/qwen3-14b", "siliconflow/qwen3-30b-a3b-instruct-2507", "siliconflow/qwen3-32b", "siliconflow/qwen3-8b", "siliconflow/qwen3-coder-30b-a3b-instruct", "siliconflow/qwen3-vl-30b-a3b-instruct", "siliconflow/qwen3-vl-30b-a3b-thinking", "siliconflow/qwen3-vl-32b-instruct", "siliconflow/qwen3-vl-32b-thinking", "siliconflow/qwen3-vl-8b-instruct", "siliconflow/qwen3.5-122b-a10b", "siliconflow/qwen3.5-27b", "siliconflow/qwen3.5-35b-a3b", "siliconflow/qwen3.5-9b", "siliconflow/qwen3.6-27b", "siliconflow/qwen3.6-35b-a3b", "siliconflow/qwen3.8-2.4t-a95b", "siliconflow/seed-oss-36b-instruct", "siliconflow/step-3.5-flash", "together/beam-1.0-501b-a23b", "together/deepseek-v4-pro-0813", "together/deepseek-v4.1-flash", "together/deepseek-v4.1-flash-1017", "together/glm-5.2", "together/glm-5.3", "together/glm-5.3-flash", "together/gpt-oss-120b", "together/kimi-k3", "together/kimi-k3.1-pro", "together/minimax-m3.1-flash", "together/muse-glimmer-30b", "together/muse-spark-open", "together/nvidia-nemotron-3.5-super-vl", "together/qwen3.5-9b", "together/qwen3.6-plus", "together/qwen3.7-max", "together/qwen3.7-plus", "together/qwen3.8-flash", "together/ternary-bonsai-27b", "vertex/gemini-3.1-flash-lite", "vertex/gemini-3.1-pro-preview", "vertex/gemini-3.5-flash", "vertex/gemini-3.5-flash-lite", "vertex/gemini-3.6-flash", "vertex/gemini-3.7-flash", "vertex/gemini-3.8-flash", "vertex/gemini-4-argon", "vertex/gemini-robotics-er-2-preview", "xai/grok-4.20-0309-non-reasoning", "xai/grok-4.20-0309-reasoning", "xai/grok-4.3", "xai/grok-4.5", "xai/grok-4.6", "xai/grok-4.7", "xai/grok-build-0.1", "zai/glm-4-32b-0414-128k", "zai/glm-4.5", "zai/glm-4.5-air", "zai/glm-4.5-airx", "zai/glm-4.5-flash", "zai/glm-4.5-x", "zai/glm-4.5v", "zai/glm-4.6", "zai/glm-4.6v", "zai/glm-4.6v-flashx", "zai/glm-4.7", "zai/glm-4.7-flash", "zai/glm-4.7-flashx", "zai/glm-5", "zai/glm-5.1", "zai/glm-5.2", "zai/glm-5.3", "zai/glm-5.3-flash", "zai/glm-5.3-flashx", "zai/glm-5.3-flashx-legal"]
```

## ModelName

Suggested catalog ids plus any future model string; never validates or rewrites a request.

```ts theme={null}
export type ModelName = KnownModelName | (string & {});
```

## NotSentError

The request never reached the server (the connection did not open), so nothing was saved.
Thrown by `memory.add()` once its retries are used up. Sending the same add again is safe.

### NotSentError.safeToRepeat

True only when the request provably never reached the server.

```ts theme={null}
safeToRepeat: true
```

### NotSentError.constructor

Create NotSentError with the supplied configuration.

```ts theme={null}
constructor(info: ErrorInfo): NotSentError
```

## OpenAILike

The smallest shape of a provider client this library can scope.

### OpenAILike.baseURL

Gateway base URL used for requests and scope validation.

```ts theme={null}
baseURL: string
```

### OpenAILike.withOptions

Return a provider client copy with the given options.

```ts theme={null}
withOptions(options: { fetch?: typeof fetch; [k: string]: unknown; }): unknown
```

## OpenAIMemoryTools

Function definitions and a safe executor for memory tools.

### OpenAIMemoryTools.definitions

Function definitions to pass to the provider request.

```ts theme={null}
definitions: Record<string, unknown>[]
```

### OpenAIMemoryTools.run

Run one tool call from your own loop. Returns the tool result text. Never throws for API errors.

```ts theme={null}
run(call: ToolCallLike): Promise<string>
```

## OwnerMemoryApi

Your own memory, for a "Me" key: `atlaso.memory`. The memory the Atlaso plugins use: facts land in
the key's project, or in your personal memory when the key has none, and a delete is a real forget
everywhere. There is no erase: a key never deletes all of your memories at once (use the dashboard).

### OwnerMemoryApi.add

Save one fact with an automatic idempotency key; reuse the returned key for manual resend.

```ts theme={null}
add(text: string, o?: { signal?: AbortSignal; idempotencyKey?: string; }): Promise<AddResult>
```

### OwnerMemoryApi.addMany

Save 1 to 50 facts with per-item results.

```ts theme={null}
addMany(texts: string[], o?: { idempotencyKey?: string; }): Promise<{ results: Array<{ index: number; status: string; fact?: Memory; error?: unknown; }>; complete: boolean; idempotencyKey: string; }>
```

### OwnerMemoryApi.list

Read newest-first facts, fetching pages lazily.

```ts theme={null}
list(o?: { limit?: number; after?: string; }): AsyncIterable<Memory> & { page(): Promise<Page>; }
```

### OwnerMemoryApi.search

Preview recall of your own memory. Scores compare only within one answer.

```ts theme={null}
search(query: string, o?: { limit?: number; }): Promise<Array<{ memory: Memory; score: number; }>>
```

### OwnerMemoryApi.update

Correct a fact: the new fact has a new id, and the old wording is forgotten everywhere.

```ts theme={null}
update(id: string, text: string): Promise<{ memory: Memory; replaces: string; }>
```

### OwnerMemoryApi.delete

Delete one fact everywhere; a pending result can be resumed. An id this key cannot reach is fact\_not\_found.

```ts theme={null}
delete(memoryId: string, o?: { waitMs?: number; }): Promise<DeleteResult>
```

## Page

A newest-first page of stored facts with its continuation cursor.

### Page.data

The provider result or facts returned by this operation.

```ts theme={null}
data: Memory[]
```

### Page.hasMore

Whether another page follows this page.

```ts theme={null}
hasMore: boolean
```

### Page.firstId

First fact id in this page, or null for an empty page.

```ts theme={null}
firstId: string | null
```

### Page.lastId

Continuation cursor: last fact id, or null for an empty page.

```ts theme={null}
lastId: string | null
```

## PendingResult

The server accepted the operation but has not finished it yet.

### PendingResult.outcome

Discriminant describing the operation result.

```ts theme={null}
outcome: "pending"
```

### PendingResult.retryAfterMs

Suggested delay before another attempt, in milliseconds.

```ts theme={null}
retryAfterMs: number
```

## PROVIDER\_NAMES

Provider names the gateway lists today (catalog providers with a live model).

```ts theme={null}
PROVIDER_NAMES: readonly ["anthropic", "azure", "baseten", "bedrock", "coreweave", "digitalocean", "fireworks", "google", "groq", "minimax", "novita", "openai", "qwen", "siliconflow", "together", "vertex", "xai", "zai"]
```

## ProviderClass

A provider client class, passed once so `user.openai()` / `user.anthropic()` can build the shared client.
The library never imports a provider package itself, so it stays dependency-free on Node, Bun and Deno.

```ts theme={null}
export type ProviderClass<C> = new (options: never) => C;
```

## ProviderName

A provider name as the gateway lists it, such as "anthropic" or "bedrock".
Autocomplete offers today's names; any other string is accepted too, so a
provider the gateway adds later works without a new release of this library.

```ts theme={null}
export type ProviderName = KnownProviderName | (string & {});
```

## ProviderRouting

The gateway's `provider` request field, with its wire names.

### ProviderRouting.order

Try these providers first, in this order.

```ts theme={null}
order: ProviderName[] | undefined
```

### ProviderRouting.only

Use only these providers.

```ts theme={null}
only: ProviderName[] | undefined
```

### ProviderRouting.ignore

Never use these providers.

```ts theme={null}
ignore: ProviderName[] | undefined
```

### ProviderRouting.allow\_fallbacks

Whether a backup may answer if the selected provider fails.

```ts theme={null}
allow_fallbacks: boolean | undefined
```

## Receipt

One typed record per call. Plain data.

### Receipt.kind

Typed category describing the observed result.

```ts theme={null}
kind: ReceiptKind
```

### Receipt.requestId

Gateway request identifier, or null when unavailable.

```ts theme={null}
requestId: string | null
```

### Receipt.callId

Gateway call identifier, or null when unavailable.

```ts theme={null}
callId: string | null
```

### Receipt.providerHost

Host reported by the gateway, or null when unavailable.

```ts theme={null}
providerHost: string | null
```

### Receipt.model

Model reported by the gateway, or null when unavailable.

```ts theme={null}
model: string | null
```

### Receipt.memory

Memory metadata or operations scoped to this user.

```ts theme={null}
memory: ReceiptMemory | null
```

### Receipt.cost

usd is a decimal string, never a float, and null whenever the cost is not known.

```ts theme={null}
cost: ReceiptCost
```

### Receipt.cache

Reported cache read and write counts; unavailable values are null.

```ts theme={null}
cache: { read: number | null; write: number | null; }
```

### Receipt.ignoredParams

Request parameter names the gateway ignored.

```ts theme={null}
ignoredParams: string[]
```

### Receipt.tagsDropped

Tag names the gateway dropped.

```ts theme={null}
tagsDropped: string[]
```

### Receipt.reason

Gateway explanation, or null when none was reported.

```ts theme={null}
reason: string | null
```

### Receipt.streamState

Current or final tracked stream state.

```ts theme={null}
streamState: StreamState
```

### Receipt.error

Typed failure information when the operation failed.

```ts theme={null}
error: ErrorInfo | null
```

### Receipt.raw

Only lowercased x-atlaso-\* headers and x-request-id, plus the in-band `atlaso` object.

```ts theme={null}
raw: { headers: Record<string, string>; atlaso: unknown | null; }
```

## ReceiptCost

Known decimal cost, pending cost, or an explicit reason cost is unknown.

```ts theme={null}
export type ReceiptCost =
  | { state: "known"; usd: string; estimated: boolean }
  | { state: "pending"; usd: null }
  | { state: "unknown"; usd: null; why: UnknownCostWhy };
```

## ReceiptKind

The API and delivery mode observed for this receipt.

```ts theme={null}
export type ReceiptKind = "chat" | "chat_stream" | "responses" | "responses_stream" | "messages" | "messages_stream" | "headers_only";
```

## ReceiptMemory

Memory activity reported for this request, not proof of model use.

### ReceiptMemory.status

Reported status; unavailable HTTP status is null.

```ts theme={null}
status: (string & {}) | "off" | "used" | "none" | "skipped" | "bypass"
```

### ReceiptMemory.memoryIds

Ids of the memories put into this request's prompt. Not proof the model used them.

```ts theme={null}
memoryIds: string[]
```

### ReceiptMemory.sharedIds

Prompt memory ids supplied by the project's shared store. Always a subset of memoryIds.

```ts theme={null}
sharedIds: string[]
```

### ReceiptMemory.memoriesInPrompt

How many memories were added to this request's prompt (not saved, not proven used). Null if unreadable.

```ts theme={null}
memoriesInPrompt: number | null
```

### ReceiptMemory.gatewayOverheadMs

Atlaso's time before the provider call, in milliseconds.

```ts theme={null}
gatewayOverheadMs: number | null
```

### ReceiptMemory.reason

Gateway explanation, or null when none was reported.

```ts theme={null}
reason: string | null
```

### ReceiptMemory.action

Memory action reported by the gateway.

```ts theme={null}
action: (string & {}) | "off" | "none" | "added"
```

## RecordedRequest

Synthetic request observation. Authorization is excluded.

### RecordedRequest.clientName

Client name cleaned using the gateway rules; null for credential shapes.

```ts theme={null}
clientName: string | null
```

### RecordedRequest.route

Gateway route matched or observed by the fake.

```ts theme={null}
route: Route
```

### RecordedRequest.userHeader

User header observed by the fake; null when absent.

```ts theme={null}
userHeader: string | null
```

### RecordedRequest.project

Project namespace; null selects a namespace private to the key.

```ts theme={null}
project: string
```

### RecordedRequest.method

HTTP request method.

```ts theme={null}
method: string
```

### RecordedRequest.url

Request URL observed by the fake.

```ts theme={null}
url: string
```

### RecordedRequest.headers

Observed headers excluding authorization.

```ts theme={null}
headers: Record<string, string>
```

### RecordedRequest.body

Synthetic parsed request body.

```ts theme={null}
body: unknown
```

### RecordedRequest.bodyBytes

Exact serialized synthetic request body.

```ts theme={null}
bodyBytes: string
```

### RecordedRequest.step

Optional test step identifier.

```ts theme={null}
step: string | undefined
```

### RecordedRequest.streamReads

Number of stream chunks read by the consumer.

```ts theme={null}
streamReads: number
```

### RecordedRequest.closed

Whether the synthetic response connection was closed.

```ts theme={null}
closed: boolean
```

## ResponsesFactory

Provider factory used to build a Responses model with scoped headers.

```ts theme={null}
export type ResponsesFactory = (settings: {
  baseURL: string; apiKey: string; name: string; headers: Record<string, string>; fetch: typeof fetch;
}) => { responses(modelId: ModelName): unknown };
```

## Route

Deterministic offline wire fake. Tests behavior, never retrieval quality.

```ts theme={null}
export type Route = "chat" | "responses" | "messages" | "models" | "memory.add" | "memory.list" | "memory.delete" | "memory.erase" | "memory.search" | "memory.batch" | "memory.update" | "shared.add" | "shared.list" | "shared.delete" | "shared.deleteAll" | "calls.get" | "usage.app_users" | "browser.mint" | "browser.revoke" | "browser.revoke_user" | "unknown";
```

## routing

Build the gateway's `provider` field. Spread the result into a create() call:

```ts theme={null}
openai.chat.completions.create(&#123; model, messages, ...routing(&#123; order: ["anthropic", "bedrock"] &#125;) &#125;);
```

Checked here, before anything is sent: unknown options, a non-boolean
`allowFallbacks`, and lists that are not lists of distinct, non-empty names
throw `InvalidRequestError` (code `invalid_routing`). Options left out (or
`undefined`) are not sent; with none set this returns `&#123;&#125;`, which adds nothing.

```ts theme={null}
routing(options?: RoutingOptions): RoutingBody
```

## ai-sdk.routing

Same options and checks as the core `routing()`; the result goes in `providerOptions`.

```ts theme={null}
routing(options?: RoutingOptions): AiSdkRoutingOptions
```

## RoutingBody

What `routing()` returns: `&#123; provider &#125;`, or `&#123;&#125;` when no option was set. Spread it into `create()`.

### RoutingBody.provider

Only the routing options explicitly supplied by the caller.

```ts theme={null}
provider: ProviderRouting | undefined
```

## RoutingOptions

What `routing()` accepts. Every option is optional; leave one out and the gateway's default applies.

### RoutingOptions.order

Try these providers first, in this order.

```ts theme={null}
order: readonly ProviderName[] | undefined
```

### RoutingOptions.only

Use only these providers.

```ts theme={null}
only: readonly ProviderName[] | undefined
```

### RoutingOptions.ignore

Never use these providers.

```ts theme={null}
ignore: readonly ProviderName[] | undefined
```

### RoutingOptions.allowFallbacks

`false`: if the provider the gateway picked fails, fail the call instead of trying a backup.

```ts theme={null}
allowFallbacks: boolean | undefined
```

## ScopeOptions

Optional per-request memory, tags, and session settings.

### ScopeOptions.memory

Sends x-atlaso-memory only when set. "off" = no recall and no learning; "use" = recall only.

```ts theme={null}
memory: "off" | "use" | undefined
```

### ScopeOptions.tags

Sends x-atlaso-tags only when set.

```ts theme={null}
tags: Record<string, string> | undefined
```

### ScopeOptions.sessionId

Sends x-atlaso-session-id only when set.

```ts theme={null}
sessionId: string | undefined
```

## Script

A deterministic reply or fault selected by route and optional user.

### Script.route

Gateway route matched or observed by the fake.

```ts theme={null}
route: Route | undefined
```

### Script.user

Synthetic user id used to select this script.

```ts theme={null}
user: string | undefined
```

### Script.project

Project namespace; null selects a namespace private to the key.

```ts theme={null}
project: string | undefined
```

### Script.times

Number of matching requests for which this script applies.

```ts theme={null}
times: number | undefined
```

### Script.match

Route, user, and optional step matcher.

```ts theme={null}
match: { route: Route; user?: string; step?: string; } | undefined
```

### Script.reply

Synthetic response body, transport failure, or named fault.

```ts theme={null}
reply: string | { status?: number; headers?: Record<string, string>; body?: unknown; rawBody?: string; transportError?: string; stream?: StreamPlan; } | undefined
```

### Script.status

Reported status; unavailable HTTP status is null.

```ts theme={null}
status: number | undefined
```

### Script.retryAfter

Synthetic Retry-After delay, in seconds.

```ts theme={null}
retryAfter: number | undefined
```

### Script.stream

Synthetic streaming behavior for this request.

```ts theme={null}
stream: StreamPlan | undefined
```

### Script.effects

Synthetic store changes applied before the scripted response.

```ts theme={null}
effects: { op: "store_fact" | "erase_user" | "delete_fact" | "set_erase_pending"; user: string; fact?: Fact; factId?: string; pending?: boolean; }[] | undefined
```

## SharedAddResult

The outcome of a shared add. `safeToRepeat` applies when the returned idempotencyKey is
reused with the same text within 24 hours. A fresh key may store another fact.

```ts theme={null}
export type SharedAddResult =
  | { outcome: "added"; memory: SharedFact; idempotencyKey: string; safeToRepeat: true }
  /** No answer, or the server could not confirm. Reuse idempotencyKey to resend safely; never retried automatically. */
  | { outcome: "unknown"; error: ErrorInfo; idempotencyKey: string; safeToRepeat: true }
  /** Nothing was stored: a deleteAll() of the project's shared facts is still running. */
  | { outcome: "rejected"; reason: "erase_in_progress"; error: ErrorInfo; safeToRepeat: true };
```

## SharedApi

Shared operations belong to the server-key client, never a user scope.

### SharedApi.add

Store one project fact with an automatic idempotency key, or the one you pass to resend an
uncertain add safely. An uncertain write is never retried automatically.

```ts theme={null}
add(text: string, o?: { signal?: AbortSignal; idempotencyKey?: string; }): Promise<SharedAddResult>
```

### SharedApi.list

Read newest-first shared facts, fetching later pages lazily.

```ts theme={null}
list(o?: { limit?: number; after?: string; }): AsyncIterable<SharedFact> & { page(): Promise<SharedPage>; }
```

### SharedApi.delete

Delete one shared fact; a pending result can be resumed.

```ts theme={null}
delete(id: string, o?: { waitMs?: number; }): Promise<DeleteResult>
```

### SharedApi.deleteAll

Permanently delete every shared fact in this key's project.

```ts theme={null}
deleteAll(o?: { waitMs?: number; }): Promise<EraseResult>
```

## SharedFact

A fact supplied to every app user of the key's project. It has no app-user label: it belongs to the project.

### SharedFact.id

Stable identifier of the shared fact.

```ts theme={null}
id: string
```

### SharedFact.text

The stored text. Stored text may differ from the input: recognised passwords, API keys and tokens are redacted, but unrecognised secrets and other sensitive details can remain.

```ts theme={null}
text: string
```

### SharedFact.source

Who wrote it: this library ("sdk"), another web request ("api") or the dashboard ("dashboard").

```ts theme={null}
source: (string & {}) | "sdk" | "api" | "dashboard"
```

### SharedFact.createdAt

Fact creation time as a Date.

```ts theme={null}
createdAt: Date
```

## SharedPage

A newest-first page of shared facts.

### SharedPage.data

The shared facts on this page.

```ts theme={null}
data: SharedFact[]
```

### SharedPage.hasMore

Whether another page follows this page.

```ts theme={null}
hasMore: boolean
```

### SharedPage.firstId

First fact id in this page, or null for an empty page.

```ts theme={null}
firstId: string | null
```

### SharedPage.lastId

Continuation cursor: last fact id, or null for an empty page.

```ts theme={null}
lastId: string | null
```

### SharedPage.total

How many shared facts the project keeps, whatever the page; null when the reply did not say.

```ts theme={null}
total: number | null
```

## StreamPlan

Synthetic stream chunks, terminal markers, and interruption points.

### StreamPlan.chunks

Exact synthetic stream chunk objects.

```ts theme={null}
chunks: unknown[] | undefined
```

### StreamPlan.cutAfter

Cut the stream after this many chunks.

```ts theme={null}
cutAfter: number | undefined
```

### StreamPlan.sseError

Error code to emit in a synthetic SSE error event.

```ts theme={null}
sseError: string | undefined
```

### StreamPlan.after

Chunk count before the scripted event.

```ts theme={null}
after: number | undefined
```

### StreamPlan.errorAfter

Chunk count before the scripted error.

```ts theme={null}
errorAfter: number | undefined
```

### StreamPlan.terminal

Stream terminal event or deliberately missing terminal marker.

```ts theme={null}
terminal: "done" | "response.completed" | "eof" | "error" | undefined
```

### StreamPlan.error

Typed failure information when the operation failed.

```ts theme={null}
error: Record<string, unknown> | undefined
```

## StreamState

The tracked stream lifecycle, including interruption and cancellation.

```ts theme={null}
export type StreamState = "not_stream" | "open" | "complete" | "interrupted" | "errored" | "aborted";
```

## TEST\_HOOKS

Internal hooks a test kit can install (a virtual clock). Keyed by a symbol so it never shows up in autocomplete.

```ts theme={null}
TEST_HOOKS: typeof TEST_HOOKS
```

## TestHooks

Test-only virtual time controls. Production uses real time and sleep.

### TestHooks.sleep

Advance the test clock instead of waiting in real time.

```ts theme={null}
sleep: ((ms: number) => Promise<void>) | undefined
```

### TestHooks.now

Read the test clock in milliseconds.

```ts theme={null}
now: (() => number) | undefined
```

## ToolCallLike

The function name and serialized arguments from a model tool call.

### ToolCallLike.function

Chat Completions tool call.

```ts theme={null}
function: { name?: string; arguments?: string; } | undefined
```

### ToolCallLike.name

Responses function\_call item.

```ts theme={null}
name: string | undefined
```

### ToolCallLike.arguments

JSON argument string, parsed and validated before tool execution.

```ts theme={null}
arguments: string | undefined
```

## Tracked

Provider data and a per-call receipt; consume stream to update streaming receipts.

### Tracked.data

The provider result or facts returned by this operation.

```ts theme={null}
data: T
```

### Tracked.stream

Yields the provider client's own chunk objects, unchanged. Empty for non-stream calls.

```ts theme={null}
stream: AsyncIterable<T extends AsyncIterable<infer C> ? C : never>
```

### Tracked.receipt

A snapshot: final at once for non-stream calls, live for streams.

```ts theme={null}
receipt: Receipt
```

### Tracked.done

Resolves when the stream ends for any reason. Never rejects.

```ts theme={null}
done: Promise<Receipt>
```

## UnknownCostWhy

Why the receipt cannot report a known cost.

```ts theme={null}
export type UnknownCostWhy =
  | "usage_not_requested"
  | "interrupted"
  | "errored"
  | "aborted"
  | "provider_unknown"
  | "not_gateway";
```

## UsageApi

Paginate and read app-user cost aggregates.

### UsageApi.appUsers

Yield each row over all pages in the requested UTC date window.

```ts theme={null}
appUsers(o?: { start?: string; end?: string; limit?: number; }): AsyncIterableIterator<AppUserUsage>
```

### UsageApi.get

Return the first row for a scoped user, or null when they have no calls.

```ts theme={null}
get(o?: { start?: string; end?: string; }): Promise<AppUserUsage | null>
```

## Users

Synthetic user ids mapped to initial facts or fact text.

```ts theme={null}
type Users = Record<string, (string | Fact)[]>;
```

## UserScope

One user in this key's project. Shared clients must stay user-free.

### UserScope.userId

The user attached to this scope, never a shared client default.

```ts theme={null}
userId: string
```

### UserScope.headers

Per-call headers for frameworks: pass them on each call, never on a shared client.

```ts theme={null}
headers(): Readonly<Record<string, string>>
```

### UserScope.client

A cheap copy of your provider client with this user fixed on every request.

```ts theme={null}
client<C extends OpenAILike>(openai: C): C
```

### UserScope.openai

This user's copy of the shared OpenAI client built from `new Atlaso(&#123; OpenAI &#125;)`. Make one per request.

```ts theme={null}
openai(): O
```

With a client of your own, the same as client(openai).

```ts theme={null}
openai<C extends OpenAILike>(openai: C): C
```

### UserScope.anthropic

This user's copy of the shared Anthropic client built from `new Atlaso(&#123; Anthropic &#125;)`.

```ts theme={null}
anthropic(): A
```

A guarded per-user copy of an official Anthropic client you pass.

```ts theme={null}
anthropic<C extends AnthropicLike>(client: C): C
```

### UserScope.memory

Memory metadata or operations scoped to this user.

```ts theme={null}
memory: MemoryApi
```

### UserScope.usage

Usage for this one scoped app user.

```ts theme={null}
usage(o?: { start?: string; end?: string; }): Promise<AppUserUsage | null>
```

### UserScope.tools

Memory tools bound to this scope.

```ts theme={null}
tools: MemoryTools
```

### UserScope.createBrowserToken

Mint a short-lived token for this user on your server.

```ts theme={null}
createBrowserToken(options?: BrowserTokenOptions): Promise<BrowserToken>
```

### UserScope.revokeBrowserTokens

Revoke this user's active browser tokens on your server.

```ts theme={null}
revokeBrowserTokens(): Promise<BrowserTokensRevoke>
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.