package chatoyant
Build not yet checked sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
- 0.18.0 — 2026-11-18
- 0.17.4 — 2026-11-12
- 0.17.3 — 2026-11-11
- 0.17.2 — 2026-11-10
- 0.17.1 — 2026-11-05
- 0.17.0 — 2026-11-04
- 0.16.1 — 2026-10-29
- 0.16.0 — 2026-10-27
- 0.15.0 — 2026-10-24
- 0.14.0 — 2026-08-15
- 0.13.0 — 2026-08-11
- 0.12.5 — 2026-07-10
- 0.12.4 — 2026-07-10
- 0.12.3 — 2026-07-10
- 0.12.2 — 2026-07-09
- 0.12.1 — 2026-07-03
- 0.12.0 — 2026-07-02
- 0.11.1 — 2026-04-15
OCaml-first LLM SDK with Melange-generated JavaScript
Install
dune-project
Dependency
Authors
Maintainers
Sources
chatoyant-v0.18.0.tbz
sha256=3c003dd1e14cfa4656de04ab97118dac151be5233df885eab5b09744584a745b
sha512=510b59defbbf182697947937b33e3a3546ab5796a0962f1126d5fa8ec813ca891a655376853115676a40c72b1780b381603d7feca0a78f1f638e7535fec51686
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.18.0 — 2026-11-18
Added
- OpenAI
gpt-6.2-astraandgpt-6.2-solpricing (8/40/0.40 and $2/10/$0.10 per million tokens, Standard tier) and 1,050,000-token context windows, plus pricing forgpt-6.2-astra-law.
Changed
- Presets follow the providers' current recommendations: OpenAI
bestandreasoningnow resolve togpt-6.2-astra(wasgpt-6-astra),balancedtogpt-6.2-sol(wasgpt-6.1-sol); Anthropicbestandreasoningtoclaude-fable-5-2(wasclaude-fable-5-1). Each new target is cheaper per token than the model it replaces. Pass the old model id explicitly to keep the previous behaviour.
0.17.4 — 2026-11-12
Fixed
- Preserve OCaml Anthropic signed thinking and redacted blocks in tool continuations, saved sessions, model changes, and streaming replay without changing existing public record or variant types.
- Add the official Anthropic model id
claude-mythos-5at $10 input / $50 output / $1 cache hits / $12.50 5m and $20 1h cache writes per 1M tokens, with its 1M context window, in OCaml and JavaScript. Cost estimates previously fell back to Claude Fable 5.1 and undercounted cache hits at $0.25.
0.17.3 — 2026-11-11
Added
- Add the official OpenAI model id
gpt-5.5-cyber-previewat $12.50 input / $75 output / $1.25 cached per 1M tokens, matching the published Daybreak short-context price so cost estimates no longer fall back to GPT-5.4.
Fixed
- Keep the JavaScript result and
toJSON()message shape unchanged for Anthropic responses without thinking blocks;providerReplayis now only attached when a response containsthinkingorredacted_thinkingblocks.
Changed
- Cache the parsed JSON Schema per schema object in JavaScript
validate, so repeated validation against the same schema skips re-parsing.
0.17.2 — 2026-11-10
Added
- Add matching OCaml and JavaScript prices for GPT-6 Cyber, Claude Fable/Mythos 5.2, and Muse Ember 1.0 (up to 200K input tokens), plus the confirmed 1M context windows for Fable/Mythos 5.2. Existing presets remain unchanged.
- Add context windows for GPT-6 Cyber and Muse Ember.
Fixed
- Preserve Anthropic thinking blocks, including signatures, when JavaScript chat sessions replay tool calls; OCaml provider types carry signed thinking blocks too.
0.17.1 — 2026-11-05
Fixed
- Translate JavaScript chat structured output formats when requests route to the Responses API.
- Update xAI Imagine quality/pro estimates to $0.04 per image after their November 2 redirect to Imagine 2.0 low billing.
0.17.0 — 2026-11-04
Added
- Export
ChatJSONfor serialized conversation state and use it as the return type ofChat.toJSON().
Fixed
- Pricing for OpenAI's GPT-6 Rosalind (
gpt-6-rosalind,15 / $75 / $1.50 cached per 1M tokens, released 2026-10-30), `gpt-rosalind-research` and `gpt-rosalind-discovery` (5 /25 / $0.50), and the `gpt-6-astra-law` configuration (10 / $50 / $1). They used to fall back to thegpt-6.1-solorgpt-5.4family price, which undercounted Rosalind cost by 7.5x. OCaml and JS tables match.
0.16.1 — 2026-10-29
Fixed
- JS
getPricing:grok-4-1-fast-reasoningoutput is $0.50 per 1M tokens (was $1.50), and seven older Claude models (Fable 5, Opus 4.6 to 4.8, Sonnet 4.5/4.6, Haiku 4.5) now carry their 1-hour cache-write price, matching the OCaml tables.
Tests
npm run test:models(scripts/check-model-parity.mjs) compares every OCaml and JS pricing row, context window and preset and fails CI on any drift.--jsonprints the merged table.
Docs
- Add a measured JavaScript LLM SDK size guide with a typechecked example, a JSON snapshot and
scripts/measure-sdk-size.mjsfor reruns. - Docs site: bar charts under the intro of the SDK size page (from
doc/data) and the OCaml guide (per-request cost fromlib/tokens/pricing.ml); tables and long inline code no longer widen phone layouts, and the footer stays at the bottom on narrow screens.
0.16.0 — 2026-10-27
Added
- OpenAI
gpt-6.1-terra: pricing, context window, detection and request shaping in OCaml and JavaScript; presets are unchanged. - Optional OCaml
?anthropic_versionon the native Anthropic constructors, plusAnthropic.Http_with_versionfor functor users. The default remains2023-06-01. - Sitemap URLs include source-specific git modification dates; documentation CI fetches full history.
Changed
- CI tests Node 22 and 24 and removes the deprecated setup-ocaml
dune-cacheinput.
Docs
- New guide: Call GPT-6, Claude 5.5 and Grok 4.7 from OCaml with Eio. Its code blocks are compiled from
examples/ocaml_llm_guide. - Docs site: every page now has
lang, a canonical URL, a description and Open Graph tags; the build also writesrobots.txt,sitemap.xmlandllms.txt. Logo served as a 7.5 KB WebP instead of the 565 KB PNG, solid title colours instead of the animated gradient, reduced-motion support,font-display: swap, unique ids and labelled permalinks on API pages.
0.15.0 — 2026-10-24
Model data checked against the OpenAI, Anthropic, xAI and Meta pricing and model pages on 2026-10-24.
Changed
Presets now point at each provider's current models. If you use
fast,cheap,balanced,bestorreasoning, your requests will go to a different model after upgrading:- OpenAI:
fastgpt-5.6-luna -> gpt-6-luna,cheapgpt-5.4-mini -> gpt-6-luna,balancedgpt-5.6-terra -> gpt-6.1-sol,bestgpt-5.6-sol -> gpt-6-astra,reasoninggpt-5.5-pro -> gpt-6-astra. - Anthropic:
fastandcheapclaude-haiku-4-5 -> claude-haiku-5-5,balancedclaude-sonnet-5 -> claude-sonnet-5-5,bestandreasoningclaude-fable-5 -> claude-fable-5-1. - xAI:
fastandcheapgrok-4-1-fast-non-reasoning -> grok-4.20-0309-non-reasoning (xAI no longer lists the 4.1 Fast models),bestandreasoninggrok-4.5 -> grok-4.7.balancedstays on grok-4.3. - Meta: all presets muse-spark-1.2 -> muse-spark-1.3.
- OpenAI:
Price updates (input / output / cached input, USD per 1M tokens):
- gpt-5.6-sol 5 / 30 / 0.50 -> 4 / 20 / 0.40. This is OpenAI's promotional price, which runs until at least 2026-11-21.
- gpt-5.6-terra 2.50 / 15 / 0.25 -> 2 / 12 / 0.20
- gpt-5.6-luna 1 / 6 / 0.10 -> 0.20 / 1.20 / 0.02
- gpt-4-turbo and gpt-4-turbo-2024-04-09 5 / 15 -> 10 / 30
- claude-sonnet-5 3 / 15 / 0.30 -> 2 / 10 / 0.20, cache writes 3.75 / 6 -> 2.50 / 4. The old introductory price is now the regular one.
- grok-4.5 cached input 0.50 -> 0.30
- Unknown model ids are priced like the current model of their family: Claude Opus/Sonnet/Haiku/Fable fall back to the 5.5 and 5.1 models,
gpt-6*to gpt-6.1-sol, othergrok-*ids to grok-4.7,muse-*to muse-spark-1.3 or muse-wonder-1.0. Before, anygpt-*id with an "o" in it was priced as gpt-4o; now onlygpt-4o*ids are. - GPT-6 requests no longer send temperature or top_p. GPT-6 Astra and GPT-6.1 Sol don't accept reasoning
none, sooffandminimalare sent aslowfor those two. In the JavaScript package, tool calls to Astra and 6.1 Sol use the Responses API, which those models require for tools. - Claude Opus/Sonnet/Haiku 5.5 and Fable/Mythos 5.1 never get a
thinking: disabledconfig, since they always think. Claude Opus 5 is handled like Opus 4.7/4.8. - The OCaml OpenAI provider also drops frequency and presence penalties for models that don't accept sampling parameters.
- The JavaScript price and context-window tables now include every model the OCaml tables have.
Added
- Pricing, context windows and provider detection for gpt-6-astra, gpt-6.1-sol, gpt-6-sol, gpt-6-luna, gpt-5.6-cyber, gpt-5.5-cyber, gpt-5.3-codex, chat-latest, gpt-5-search-api, claude-fable-5-1, claude-mythos-5-1, claude-opus-5-5, claude-opus-5, claude-sonnet-5-5, claude-haiku-5-5, grok-4.7, grok-4.6, grok-build-0.1, grok-imagine-image-2.0, grok-imagine-image-quality, grok-imagine-video-1.5, grok-imagine-video-1.5-lite, muse-spark-1.3, muse-spark-1.3-contributor and muse-wonder-1.0.
Notes
- Cost estimates use the standard price. The higher long-context rates (OpenAI above 272K input tokens, xAI at 200K+ prompt tokens, Claude Haiku 5.5 above 100K) are not applied.
- These ids are retired on the providers' own APIs but still resolve for pricing and detection: claude-opus-4-1, claude-opus-4, claude-sonnet-4, claude-3-5-haiku and the other claude-3 models; grok-4-1-fast-, grok-code-fast-1, grok-3 and grok-4-0709.
0.14.0 — 2026-08-15
Added
- Image and file attachments on messages, across providers and both languages. Messages carry provider-neutral attachments (
kind: "image" | "file", sourced from a URL, base64 data + media type, or a provider file id), and each adapter renders them into its native wire blocks: OpenAI/Meta Chat Completions content parts and Responses input items, Anthropic image/document blocks (typedImage/Documentcontent-block variants in the OCaml client), and xAI image parts. In JavaScript,chat.user(text, { images, files, attachments, metadata })attaches media (a plain second argument keeps its legacy metadata meaning); in OCaml,Message.user ~attachments/Chat.user ~attachments. Attachments round-trip through session serialization. Combinations a wire cannot express fail with descriptive typed errors instead of provider 400s (image-by-file-id and file-by-URL on chat completions point at the Responses API; xAI is images-only). - Files APIs: upload once, reference forever.
uploadFile,listFiles,getFile, anddeleteFileon theOpenAI,Meta, andAnthropicnamespaces (multipart uploads from a Blob/File or{ data, filename, mediaType }; OpenAI/Meta default to theuser_datapurpose). Anthropic'sfiles-api-2025-04-14beta header is applied automatically — on file operations and whenever a message references a file id. File-id attachments keep multi-turn conversations cheap: history re-sends only the id, never the bytes. - Typed Responses API surface.
OpenAI.createResponseandMeta.createResponseaccept messages (attachments included) and return the normalized generation result with usage detail (cached and reasoning tokens);responseStructureddoes structured output through the Responsestext.formatwith OpenAI-strict projection and schema validation — a returned object is a validated object. Replaces hand-rolledrequest("/responses", ...)calls.
Fixed
- Provider HTTP failures throw
ProviderErroreverywhere. Chat, streaming, and raw-request paths previously threw plainErrors despite the documentedProviderErrorcontract. Failures now carrystatusand the provider envelope'serrorType/errorCode/errorParamplus the parsed body inraw, with the message text unchanged, so existingcatchlogic keeps working.ProviderError.unknownProviderlists the current model signatures (includingmuse) instead of a stale hardcoded set.
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
- 0.18.0 — 2026-11-18
- 0.17.4 — 2026-11-12
- 0.17.3 — 2026-11-11
- 0.17.2 — 2026-11-10
- 0.17.1 — 2026-11-05
- 0.17.0 — 2026-11-04
- 0.16.1 — 2026-10-29
- 0.16.0 — 2026-10-27
- 0.15.0 — 2026-10-24
- 0.14.0 — 2026-08-15
- 0.13.0 — 2026-08-11
- 0.12.5 — 2026-07-10
- 0.12.4 — 2026-07-10
- 0.12.3 — 2026-07-10
- 0.12.2 — 2026-07-09
- 0.12.1 — 2026-07-03
- 0.12.0 — 2026-07-02
- 0.11.1 — 2026-04-15