package chatoyant
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
OCaml-first LLM SDK with Melange-generated JavaScript
Install
dune-project
Dependency
Authors
Maintainers
Sources
chatoyant-v0.13.0.tbz
sha256=1f84c5229b2d58ec6264dd651a58f2686130afa6e91989f110aa7aaf10bba0f5
sha512=49142e122dbb44b03f7f27b52839492800332207d0efeacc7451173827c899a9b965b671a3d9028cc05250aaebbc6789d3815a6cf356f4319bc0c1b0454c68dd
doc/CHANGELOG.html
Changelog
All notable changes to this project are documented here. The format follows Keep a Changelog, and the project adheres to Semantic Versioning.
0.13.0 — 2026-08-11
Added
- Meta Model API (Muse Spark) as a first-class provider. Provider id
metawith model detection formuse-*, served athttps://api.meta.ai/v1(META_API_KEY, with Meta's ownMODEL_API_KEYhonored as a fallback). The native OCaml adapter (Chatoyant_provider.Meta, plusChatoyant.meta/Chat.meta/Provider.metain the Eio runtime) rides the OpenAI-compatible/v1/responsesprotocol and reuses the OpenAI serializers; the JavaScript package integrates through the shared OpenAI-compatible machinery, namespace (Meta,MetaClient,createMetaClient,META_MODELS), presets, pricing, and context windows included. Muse Spark's wire rules are applied automatically in both worlds: reasoning cannot be disabled (reasoning: "off"omits the field;minimal–xhighpass through),stopsequences and non-"auto"tool choices are dropped instead of failing the request with the API's 400,maxTokensmaps tomax_completion_tokenson chat completions, sampling parameters pass through, structured output uses the strict schema paths, andwebSearch: trueruns the built-inweb_searchtool on/v1/responses. All three hosted models are priced (1.25/4.25 per MTok, cached $0.15; 1,048,576-token context):muse-spark-1.2,muse-spark-1.1, andmuse-spark-1.2-contributor— the discounted contributor tier permits Meta to train on request data, so presets always resolve to the standardmuse-spark-1.2and never select it.
0.12.5 — 2026-07-10
Fixed
- Function tools no longer 400 under strict mode. The JS package sent every tool with
strict: truebut left the parameters schema unprojected — any tool with an optional parameter (or a nested object) violated OpenAI's strict-schema rules (exhaustiverequired,additionalProperties: falseat every level) and the request failed on every model. Tool parameter schemas are now OpenAI-strict-projected like the native OCaml provider has always done, on both/v1/chat/completionsand/v1/responses; if a schema cannot be projected it is sent withoutstrictinstead of as a request the API rejects. Optional parameters declared via field descriptors (Schema.String({ optional: true })) or the plain shorthand ({ type: "string", optional: true }) reach the wire as nullable and stay legal for local argument validation — the executor sees the parameter asnullor absent, as before. The shorthand'soptionalmarker no longer leaks into wire schemas (it is not a JSON Schema keyword), and Anthropic tool schemas keep their partialrequireduntouched. - Provider-client tool and structured surfaces restored to the 0.11.x contracts.
chatWithTools/messageWithToolsaccept plain tool definitions again (with or withoutexecute, including wire-format{ type: "function", function }), send them projected, and return the model's tool calls to the caller from a single request instead of throwing (Tool execute function is required) or running the executing tool loop.chat({ tools })with definition-only tools makes a single request and returns the calls instead of throwing.chatStructuredprojects{ name, schema }wrappers before sending them strict (previously the wrapper's schema went raw withstrict: true— the same rejection class as the tool bug).Anthropic.messageStructured/chatStructureduse a forced tool again instead of sending an OpenAIresponse_formatpayload the Anthropic API rejects.tool_choicenow also carries over (in flat form) when tool requests route through/v1/responses.
0.12.4 — 2026-07-10
Fixed
generateData/genDataenforce structured output again. The JS compatibility path ignored the schema entirely — it sent a plain text request and silently returned prose whenJSON.parsefailed. With a schema it now requests strict structured output (OpenAI-strict-projectedresponse_formatfor OpenAI-compatible providers, a forced tool for Anthropic — the 0.11.x contract), validates the parsed object against the schema, and throws on non-conforming output instead of degrading to text. Without a schema the legacy parse-or-passthrough behavior is unchanged.- Sampling parameters no longer 400 on locked OpenAI generations. The gpt-5 (5.0), gpt-5.5, gpt-5.6, and o-series models reject
temperature,top_p,frequency_penalty, andpresence_penalty(only defaults are supported) on both/v1/chat/completionsand/v1/responses; the 5.1–5.4 generations accept them. Both the JS package and the native OCaml provider now omit these parameters for locked models, socreativitypresets and streaming defaults work across the whole model range.
0.12.3 — 2026-07-10
Fixed
- gpt-5.6 function tools no longer 400. OpenAI applies a server-side reasoning default to the gpt-5.6 family that
/v1/chat/completionsrejects in combination with function tools. The JS package now sends an explicitreasoning_effort: "none"on tool requests when no reasoning is asked for (OpenAI's documented remedy), and routes tool requests with active reasoning (reasoning: "low" | "medium" | "high") through/v1/responses, which supports the combination — matching the native OCaml provider, which already lived on that endpoint. Verified live against the API. maxTokensworks on gpt-5.x / o-series chat requests. These models reject the legacymax_tokensparameter; the JS package now sendsmax_completion_tokensfor them (older models keepmax_tokens).
0.12.2 — 2026-07-09
Added
- New models (July 2026 launches): OpenAI GPT-5.6 family (
gpt-5.6-sol,gpt-5.6-terra,gpt-5.6-luna) plusgpt-5.5/gpt-5.5-pro; Anthropicclaude-fable-5,claude-opus-4-8,claude-opus-4-7, andclaude-sonnet-5; xAIgrok-4.5andgrok-4.3— with pricing, context windows, and model registry entries. - Anthropic request shaping per model generation. Claude 4.7+/Sonnet 5 requests use adaptive thinking (
{type: "adaptive", display: "summarized"}) withoutput_config.effort, and droptemperature/top_p(rejected with a 400 upstream); Fable 5 never sends a disabled thinking config. Older models keep the legacybudget_tokenssurface unchanged.
Changed
- Presets track the current generation:
best/balanced/reasoningnow resolve togpt-5.6-sol/gpt-5.6-terra/gpt-5.5-pro(OpenAI),claude-fable-5/claude-sonnet-5/claude-fable-5(Anthropic), andgrok-4.5/grok-4.3/grok-4.5(xAI); OpenAIfastisgpt-5.6-luna. - Pricing corrections: grok-4.20 dropped to
1.25/2.50 per MTok (cached $0.20) and its context window is 1M, matching xAI's current sheet.
0.12.1 — 2026-07-03
Fixed
- opam lower-bounds: constrain the TLS/crypto/HTTP stack (
tls,tls-eio,x509,ca-certs,mirage-crypto-rngto>= 1.0.0;cohttp-eioandhttpto>= 6.0.0). The native runtime uses the result-returningTls.Config.clientintroduced in tls 1.0, so pre-1.0 versions no longer resolve. - opam sandbox: the Eio HTTP transport test (
test_eio) moves from@runtestto a dedicated@integrationalias. It binds a local socket, which the network-less opam sandbox rejects (bind: EPERM); CI andmake teststill run it viadune build @integration.
0.12.0 — 2026-07-02
Changed
- Rewrote Chatoyant as an OCaml-first SDK. The library now exposes a native Eio API with result-returning calls and
.mlicontracts. The npm package is generated from the OCaml implementation with Melange and bundled with esbuild, and has no runtime npm dependencies. - JavaScript imports move to the package root. The former subpath entry points (
chatoyant/core,chatoyant/schema,chatoyant/tokens,chatoyant/providers/*) are collapsed into root exports and namespace objects. This is a breaking change for JavaScript consumers. - Provider errors are consolidated into
ProviderError. The per-provider error classes and guards (OpenAIError/isOpenAIError,AnthropicError,XAIError,LocalError, ...) are gone; catchProviderErrorand branch on itsproviderfield instead. - Low-level helper exports are removed. The preset lookup tables and helpers (
MODEL_PRESETS,CREATIVITY_PRESETS,REASONING_PRESETSand friends) are no longer exported — themodel: "fast",creativity, andreasoningoptions still resolve exactly as before. The per-provider SSE/accumulator toolkit (parseSSEStream,createAccumulator, ...),chatStreamToWritable/messageStreamToWritable, andbuildHeaders/buildUrlare internal now; use thechatStream*/messageStream*namespace methods. - The TypeScript type vocabulary is rebuilt. Provider wire types and per-call option interfaces from the old package are replaced by a smaller set of provider-neutral types (
GenerationOptions,GenerationResult,Usage,ProviderId, schema/JSON Schema types). Model name unions widen tostring. Some names change:MessageRole→Role,GenerateOptions→GenerationOptions,SchemaConstructor→SchemaClass,InferSchema→InferSchemaInstance/InferSchemaInput.
Added
- Native OCaml provider clients for OpenAI, Anthropic, xAI, OpenRouter, and local OpenAI-compatible servers.
- A standalone Draft 2020-12 JSON Schema parser and validator with OpenAI strict projection and typed OCaml codec generation.
- A
chatoyant.ppxproviding themodule%toolsyntax and[@@deriving chatoyant]codecs.
0.11.1 — 2026-04-15
- Final release of the TypeScript implementation. Earlier changelog history is available in the Git log prior to the OCaml port.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page