Portable Common Lisp protocols and value types for language-model providers and bounded inference inputs.
The library defines semantic provider events and results, concrete wire clients, context assembly, structured-output contracts, shared inference budgets, read-only views, content-addressed context objects, and a layered provider registry with model discovery. Applications own credential stores, cache storage, prompt policy, conversation projection, and tool dispatch.
- ASDF system:
cl-llm-provider-api - Optional concrete protocols:
cl-llm-provider-api/wire - Optional HTTP condition adapter:
cl-llm-provider-api/dexador - Optional provider registry:
cl-llm-provider-api/registry - Test system:
cl-llm-provider-api/tests - Package:
CL-LLM-PROVIDER-API - Nickname:
LLM-PROVIDER-API
Load cl-llm-provider-api/wire for provider-usage-snapshot and
provider-usage-merge. Snapshots contain reported nonnegative integer token
counters in detached string-keyed association lists, including supported nested
cache and token details. Each field lookup examines at most 64 association-list
cells; the fixed schema bounds retained fields and nesting. Missing counters
are unknown, distinct from reported zero. Integer counters and sums are exact.
Merge adds every supplied observation, including repeated identical values.
Callers decide which observations represent separate billable work. Snapshotting
preserves reported aliases without inferring missing totals or retaining provider
metadata; provider-usage-normalize serves the broader normalization contract.
Load cl-llm-provider-api/wire for schema-based argument helpers. Schemas and
arguments use JSON objects (string-keyed hash tables), arrays use vectors, null
uses nil, and false uses :json-false. Yason boolean markers are also
accepted by these helpers.
provider-schema-argument-diagnosticchecks unknown fields before missing requirements. Only explicitadditionalProperties: falsecloses an object;patternPropertiesleaves name validation to the caller. Supply:allowed-extra-namesfor application-owned metadata. Required fields check presence, including explicit false and null. Alternative requirement groups record:one-ofor:any-ofwithout claiming full combinator validation.provider-schema-argument-retryreturns a detached diagnostic skeleton. It preserves explicit values, renames only unique noncolliding suggestions, and inserts placeholders for absent requirements. Applications decide how to present the skeleton; it is never dispatched automatically.provider-schema-argument-valuereturns the selected value, its original supplied-p flag, and a diagnostic ornil. A schema default applies only when absent and is checked like an explicit value. An absent field without a default returns threenilvalues. Defaults are copied before checking.
Selected-field checks support integer, string, boolean and array types, or a
vector containing one supported type and "null". Supported assertions are
enum (case-sensitive JSON equality), minimum=/=maximum for integers,
minLength=/=maxLength for strings, minItems=/=maxItems and recursively checked
items for arrays. title, description and default are annotations.
Unsupported types, assertions, or incompatible assertion/type combinations
return :unsupported-contract, including item contracts on empty arrays.
Diagnostics contain codes, field/index paths, names, suggestions and requirement groups, never argument values. Applications retain dispatch, authorization, telemetry and domain-specific checks such as file paths and session ownership.
Use VERTEX-GEMINI-PROVIDER for Gemini and VERTEX-ANTHROPIC-PROVIDER
for Claude. Supply :project and optionally :location (default "global")
and :quota-project. Load cl-llm-provider-api/dexador for the streaming
transport. Both clients reuse their native request encoders and stream parsers.
(make-instance 'cl-llm-provider-api:vertex-gemini-provider
:project "my-project" :location "global")
(make-instance 'cl-llm-provider-api:vertex-anthropic-provider
:project "my-project" :location "us-east5")For local credentials, run gcloud auth application-default login.
GOOGLE-CLOUD-DEFAULT-CREDENTIALS-PATH locates the ADC file, honoring
GOOGLE_APPLICATION_CREDENTIALS and CLOUDSDK_CONFIG before the standard
Cloud SDK directory. GOOGLE-CLOUD-USER-CREDENTIALS takes that pathname and
an injected HTTP function accepting a URL, :headers, and a form-parameter
alist as :content. The function must return a JSON string and HTTP status.
Each call exchanges the user refresh token at Google’s fixed OAuth endpoint.
Only authorized_user ADC files are supported. Credential files are read-only;
no tokens are cached or saved. Keep acquisition and use inside the host’s
credential scope, including PROVIDER-EXECUTE-REQUEST’s :secrets argument.
Pass the returned GOOGLE-CLOUD-CREDENTIALS to
VERTEX-OPEN-RESPONSE-STREAM through :credentials. The ADC quota project
becomes x-goog-user-project unless overridden with :quota-project.
Alternate transports can use VERTEX-REQUEST-URL, VERTEX-REQUEST-BODY,
and VERTEX-REQUEST-HEADERS. Model identifiers travel in the URL, not the
HTTP body; Claude’s anthropic_version travels in the body.
Load cl-llm-provider-api/wire for Responses, Chat Completions, Anthropic
Messages, and Gemini GenerateContent encoding and stream assembly. Use hash tables for JSON objects, vectors
for arrays, and portable Responses-shaped transcript items. Subclass the existing
provider classes to specialize wire naming, instruction placement, and provider
metadata without introducing application objects into the wire layer.
Construct WIRE-REQUEST with :model, :items, :prefix, :suffix, and an
:options property list. Supply already-projected history and instruction texts.
Call PROVIDER-REQUEST-OBJECT with a provider, the projection, and tool vector.
Responses accepts namespace declarations; Chat Completions and Messages accept
encoded tools. Use PROVIDER-WIRE-TOOLS for protocol-specific tool projection.
Shared options include :maximum-output-tokens and :tool-choice. A
:tool-choice of :none keeps the tool definitions, and so the cached prefix
they start, but asks the model to answer without calling one; the default is
:auto. A list of a namespace and a tool name, such as ("fs" "read"), makes
the model call that tool; Messages also turns parallel calls off for such a
request. Responses additionally accepts
:reasoning-effort, :reasoning-summary, and :fields (alternating wire keys and
values). Chat accepts :stream-usage-p, :reasoning-parameter,
:reasoning-effort, :output-ceiling-field, and :cache-breakpoint-fields:
alternating wire keys and values, such as "cache_control" and its object,
added to the last text part of the system message and of the final durable
history message, before the trailing context. Chat and Messages accept
:shared-items, durable items before the history that sibling requests repeat,
such as documents several questions read. They end at their own cache
breakpoint, so a sibling with different history still reuses them. Chat and
Messages also accept :ephemeral-items, the exchanges that last one response.
They follow the durable history, past its cache breakpoint. Messages also accepts :cache-p
and :cache-ttl, a lifetime such as "1h" given to every cache marker; NIL
keeps the five-minute default.
Messages projects root oneOf, allOf, and anyOf tool-schema constraints into
an input_schema.description annotation because Anthropic rejects those keywords
at the root. Nested composition, properties, and unconditional requirements are
preserved. Validate returned arguments against the original schema in your tool
dispatcher; the wire schema is a less restrictive projection.
Call PROVIDER-EXECUTE-REQUEST with :transport, :event-callback, and optional
:secrets, :cleanup, :call-with-deadline, and :completion hooks. The transport
accepts the request object and returns a stream, HTTP status, and response headers.
The library normalizes HTTP and terminal failures and redacts supplied secrets
from detached headers, events, results, and diagnostics. Use :cleanup to dispose
of each acquired stream; the default abort-closes it. Cleanup is best effort:
its errors and deadline failures do not replace the request outcome. Completion
runs after valid terminal consumption and cleanup.
Load cl-llm-provider-api/dexador and wrap the request thunk with
PROVIDER--CALL-WITH-TRANSPORT-NORMALIZATION to classify socket, TLS, and deadline
conditions from transport opening and SSE line reads. Application callbacks run
outside that classifier. Pass :terminal-errors-p t only when wrapping a transport
opening directly. Convert Dexador HTTP conditions with PROVIDER-SIGNAL-HTTP-FAILURE.
Supply credentials and authenticated request headers from the application.
Resampling and transient retries use separate budgets in CALL-WITH-BOUNDED-RETRIES.
Supply :maximum-retries, :delay-function (retry number and condition), and
:call-with-attempt for a custom delay policy or attempt scope.
Create bounded CONTEXT-CONTRIBUTION values with MAKE-CONTEXT-CONTRIBUTION.
Use MAKE-CONTEXT-RESOLVER and CONTEXT-RESOLVE to select contributions by
lifetime, supersession, deduplication, conflict group, mandatory class, priority,
and available budget. A CONTEXT-SELECTION includes selected and omitted values.
Call CONTEXT-SELECTION-COMPLETE only after a successful request to acknowledge
successful-delivery lifetimes. Applications supply request identity, token costs,
rendering, and evidence trust boundaries.
Use OUTPUT-SCHEMA-NORMALIZE for the supported native schema subset and
OUTPUT-SCHEMA->JSON for its JSON representation. Validate values with
OUTPUT-SCHEMA-VALID-P. Decode exact JSON through OUTPUT-JSON-DECODE and
convert portable tagged values through OUTPUT-JSON->SEXP and
OUTPUT-SEXP->JSON. Object properties and required keys, arrays, scalar JSON
types, enums, alternatives, and additional-property constraints are supported.
Invalid contracts and values signal OUTPUT-CONTRACT-ERROR and
OUTPUT-VALUE-ERROR with field diagnostics.
The wire and contract string codecs use Argo’s exact RFC 8259 document
parser. Wire values use :json-false, NIL, and vectors for false, null,
and arrays. Contract values use yason:false, :null, and vectors;
portable tagged trees use NIL, :null, and (:array ...). The wire
stream adapter consumes one value at a time through Yason. Parser policy
bindings do not change the object, array, true, or null representations.
OUTPUT-TEXT-ANSWER reads a model’s free-text answer against a schema: it finds
one JSON value in the text, tolerating prose and code fences around an object or
array, validates it, and returns the tagged value, whether it was valid, and
otherwise a sentence asking the model to repair the answer. OUTPUT-TEXT-JSON
is the extraction alone. OUTPUT-JSON-SCHEMA->SCHEMA imports a JSON Schema
object into the native subset, the reverse of OUTPUT-SCHEMA->JSON.
All values are ordinary CLOS instances created with MAKE-INSTANCE.
PROVIDER-EVENTis the root event class.ASSISTANT-DELTA-EVENTandREASONING-DELTA-EVENTcarry streamed text.PROVIDER-ITEM-EVENTcarries one completed provider-native item.PROVIDER-COMPLETED-EVENTcarries response identity, usage, and turn state.PROVIDER-RETRY-EVENTcarries bounded reconnect metadata.PROVIDER-RESULTcarries ordered output items, tool calls, usage, routing state, and:CONTINUE,:END, or:UNSPECIFIEDturn completion.
(make-instance 'llm-provider-api:provider-result
:response-id "response-1"
:output-items (list message)
:tool-calls calls
:usage '(:total-tokens 42)
:turn-completion :end)Output items and usage metadata deliberately have type T. A provider may use
hash tables, association lists, structures, or application-specific objects.
The wire clients emit PROVIDER-RESPONSE-METADATA-EVENT when observed response
metadata changes. Read its immutable accumulated snapshot with
PROVIDER-RESPONSE-METADATA-EVENT-METADATA. The same final snapshot is available
through PROVIDER-COMPLETED-EVENT-METADATA and PROVIDER-RESULT-METADATA.
PROVIDER-RESPONSE-METADATA has readers ending in -MODEL, -FINISH-REASON,
-CACHE-WRITE-TOKENS, and -USAGE-OBSERVED-P. The model comes only from the
response envelope, with its original spelling. Finish reasons retain protocol
spelling, including unsuccessful terminal reasons. An absent model or reason is
NIL. Cache-write tokens are NIL when unreported and 0 when explicitly
reported as zero. Usage observation is independent of cache-write presence.
Omitted fields in later chunks do not erase earlier observations.
Metadata events precede terminal validation, so keep the last snapshot in an
attempt-local callback when collecting metadata from failed streams. Each
PROVIDER-CONSUME-STREAM starts fresh. Metadata events do not count as streamed
assistant output for retry budgets. Gemini envelope adapters use
PROVIDER-GEMINI-STREAM-RESPONSE before metadata extraction, including Code Assist.
Specialize PROVIDER-CACHE-WRITE-TOKENS on a service adapter when wire counters
are synthetic. Its default method preserves explicit zero; an adapter can call
CALL-NEXT-METHOD and return NIL for an unsupported structural zero.
Subclass MODEL-PROVIDER and implement PROVIDER-STREAM-TURN. The callback
receives semantic PROVIDER-EVENT instances and the method returns one
PROVIDER-RESULT.
(defclass example-provider (llm-provider-api:model-provider) ())
(defmethod llm-provider-api:provider-stream-turn
((provider example-provider) conversation
&key tool-namespaces event-callback goal-context compaction-p)
(declare (ignore provider tool-namespaces goal-context compaction-p))
(funcall event-callback
(make-instance 'llm-provider-api:assistant-delta-event
:text "hello"))
(make-instance 'llm-provider-api:provider-result
:output-items (list conversation)
:turn-completion :end))The portable provider protocol also exposes:
PROVIDER-FAMILYPROVIDER-WITH-CONFIGURATIONPROVIDER-CONSUME-STREAMPROVIDER-NATIVE-COMPACT-CONVERSATIONPROVIDER-SET-REASONING-SUMMARIESPROVIDER-OUTPUT-CEILING-PPROVIDER-NORMALIZE-OUTPUT-ITEM
Conservative defaults return :CUSTOM, NIL, the unchanged provider, or the
unchanged item where a safe default exists.
RESPONSES-API-PROVIDER and CHAT-COMPLETIONS-PROVIDER identify common wire
families. PROVIDER-WIRE-PROTOCOL returns :RESPONSES-API,
:CHAT-COMPLETIONS, or :CUSTOM.
Request implementations can specialize:
PROVIDER-WIRE-TOOL-NAME,PROVIDER-WIRE-TOOL, andPROVIDER-WIRE-TOOLSPROVIDER-WIRE-INPUT-ITEMPROVIDER-RESPONSES-WIRE-EFFORTPROVIDER-RESPONSES-REASONING-SUMMARYPROVIDER-RESPONSES-HOSTED-TOOLSPROVIDER-RESPONSES-INSTRUCTIONS-PLACEMENTPROVIDER-RESPONSES-REQUEST-NAMESPACESPROVIDER-RESPONSES-REQUEST-FIELDSPROVIDER-REQUEST-OBJECT
The Responses API default joins a namespace and tool name with a dot. Wire
objects remain application-defined values, so the library does not impose a
JSON representation. Responses instructions use conversation input items by
default. Providers may return :TOP-LEVEL from
PROVIDER-RESPONSES-INSTRUCTIONS-PLACEMENT to use a top-level instructions
request field instead.
A tool whose declaration holds "strict" true is sent as a strict function on
Responses and Chat Completions, where the service then decodes arguments that
match its schema. Give such a tool a closed object schema with every property
required. Messages and Gemini ignore the field.
Other Chat Completions function parameters are non-strict object schemas. The wire
projection collects alternative properties and omits composition, literal and
negation constraints from the root, which the API rejects there. Nested argument
schemas are preserved. Validate tool calls against the original host schema;
the wire projection is a model-facing hint, not an execution validator.
Use OPENAI-COMPATIBLE--WIRE-PARAMETERS when projecting function parameters
for another endpoint with the same object-root restriction.
PROVIDER-DEFERRED-WIRE-TOOLS declares every namespace with
defer_loading functions and adds one client-executed tool_search tool
(PROVIDER-TOOL-SEARCH-TOOL, with a host description). When the model answers
with a call, PROVIDER-TOOL-SEARCH-CALL-P recognizes it and
PROVIDER-TOOL-SEARCH-OUTPUT answers it from the offered namespaces: terms
from the query score exact tool names over name fragments, namespace names and
description words, a term naming a namespace exposes all of it, and at most
*PROVIDER-TOOL-SEARCH-DEFAULT-LIMIT* other tools are returned.
PROVIDER-TOOL-SEARCH-OUTPUT-REPLAY rebuilds a stored output for the next
request, or replays it empty with :TRIMMING-P for compaction.
GEMINI-GENERATE-CONTENT-PROVIDER encodes a projected request as
GenerateContent: prefix texts become the systemInstruction, history items
become contents (calls with decoded args, results as functionResponse
named after their call, reasoning as thought parts, images as inline base64
data), and suffix texts trail as one user content. :MAXIMUM-OUTPUT-TOKENS
and :INCLUDE-THOUGHTS-P fill generationConfig. The SSE consumer streams
thought and answer text, decodes namespaced calls, maps usage, completes on
STOP, and signals an incomplete response for MAX_TOKENS. A host that wraps
each response in an envelope specializes PROVIDER-GEMINI-STREAM-RESPONSE.
Use COPILOT-MODEL-CATALOG to decode tool-capable account models into plists
with :NAME, :PROTOCOL, :DESCRIPTION, :REASONING-EFFORTS, and optional
:CONTEXT-WINDOW. Supply :MODEL-PREFIX for a host namespace and
:PERSONAL-ACCOUNT-P for the individual-account policy fallback. During
explicit login, an optional :ENABLE-MODEL-FUNCTION receives each eligible
unconfigured model ID and returns true after enabling it.
COPILOT-MODEL-PROTOCOL selects Chat Completions, Responses, or Messages.
Use COPILOT-PROTOCOL-ENDPOINT for the corresponding path,
COPILOT-BASE-URL for the token’s trusted proxy host, and
COPILOT-HTTP-HEADERS for catalog requests. For streaming, pass the selected
:PROTOCOL and :INITIATOR to COPILOT-STREAM-HEADERS; image blocks require
an additional vision header. Malformed catalogs, untrusted hosts, and unknown
protocols signal PROVIDER-ERROR. Implement device login, credential storage,
and account policy HTTP requests in the host application.
READ-SSE-DATA decodes one server-sent event’s joined data field from a
character stream. Lines and events are bounded by
*SSE-MAXIMUM-LINE-CHARACTERS* and *SSE-MAXIMUM-EVENT-CHARACTERS*;
violations signal the class named by *STREAM-LIMIT-ERROR-CLASS*,
PROVIDER-STREAM-LIMIT-ERROR by default. A drained stream returns
*SSE-END-OF-STREAM*. Hosts needing runtime-specific inactivity deadlines
install a wrapper as *SSE-READ-LINE-FUNCTION*; cl-llm-provider-api/dexador
provides SSE-READ-LINE-WITHIN-INACTIVITY-DEADLINE, which fails a line that
stalls past *SSE-INACTIVITY-SECONDS* with a retryable
RESPONSE-STREAM-ERROR, because Dexador’s read timeout does not cover the
blocking reads of a TLS stream.
READ-CHARACTER-SEQUENCE fills a string like READ-SEQUENCE using requests
no larger than *CHARACTER-READ-SEQUENCE-WINDOW*, staying on the portable
buffered path on runtimes whose large decoded reads misbehave.
CALL-WITH-BOUNDED-RETRIES retries an attempt function over the
*BOUNDED-RETRY-DELAYS* backoff schedule when it signals
PROVIDER-RETRYABLE-ERROR, reports each wait through PROVIDER-RETRY-EVENT
callbacks, and restarts immediately on PROVIDER-RESAMPLE-REQUESTED. Hosts
bridge their own condition types by inheriting from these classes.
CALL-WITH-STREAMING-RETRIES builds on it for streamed requests. Each attempt
streams through the callback it is handed, so the engine sees whether reasoning,
text or an item arrived before a failure. Failures before generation retry up to
*PROVIDER-MAXIMUM-TRANSIENT-RETRIES* times. Once output has streamed or the
provider reports token exhaustion, only *PROVIDER-MAXIMUM-STREAMING-RETRIES*
retries are allowed, two by default: three attempts including the original.
This also covers exhaustion before visible text, such as a reasoning-only
response. Known token-limit reasons are retryable; filter and unknown reasons
are terminal. Exhaustion of the generation retry budget signals
PROVIDER-STREAM-ABANDONED. Every failed attempt is reported as a
PROVIDER-ATTEMPT-FAILED-EVENT audit record, and waits use jittered exponential
backoff. Hosts can mark other costly failures with :GENERATION-STARTED-P T
on PROVIDER-RETRYABLE-ERROR.
CALL-WITH-CREDENTIAL-REFRESH retries an attempt once with a forced
credential refresh after PROVIDER-UNAUTHORIZED, when the credentials are
refreshable, and hands a final rejection to a host function that signals the
host’s own authentication condition.
RLM-BUDGET-CREATE creates a subtree budget with shared call and token counters
and frame-local recursion depth. RLM-BUDGET-ACQUIRE-REQUEST atomically reserves
one call and a bounded output tranche. Settle it with
RLM-BUDGET-SETTLE-OUTPUT, passing RLM-USAGE-BILLABLE-TOKENS of the reported
usage so prompt-cache reads do not drain the pool. Descendants created by RLM-BUDGET-DESCEND share the
same counters.
(let* ((budget (llm-provider-api:rlm-budget-create
:calls 8 :tokens 80000 :depth 2))
(tranche (llm-provider-api:rlm-budget-acquire-request budget)))
(unwind-protect
(call-provider :maximum-output-tokens tranche)
(llm-provider-api:rlm-budget-settle-output budget tranche usage-total)))Exhaustion signals RLM-BUDGET-EXHAUSTED with a :CALLS, :TOKENS, or
:DEPTH dimension and an optional task label.
RLM-VIEW-MATERIALIZE accepts a string, pathname, RLM-VIEW, or a plist with
:CONTENT or :PATH and an optional :LABEL. RLM-VIEWS-MATERIALIZE numbers
duplicate labels. RLM-VIEWS-RENDER emits digest-delimited read-only blocks.
RLM-CONTEXT-STORE-CREATE opens a directory-backed content-addressed store.
RLM-CONTEXT-INTERN and RLM-CONTEXT-INTERN-PATHNAME publish UTF-8 content
atomically under its SHA-256 digest. Reads and lookups verify the digest and
signal RLM-VIEW-ERROR if stored content is corrupt. Store roots are
canonical absolute directories. Object reads reject noncanonical cache paths,
and passing an object to another store re-interns its verified content there.
(let* ((store (llm-provider-api:rlm-context-store-create #P"context/"))
(object (llm-provider-api:rlm-context-intern
store "large immutable input" :label "corpus")))
(values (llm-provider-api:rlm-context-object-digest object)
(llm-provider-api:rlm-context-object-content object)))Token budgets limit work; money is accounted for apart from them.
make-model-price takes rates per million tokens: :input for uncached
input, :cache-read, :cache-write (both default to the input rate),
:output, a :currency (default "USD") and a :source saying where and
when the rates were taken. Decimal rates are kept as exact fractions.
usage-token-categories splits portable usage into uncached input, cache
reads, cache writes and output. usage-price-amount prices usage under a
price, and usage-reported-cost returns a charge the provider reported, such
as OpenRouter’s cost field in US dollars.
(let ((ledger (make-cost-ledger)))
(cost-ledger-record ledger usage
:price (make-model-price :input 3 :cache-read 0.3
:output 15 :source "vendor page, 2026-10")
:model "some-model" :route "direct")
(cost-ledger-check-limit ledger 5)
(cost-ledger-summary ledger))cost-ledger-record prefers a reported charge, else the estimate. Each entry
has a :basis of :reported, :estimated, :unpriced (no price) or
:unknown (usage without input or output counts). Only the first two add to
the totals; cost-ledger-summary counts the others, so unknown spending stays
visible instead of counting as free. cost-ledger-check-limit signals
cost-limit-reached once a currency’s total reaches a limit.
cl-llm-provider-api/registry keeps provider registrations in ordered source
layers. provider-registry-create names the layers from lowest to highest
precedence, the defaults for models that declare no context window or reasoning
efforts, and three optional host hooks: functions reading and writing the
portable model cache form for a context, and a function told whenever the
effective models may have changed.
provider-registry-register adds or replaces one name in one source. A name
resolves to its highest source, and a later registration wins within one source,
which provider-registry-registrations, provider-registry-find and
provider-registry-for-model report. A registration’s :MODEL-DISCOVERY function
receives the context passed to provider-registry-refresh-models; discovered
models follow the declared ones, a declared model gains a discovered context
window only when it declares none, and refreshes of one provider never overlap.
A failed refresh keeps the previous models and is returned as a
provider-model-discovery-error instead of signaled.
provider-registry-load-model-cache adopts cached models whose provider and
discovery endpoint still match, and provider-registry-snapshot and
provider-registry-restore undo registry changes exactly. Invalid input signals
*provider-registry-error-class*, provider-registry-error unless a host names a
subclass.
cl-llm-provider-api/wire adds model-list-decode, which turns an
OpenAI-compatible /models response into registry model specifications, reading
the context window from whichever of the common field names a catalog uses.
(let ((registry (llm-provider-api:provider-registry-create)))
(llm-provider-api:provider-registry-register
registry "example"
:models '((:name "example-large" :context-window 200000))
:factory (lambda (&rest arguments) (make-example-provider arguments))
:source :builtin)
(llm-provider-api:provider-registry-model registry "example-large"))- Babel
- Bordeaux Threads
- Ironclad
- ASDF/UIOP
./script/bootstrap
./script/check
./script/check --fix./script/check runs the tests, then checks the source with
cheque as cheque.sexp
configures it. --fix skips the tests and repairs what cheque can repair.
cheque and its tools are development dependencies: checks/qlfile lists them,
and the check installs them on first use into ~/.cache/cheque/tools/.
COLL-Attribution, copyright 2026 Lambda Symbolics OÜ. See LICENSE.lisp.
The exported tool helpers provide provider-safe names, JSON Schema builders,
required-argument diagnostics, conservative placeholders, and ordered
namespace grouping without depending on application registry classes.
PROVIDER-TOOL-IDENTIFIER-MAP sanitizes UTF-8 raw names and appends a stable
FNV-1a suffix within the 23-character Chat Completions budget. It signals
specific duplicate, limit, and collision conditions. Use
PROVIDER-ARRAY-SCHEMA and PROVIDER-ENUM-SCHEMA for reusable schema shapes;
their optional descriptions are omitted when NIL.
Encode COPILOT-AUTO-SESSION-REQUEST’s JSON object and POST it to
/models/session. Pass the session response and raw /models catalog to
COPILOT-AUTO-SESSION-MODEL; it returns a concrete model spec and session token.
Send Copilot-Session-Token with the concrete request using that model’s protocol.
Keep the token within the request’s credential scope and include it in redaction.
Use :include-auto-p t with COPILOT-MODEL-CATALOG to expose auto in a picker.
Sources inspected: VS Code Copilot Chat,
src/platform/endpoint/node/automodeService.ts and autoChatEndpoint.ts;
CopilotChat.nvim, lua/CopilotChat/config/providers.lua.