cequence-io/openai-scala-client
68.7
Adequate · 20 September 2026
68.1k
lines of production code
Scala
primary language
1
measurement over time
What this system is
This is a multi-provider Scala client library that unifies interactions with various Large Language Model APIs, including OpenAI, Anthropic, Google Gemini, and AWS Bedrock, under a single OpenAI-compatible interface. It provides comprehensive support for chat completions, streaming responses, structured JSON outputs, and complex tool-use patterns such as Model Context Protocol (MCP) servers and function calling. The system also includes utilities for batch processing, token counting, and evaluation grading, enabling robust, provider-agnostic AI application development in Scala.
How it got here
2023–2024 — multi-provider expansion and domain typing
31 changes.
The project expanded its multi-provider support by introducing dedicated clients for Anthropic and AWS Bedrock, alongside enhanced batch and streaming capabilities for existing providers. A comprehensive domain model overhaul established strongly-typed message hierarchies, structured output via JSON schemas, and unified error handling across the codebase.
2025 — multi-provider expansion and Responses API
32 changes.
This period focused on expanding the library's coverage of external AI providers, introducing native clients for Perplexity Sonar and Google Gemini while adding extensive examples for providers like Groq, Fireworks, and Anthropic. Significant work also went into implementing the OpenAI Responses API, including support for complex tool ecosystems like MCP servers, code interpreters, and file search. The release further enhanced evaluation capabilities with a new grader system and improved resilience through robust JSON serialization and typed error handling across clients.
2026 — New client integrations and AWS SigV4 support
15 changes.
This period focused on expanding the library's ecosystem by introducing dedicated clients for Anthropic Managed Agents, the Claude CLI, and TypeSafe AI System One. It also added core AWS SigV4 authentication support for Bedrock and comprehensive test coverage for these new features alongside existing streaming and routing logic.
Features
AWS Bedrock SigV4 signing and structured error handling for OpenAI-compatible endpoints
The client now supports Amazon Bedrock's OpenAI-compatible API via AWS SigV4 request signing, implemented through a new \SigningWSClientEngine\ that decorates the HTTP engine to sign requests with IAM credentials. Additionally, HTTP error codes (including 408 and 5xx gateway errors) are now mapped to specific, retryable exception types via \HandleOpenAIErrorCodes\, ensuring transient failures are automatically retried.
openai-client/src/main/scala · high confidence
Add support for Model Context Protocol (MCP) tools in the Responses API
The library now includes domain models for integrating with remote Model Context Protocol (MCP) servers via the Responses API. This change introduces \MCPTool\ to configure server connections (via URL or connector ID) and define tool access policies, such as allowing specific tool names or requiring human approval. It also adds data structures for the full MCP tool lifecycle, including \MCPListTools\ for discovering available tools, \MCPToolCall\ for tracking execution status and outputs, \MCPToolError\ for handling both execution and protocol-level errors, and \MCPApprovalRequest\/\MCPApprovalResponse\ to manage human-in-the-loop approval workflows.
openai-core/src/main/scala/io/cequence/openaiscala/domain/responsesapi/tools/mcp · high confidence
Added AWS SigV4 signing and credentials provider in core
The library now includes built-in support for AWS Signature Version 4 authentication. A new \AwsCredentialsProvider\ trait and implementation allow users to supply static credentials or automatically resolve them from standard AWS environment variables (with fallback to existing Bedrock-specific variables), supporting session tokens for temporary credentials. The \AwsSigV4\ object provides the signing logic, enabling requests to AWS services like Bedrock to be signed correctly without external dependencies.
openai-core/src/main/scala/io/cequence/openaiscala/aws · high confidence
Added JSON serialization support for Perplexity Sonar API models
The Perplexity Sonar client now includes dedicated JSON format definitions for its domain models, enabling proper serialization and deserialization of chat completion requests and responses. This change adds support for specific response formats such as \json\_schema\ and \regex\ via the \SolarResponseFormat\ type, and ensures that message roles (system, user, assistant) are correctly mapped to their JSON representations. This infrastructure is required for the client to correctly handle the structured data exchanged with the Perplexity Sonar API.
perplexity-sonar-client/src/main/scala/io/cequence/openaiscala/perplexity · high confidence
Added Scala 2 JSON schema reflection support for structured output
The library now includes a \JsonSchemaReflectionHelper\ and \ReflectionUtil\ implementation specifically for Scala 2, enabling automatic generation of JSON schemas from Scala types (such as case classes, integers, strings, and arrays) for use with structured output features. This complements the existing Scala 3 implementation, allowing users on Scala 2 to leverage type-based schema generation for API interactions.
openai-core/src/main/scala-2 · high confidence
Added Scala 2 example for JSON schema-based chat completions
A new example file, CreateChatCompletionJsonForCaseClass.scala, demonstrates how to use the OpenAI adapter with JSON schema validation in Scala 2. The example defines a case class model (CapitalsResponse containing Country data) and uses JsonSchemaReflectionHelper to generate a JsonSchemaDef, which is then passed to createChatCompletionWithJSON to enforce structured output from the model.
openai-examples/src/main/scala-2 · high confidence
Added TogetherAI example using Llama 4 model
A new example file has been added to the TogetherAI examples directory demonstrating chat completion with the Meta Llama 4 Maverick 17B 128E Instruct model. This example shows how to configure and run a chat completion request using the TogetherAI provider integration.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/togetherai · high confidence
Added streamed support for Chat Completion Tools and Model Responses API
The streaming client now supports streaming responses for chat completions that include tools (via \createChatToolCompletionStreamed\) and for the Model Responses API (via \createModelResponseStreamed\). For tool-based chat completions, the service automatically routes requests through the Responses API when the model and tools require it, ensuring typed tool streaming works correctly. Additionally, streaming for the Model Responses API is now available, allowing users to receive real-time updates for model responses. These changes enhance the client's capability to handle complex, tool-augmented, and response-based interactions in a streaming manner.
openai-client-stream/src/main/scala/io/cequence/openaiscala/service/impl · high confidence
Anthropic Managed Agents domain models
Added Scala case classes and sealed traits for the Anthropic Managed Agents API domain, covering Agents, Deployments, Sessions, Environments, Vaults, Credentials, Memory Stores, and Self-Hosted Work Queues. These types model the request and response schemas for the beta endpoints (agents, sessions, deployments, environments, vaults/credentials, memory stores, and work queues), including tool configurations, permission policies, content blocks, and session events, enabling the client to serialize and deserialize managed-agent resources.
anthropic-client/src/main/scala/io/cequence/openaiscala/anthropic/domain/managedagents · high confidence
Anthropic-specific settings and MCP connector support
Users can now configure Anthropic-specific features via the chat completion settings, including message caching (user and system messages), thinking model budget tokens, and a fast inference mode. The update also introduces support for Anthropic-native tools and remote MCP servers, allowing the client to handle server-side tool calls and automatically continue turns when the API returns a pause\_turn signal.
anthropic-client/src/main/scala/io/cequence/openaiscala/domain · high confidence
Domain model overhaul: typed messages, provider-neutral tools, and batch support
The domain layer has been restructured to replace the generic \MessageSpec\ with a strongly-typed message hierarchy (\SystemMessage\, \UserMessage\, \AssistantMessage\, \ToolMessage\, etc.), introducing a dedicated \DeveloperMessage\ for o1 models and a \Tool\ role. Provider-neutral tool capabilities are now first-class citizens via \ChatCompletionTool\, supporting remote MCP servers (\MCPServerTool\) and agent skills (\SkillTool\) alongside traditional function calling. The API also gains comprehensive batch processing support through \ChatCompletionBatch\ and \Batch\ domain objects, enabling provider-agnostic batch creation and status tracking. Additionally, JSON schema handling is refined with a typed \JsonSchema\ hierarchy (supporting \Integer\/\Number\ bounds) and \AssistantTool\ resources for code interpreter and file search configurations.
openai-core/src/main/scala/io/cequence/openaiscala/domain · high confidence
Expanded Google Vertex AI example coverage with new capabilities and adapters
The Google Vertex AI examples directory has been significantly expanded to demonstrate a wider range of supported features. New examples include batch prediction workflows (both native and via the OpenAI adapter), JSON schema-constrained responses, and streamed chat completions. The examples also now cover advanced tool usage such as function declarations, Google Search grounding, and code execution. Additionally, new files demonstrate multi-file content handling (including PDFs), multi-candidate responses, and region-based load balancing across various Google Cloud locations.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/googlevertexai · high confidence
Gemini-specific settings and configuration models added
This change introduces new domain classes and extension methods to support Google Gemini-specific features within the client library. Users can now configure Gemini tools and tool configurations via \GenerateContentSettings\, enable system caching for system messages, and control the visibility of the model's internal reasoning thoughts using \setGeminiIncludeThoughts\. Additionally, \GenerationConfig\ now includes \ThinkingConfig\ to manage thinking levels and budgets, allowing for fine-grained control over the model's reasoning depth and output structure.
google-gemini-client/src/main/scala/io/cequence/openaiscala/gemini/domain/settings · high confidence
Groq provider examples expanded with new capabilities
The Groq example directory has been populated with new demonstration files covering audio transcription, JSON-structured chat completions, batch processing, streaming, tool use, reasoning models, and round-robin load balancing with service tiers. These examples show how to configure the Groq API endpoint, use specific model IDs, and leverage provider-specific features like reasoning formats and flex service tiers.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/groq · high confidence
Initial Anthropic client implementation with Bedrock support and Managed Agents
The Anthropic client is now available, providing direct access to the Anthropic Messages API and a full OpenAI-compatible chat completion adapter. This release introduces support for Anthropic-specific features including structured output (JSON schema), thinking/reasoning settings, tool use, MCP servers, and system messages. It also includes a Bedrock integration that handles AWS SigV4 authentication, STS session tokens, and batch inference via S3, alongside a complete Managed Agents control-plane implementation covering agents, environments, sessions, deployments, vaults, and memory stores.
anthropic-client/src/main/scala/io/cequence/openaiscala/anthropic/service/impl · high confidence
Initial domain model for Perplexity Sonar chat completion API
This change introduces the core domain types required to interact with the Perplexity Sonar chat completion API. It defines the message structure (System, User, Assistant) via ChatRole and Message classes, and establishes the request settings in SonarCreateChatCompletionSettings, which supports parameters like temperature, max\_tokens, and structured output formats (JSON schema and Regex). Additionally, it includes response models for both standard and streamed (chunked) completions, specifically handling citations and usage information.
perplexity-sonar-client/src/main/scala/io/cequence/openaiscala/perplexity/domain · high confidence
Initial domain model for the OpenAI Responses API
This release introduces the core Scala domain types for the OpenAI Responses API, enabling users to interact with the new API surface. The changes add comprehensive case classes for request settings (CreateModelResponseSettings, ResponseSettings, GetInputTokensCountSettings) and response structures (Response, DeleteResponse, InputItemsResponse, InputTokensCount). It defines the full input/output hierarchy, including message types (InputText, InputContent, OutputContent), content variants (text, image, file), and tool call items (function, web search, code interpreter, computer, MCP, etc.). Additionally, it provides the JSON serialization formats (JsonFormats) required to encode and decode these structures, as well as streaming event types (ResponseStreamEvent) for handling server-sent events.
openai-core/src/main/scala/io/cequence/openaiscala/domain/responsesapi · high confidence
Introduce Claude CLI subprocess client for interactive agent sessions
This change adds a new \claude-agent-client\ module that wraps the \claude\ CLI as a bidirectional subprocess, enabling interactive, stateful agent sessions with tool-use capabilities. Users can now spawn a persistent \claude\ process via \ClaudeAgentServiceFactory\, send conversational turns and tool results, and receive a stream of structured events including assistant messages, system handshakes, and tool-permission requests that require explicit allow/deny decisions. The client handles the NDJSON wire protocol, manages session lifecycle (including interruption and error handling), and exposes settings for model selection, tool permissions, and session resumption.
claude-agent-client · high confidence
Introduce Perplexity Sonar chat completion client with citation and streaming support
Added a new client module for the Perplexity Sonar API, providing both synchronous and streamed chat completion capabilities. The implementation supports structured response formats (JSON and regex) and includes specific options for handling citations, such as formatting them as HTML hyperlinks and including them directly in the text response. An adapter is also provided to expose this service as a standard OpenAI-compatible chat completion interface.
perplexity-sonar-client/src/main/scala/io/cequence/openaiscala/perplexity/service · high confidence
Introduce TypeSafe AI System One client with structured-output adapter
This change adds a new client module for the TypeSafe AI System One API, enabling structured decision-model queries (yes/no, choice, and score questions) against a provided state. It includes domain models for requests and answers, JSON serialization for the System One wire format, and a dedicated exception hierarchy that classifies API errors by HTTP status and error type. Additionally, it provides an OpenAI chat-completion adapter that maps JSON schemas to System One questions, allowing structured output via the existing OpenAI interface while dropping unsupported sampling parameters.
typesafe-client · high confidence
Introduces native Gemini client implementation with OpenAI adapter
This change adds the core implementation files for the Google Gemini client, establishing the service layer and its OpenAI-compatible adapter. The new \GeminiServiceImpl\ provides native support for Gemini API operations including content generation (standard and streamed), model listing, and content caching, while \OpenAIGeminiChatCompletionService\ maps these capabilities to the OpenAI chat completion interface, handling message translation, tool usage, and streaming chunk conversion. The implementation also includes \GeminiRawHttp\ for secure file operations using header-based authentication and \EndPoint\ definitions for API routing.
google-gemini-client/src/main/scala/io/cequence/openaiscala/gemini/service/impl · high confidence
Introduction of comprehensive JSON serialization formats for Anthropic API
The Anthropic client now includes a dedicated \JsonFormats\ module that defines serialization and deserialization logic for the full range of Anthropic API data structures. This enables proper handling of complex content blocks (such as text, images, documents, and tool results), streaming delta events, and new features like thinking blocks and cache control. It also adds support for the Managed Agents domain, covering agents, sessions, environments, credentials, and deployments, ensuring that request and response payloads are correctly mapped to the API's expected JSON schema.
anthropic-client/src/main/scala/io/cequence/openaiscala/anthropic · high confidence
New Anthropic Bedrock examples for batch inference, structured outputs, and cross-region usage
Added a suite of Scala examples in the Anthropic Bedrock location demonstrating provider-agnostic chat completion via the OpenAI adapter. These include batch inference workflows (both direct and via Bedrock's model-invocation-job with S3 staging), multimodal VLM batch smoke tests, JSON schema structured outputs, reasoning effort configuration, PDF file content handling, and cross-region inference (EU/US). The examples also cover authentication options including STS session tokens and bearer tokens, as well as the Bedrock Mantle endpoint.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/anthropic · high confidence
New Anthropic domain models for batch jobs, skills, and structured content
The Anthropic client now includes comprehensive domain models for new platform capabilities. Users can manage AWS Bedrock batch inference jobs with status tracking and S3 integration, and interact with the Skills API to list, version, and delete custom or Anthropic-built skills. The message domain has been expanded to support structured outputs via JSON schemas, prompt caching with TTL controls, and a rich set of content blocks including tool use/results, thinking blocks, citations, and web search/fetch results.
anthropic-client/src/main/scala/io/cequence/openaiscala/anthropic/domain · high confidence
New Anthropic service interfaces and client factory
This change introduces the core service trait definitions and factory for the Anthropic client. It adds specific API interfaces for Anthropic Managed Agents (agents, environments, sessions, deployments, memory stores, and vaults), batch inference capabilities (both Anthropic Message Batches and AWS Bedrock batch inference), and the primary message/skill APIs. It also defines the \AnthropicServiceFactory\ which handles authentication for direct Anthropic API access (API keys, OAuth profiles, static tokens) and AWS Bedrock integration (SigV4, STS session tokens, and bearer tokens), along with OpenAI-compatible adapters for these backends.
anthropic-client/src/main/scala/io/cequence/openaiscala/anthropic/service · high confidence
New Anthropic skills and files example scripts
Added example scripts in the Anthropic skills and files directories to demonstrate file management (create, list, get metadata, download, delete) and skill management (create, list, get, delete, and versioning) via the Anthropic API, as well as usage of built-in skills like pptx and xlsx through both the native Anthropic message API and the provider-neutral OpenAI-style chat tool completion adapter.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/anthropic/skills · high confidence
New Anthropic tool domain models and factory methods
The Anthropic client now includes a comprehensive set of domain models for tools, enabling users to configure built-in capabilities like Bash, Code Execution, Computer Use, Text Editor, Memory, Web Search, and Web Fetch, as well as custom tools and MCP server integrations. The \Tool\ companion object provides convenient factory methods to instantiate these tools with sensible defaults (e.g., latest versions, standard display sizes for Computer Use), while \ToolChoice\ allows specifying whether the model should auto-decide, use any, a specific tool, or no tools at all. MCP support is introduced via \MCPServerURLDefinition\ for connecting to servers and \MCPToolset\ for configuring tool filtering, enabling/disabling, and caching within those sets.
anthropic-client/src/main/scala/io/cequence/openaiscala/anthropic/domain/tools · high confidence
New Anthropic tool-use and MCP server examples
Added seven new Scala example programs in the Anthropic tools directory demonstrating how to use the Anthropic API with various tool types and external servers. These examples cover custom tools, bash execution, code execution, web search, web fetch, and Model Context Protocol (MCP) server integration (including DeepWiki, Semgrep, and DeepSense CMS Coverage). They illustrate how to configure \AnthropicCreateMessageSettings\ with specific tools, handle tool use blocks and results (such as file IDs from code execution or fetched content), and introspect available tools from connected MCP servers.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/anthropic/tools · high confidence
New Bedrock examples demonstrate SigV4 authentication and unified endpoint matrix
Added three new example programs in the Bedrock examples directory to showcase AWS SigV4 authentication (using IAM credentials instead of bearer tokens) and a comprehensive matrix of authentication and endpoint combinations. The new \BedrockSigV4ChatCompletion\ and \BedrockSigV4ChatCompletionStreamed\ examples demonstrate how to configure the service factory for SigV4 auth across different Bedrock endpoints (Mantle and Runtime) and model types, while \BedrockAuthEndpointMatrix\ walks through all supported auth/host combinations on a shared streaming engine to verify lifecycle management.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/bedrock · high confidence
New Fireworks AI examples for chat, streaming, tools, and document inlining
Added a set of Scala example programs in the Fireworks AI package that demonstrate how to use the library with the Fireworks provider. These include basic and streamed chat completions, tool-use completions, and document inlining (PDF) examples. The examples also showcase support for new models like Llama 4 and DeepSeek, and demonstrate how to handle reasoning content in streamed responses.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/fireworksai · high confidence
New Gemini API response domain models for content, grounding, and caching
This change introduces the core Scala domain classes for parsing Google Gemini API responses, enabling the client to handle structured data from content generation, grounding, and caching endpoints. The new \GenerateContentResponse\ and \Candidate\ models support detailed response analysis, including safety ratings, citation metadata, and specific finish reasons (such as SAFETY, RECITATION, and BLOCKLIST) to help users understand why a response was generated or blocked. It also adds \GroundingAttribution\ and \GroundingMetadata\ to expose source citations and web search grounding details when enabled. Additionally, \ListCachedContentsResponse\ and \ListModelsResponse\ provide the necessary structures for paginated listing of cached content and available models.
google-gemini-client/src/main/scala/io/cequence/openaiscala/gemini/domain/response · high confidence
New Gemini client service with typed error handling and batch support
The Gemini client now provides a dedicated \GeminiService\ implementation that supports content generation (including streamed responses), model listing, and content caching operations. A key behavioral improvement is the introduction of specific, typed exceptions (such as \GeminiScalaTokenCountExceededException\, \GeminiScalaUnauthorizedException\, and \GeminiScalaMcpCallNotExecutedException\) that map Gemini API error codes to distinct failure types, enabling more precise error handling and automatic retries for transient server errors. The service also introduces support for asynchronous batch processing of content generation requests and allows for explicit timeout configuration via the \GeminiServiceFactory\.
google-gemini-client/src/main/scala/io/cequence/openaiscala/gemini/service · high confidence
New Gemini domain models for batch processing, caching, and tools
This change introduces a comprehensive set of domain classes for the Gemini API in the \google-gemini-client\ module. Users can now define batch generation jobs (\GenerateContentBatch\, \BatchState\) with per-request system instructions, manage cached content (\CachedContent\ with TTL/expiration), and upload files (\GeminiFile\). The update also adds support for function calling and remote tool integration via \Tool\ (including \FunctionDeclaration\, \GoogleSearch\, \CodeExecution\, and \McpServers\), along with content structures (\Content\, \Part\) that handle text, inline data, and code execution results. Safety controls are exposed through \HarmCategory\ and \HarmBlockThreshold\, and model metadata is available via the \Model\ case class.
google-gemini-client/src/main/scala/io/cequence/openaiscala/gemini/domain · high confidence
New Google Gemini examples for batch processing, file content, and tool usage
Added a suite of live examples in the Google Gemini package demonstrating provider-agnostic chat-completion batching (with and without explicit context caching via the OpenAI adapter), streaming, JSON schema output, and reasoning effort configuration. The examples also cover multimodal inputs (PDFs and images via base64 and FileContent), native Gemini tool usage including function declarations, code execution, Google Search grounding, and remote MCP server integration, along with a direct Batch API workflow for asynchronous batch creation and polling.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/googlegemini · high confidence
New Grok chat completion examples added
Added four new example files in the Grok examples directory demonstrating how to use the Grok API provider for chat completions. These include basic chat completion, JSON mode with schema validation, streamed responses, and image-based (vision) inputs, covering models such as grok-4.3, grok-4.20-0309, and grok-3.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/cerebras, openai-examples/src/main/scala/io/cequence/openaiscala/examples/grok · high confidence
New Guice-based OpenAI client application with Akka integration
This change introduces a new base application structure for the OpenAI Scala client using Google Guice for dependency injection and Akka for actor management. It provides a \BaseOpenAIClientApp\ trait that automatically wires up an \ActorSystem\, \Materializer\, and \ExecutionContext\ via \AkkaModule\, along with configuration loading via \ConfigModule\. The service layer is bound through \ServiceModule\, which provides the \OpenAIService\ via \OpenAIServiceProvider\. An example application (\OpenAIExampleApp\) demonstrates how to use this setup, including a convenient \closeAndExit\ helper for graceful shutdown. This allows users to easily create standalone applications that integrate with the OpenAI API while leveraging Akka's concurrency model and Guice's DI capabilities.
openai-guice/src · high confidence
New Managed Agents examples for Anthropic API lifecycle and authentication
This location introduces a suite of live smoke-test examples for the Anthropic Managed Agents API, organized under the \managedagents\ subpackage. The examples demonstrate the full lifecycle management of agents, environments, deployments, sessions, memory stores, credentials, and vaults (create, get, list, update, archive, delete). Additionally, it provides examples for OpenAI-style chat completion adapters (both streaming and non-streaming) that route requests to Anthropic managed agents, and demonstrates alternative authentication methods using static OAuth bearer tokens and \ant auth\ OAuth profiles with automatic token refresh.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/anthropic/managedagents · high confidence
New Perplexity Sonar chat completion client with citation handling
Added a new client implementation for the Perplexity Sonar API, enabling both streamed and non-streamed chat completions. This service supports JSON and regex response formats, and includes logic to append citations to the response text, with an option to format them as HTML anchor tags. The implementation also stores the original API response in the returned object for access to raw data.
perplexity-sonar-client/src/main/scala/io/cequence/openaiscala/perplexity/service/impl · high confidence
New Responses API example suite for OpenAI Scala Client
This location now provides a comprehensive set of runnable examples demonstrating the OpenAI Responses API. The examples cover core operations like creating, streaming, cancelling, and deleting model responses, as well as advanced features including tool usage (web search, code interpreter, file search, image generation, and MCP servers), structured output with strict JSON schemas, and multi-modal inputs (PDFs and labeled images). It also includes specific smoke tests for new models (GPT-5.5 Pro, GPT-5.6 Sol Max) and shows how to use the Responses API via Amazon Bedrock Mantle.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/responsesapi · high confidence
New Sonar example files for chat completion, streaming, and JSON modes
Added five new Scala example files in the Sonar provider directory demonstrating how to use the Sonar API for chat completions, including standard, streamed, and JSON-schema output modes, as well as usage via the OpenAI adapter. These examples show how to configure settings like temperature, max tokens, and citation inclusion for models such as sonar\_deep\_research, sonar\_reasoning\_pro, and sonar\_pro.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/sonar · high confidence
New TypeSafe System One integration examples
Added a suite of Scala examples in the \typesafe\ package demonstrating the TypeSafe System One client and its OpenAI chat-completion adapter. These include a confidence-gated routing pattern for banking intents, structured JSON output via JSON schemas for ticket triage, line-by-line semantic search over documents, and a benchmark comparing system message mapping strategies. The examples also cover model listing, live smoke tests for error handling and question types, and walkthroughs of the adapter's request/response mapping.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/typesafe · high confidence
New adapter examples for routing, streaming, and error handling
The examples package now includes a comprehensive set of adapter demonstrations, showing how to route chat completions across multiple providers (OpenAI, Anthropic, Fireworks AI, Ollama, OctoML, Azure AI, and Groq) using both standard and streamed services, with support for model mapping and shared stateless engines. It also introduces examples for intercepting chat completion errors, handling input transformations (such as adapting system messages and dropping unsupported fields for Fireworks AI), converting core services to chat completions, and applying resilience patterns like retry, round-robin, and random-order load balancing.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/adapters · high confidence
New assistant scenario examples with file search and polling
Added two new example scenarios in the scenario package: Assistants.scala demonstrates creating an assistant with file search tools, uploading a file to a vector store, and running it on a thread; CreateThreadAndRunScenario.scala shows using the createThreadAndRun API with polling to wait for run completion before retrieving messages.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/scenario · high confidence
New chat-completion adapter infrastructure and batch emulation
The adapter package now includes a suite of new service adapters for chat completion: \ChatCompletionInputAdapter\ and \ChatCompletionInputBatchAdapter\ for transforming messages and settings, \ChatCompletionOutputAdapter\ for post-processing assistant messages, \ChatCompletionInterceptAdapter\ and \ChatCompletionErrorInterceptAdapter\ for logging and error handling, and \ChatCompletionServiceAdapter\ for wrapping underlying services. A new \ChatCompletionBatchEmulationAdapter\ allows non-batch services to participate in the batch router by running requests synchronously in memory. Additionally, \OpenAIChatCompletionServiceRouter\ provides model-based routing for chat completions and batch operations, and \ChatCompletionSettingsConversions\ handles provider-specific parameter adjustments (e.g., Bedrock prefixes, reasoning effort). The legacy \ChatToCompletionAdapter\ and deprecated \MessageConversions\ (think-tag filtering) are also present.
openai-core/src/main/scala/io/cequence/openaiscala/service/adapter · high confidence
New domain model and serialization for evaluation graders
The \openai-core\ module now includes the core domain types and JSON serialization logic for the evaluation grading system. This adds a \Grader\ trait and specific implementations for string checks, text similarity (with metrics like BLEU, ROUGE, and cosine similarity), model-based scoring and labeling, Python script execution, and composite multi-graders. It also defines the \GraderInputContent\ hierarchy to support text, image, and audio inputs, along with the necessary Play JSON formats to serialize and deserialize these structures.
openai-core/src/main/scala/io/cequence/openaiscala/domain/graders · high confidence
New domain models for Anthropic Managed Agents and chat settings
This change introduces a comprehensive set of Scala case classes in the \anthropic-client\ domain settings package to support the new Anthropic Managed Agents lifecycle and enhanced chat capabilities. For Managed Agents, it adds create and update settings for Agents, Deployments, Environments, Sessions, Credentials, Memory Stores, and Vaults, enabling users to define and manage these resources via the API. For chat interactions, \AnthropicCreateMessageSettings\ is expanded to include structured output configuration (\output\_format\, \output\_config\), reasoning effort levels (\low\, \medium\, \high\, \xhigh\, \max\), and extended thinking controls (adaptive/enabled types, display modes), along with support for MCP servers and speed modes.
anthropic-client/src/main/scala/io/cequence/openaiscala/anthropic/domain/settings · high confidence
New domain settings for chat, embeddings, speech, and assistants
The library introduces a comprehensive set of new domain settings classes in the \openai-core\ module to configure API requests. \CreateChatCompletionSettings\ now supports advanced parameters including \reasoning\_effort\, \verbosity\, \service\_tier\, \parallel\_tool\_calls\, and structured output via \jsonSchema\. New settings classes have been added for \CreateEmbeddingsSettings\ (supporting \dimensions\ and \encoding\_format\), \CreateSpeechSettings\ (with \instructions\ and \stream\_format\), \CreateRunSettings\, and \CreateThreadAndRunSettings\ for the Assistants API. Additionally, \GroqCreateChatCompletionSettingsOps\ provides implicit extensions for Groq-specific parameters like \reasoning\_format\, and \JsonSchemaDef\ enables typed JSON schema definitions for strict output validation.
openai-core/src/main/scala/io/cequence/openaiscala/domain/settings · high confidence
New examples and smoke tests for Bedrock, batch processing, and assistants
This update adds a suite of new example programs and verification tests to the examples directory. It introduces Bedrock Mantle smoke tests for JSON schema structured output and VLM content (images/PDFs) on gpt-5.5, alongside a latency benchmark comparing Bedrock vs. OpenAI. Batch processing capabilities are demonstrated through new examples for standard batches, split-flow submission/polling, emulation routing for providers without native batch support, and caching experiments across OpenAI, Anthropic, Gemini, and Vertex AI. Additionally, new examples cover the Assistants API (creation with code interpreter, file search, and functions), audio endpoints (transcription, translation, speech), and a centralized provider factory for streaming chat completions.
openai-examples/src/main/scala/io/cequence/openaiscala/examples · high confidence
New examples for Claude CLI agent interaction
Added two Scala example programs demonstrating the new \ClaudeAgentService\ for interacting with the Claude CLI subprocess. \ClaudeAgentOneShotQueryExample\ shows a simple one-shot query, while \ClaudeAgentToolPermissionExample\ demonstrates handling tool permission requests (such as Bash execution) within a bidirectional session.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/claudeagent · high confidence
New grader example scripts for running and validating evaluations
Added two new example scripts, RunGrader.scala and ValidateGrader.scala, to demonstrate how to use the grader functionality. RunGrader.scala shows how to execute a ScoreModelGrader to evaluate model responses, while ValidateGrader.scala provides examples for validating various grader types including StringGrader, ScoreModelGrader, LabelModelGrader, PythonGrader, and MultiGrader.
openai-examples/src/main/scala/io/cequence/openaiscala/examples/graders · high confidence
New provider-specific chat completion examples added
The openai-examples module now includes dedicated example files for Mistral, Novita, OctoML, and Ollama providers. Each provider has both standard and streamed chat completion examples, demonstrating how to configure the OpenAI-compatible API client for these specific services using their respective model IDs and environment variables.
(repo-wide) · high confidence
New typed chat-completion streaming ADT and response models
The library introduces a provider-agnostic, typed streaming model for chat completions. Consumers can now use the \ChatChunk\ sealed trait hierarchy to process streamed events (text, tool calls, thinking, code execution, web search, etc.) uniformly across OpenAI, Anthropic, and Google Gemini, and fold them into the new \AssembledChatCompletion\ result. Additionally, the response domain has been expanded with new case classes for tool-based (\ChatToolCompletionResponse\), function-based (\ChatFunCompletionResponse\), and web-search-based (\ChatWebSearchCompletionResponse\) completions, alongside updated models for assistants, fine-tuning jobs, and usage information.
openai-core/src/main/scala/io/cequence/openaiscala/domain/response · high confidence
Responses API tool definitions and serialization support
The library now includes comprehensive domain models and JSON serialization for the OpenAI Responses API tool ecosystem. This adds support for defining and handling hosted tools including code interpreter, file search, web search, image generation, and computer use, alongside custom, function, and MCP (Model Context Protocol) tools. The update also introduces the corresponding tool call and output structures for these types, along with tool choice configurations, enabling users to construct complex tool-augmented requests and parse the resulting structured interactions.
openai-core/src/main/scala/io/cequence/openaiscala/domain/responsesapi/tools · high confidence
Streamed chat completion services gain input/output conversion, round-robin load balancing, and model routing
Users can now transform streamed chat completion requests and responses using the new \OpenAIChatCompletionIOConversionAdapter\, which applies configurable conversions to input messages, settings, and output chunks. The library introduces \OpenAIChatCompletionStreamedRoundRobinService\ to distribute streamed requests across multiple underlying services, and \OpenAIChatCompletionStreamedServiceRouter\ to direct requests to specific services based on model names or mapped model aliases. Additionally, \OpenAIChatCompletionStreamedServiceFactory\ and \OpenAIStreamedServiceFactory\ provide explicit ways to create streamed services with custom engines or auto-discovered engines, while \OpenAIStreamedServiceImplicits\ allows seamless extension of existing non-streamed services with streaming capabilities via \withStreaming\.
openai-client-stream/src/main/scala/io/cequence/openaiscala/service · high confidence
Unified AWS Bedrock support with flexible authentication and endpoint configuration
The service layer now includes dedicated configuration for AWS Bedrock, introducing \BedrockAuth\ to support both Bearer Token (API key) and AWS Signature Version 4 (IAM/STS) authentication, and \BedrockEndpoint\ to manage the distinct base URLs for the \bedrock-mantle\ and \bedrock-runtime\ hosts. This allows users to connect to Bedrock's OpenAI-compatible surface using either development-friendly API keys or production-grade IAM roles, with credentials resolved per request to support rotation without service restarts.
openai-core/src/main/scala/io/cequence/openaiscala/service · high confidence
Vertex AI client adds batch prediction support and tool configuration
The Vertex AI client now supports batch prediction jobs for Gemini models, allowing users to stage inputs from Cloud Storage or BigQuery and retrieve results back to Cloud Storage or BigQuery via the new \VertexAIBatchPredictionService\ and \VertexAIServiceFactory.asOpenAIWithBatchSupport\. Additionally, the client introduces structured tool configuration capabilities, including \ToolConfig\ for controlling function calling modes (AUTO, ANY, NONE) and \setVertexAITools\/\setVertexAIIncludeThoughts\ settings to manage function declarations, Google Search grounding, code execution, and thinking budget exposure in chat completions.
google-vertexai-client · high confidence
Behavioural changes
Configurable JSON Schema Support for New Model IDs
The OpenAI Scala client now uses a centralized configuration file (openai-scala-client.conf) to define which models support JSON schema structured output. This change allows users to easily enable or disable structured output capabilities for a wide range of models, including the newly registered GPT-5.x, GPT-6 Astra, Claude Opus/Sonnet/Fable/Mythos 4.x/5.x, and various Bedrock and OSS models, without modifying code. The configuration explicitly lists supported model IDs and comments out those that do not yet support the feature (e.g., certain Bedrock Claude models returning 400 errors), ensuring that the client correctly routes requests to use JSON schema where available and falls back to prompt-based modes otherwise.
openai-client/src/main/resources · high confidence
Improved token counting accuracy and support for newer OpenAI models
The token counting logic has been updated to correctly handle newer OpenAI model families (such as gpt-4.1, gpt-4.5, gpt-5, gpt-6, o1, o3, o4, and chatgpt-4o) by routing them to the o200k\_base encoding, preventing misrouting to older encodings. The implementation now supports DeveloperMessage types and provides more accurate token estimates for function/tool calls and complex message structures. A shared encoding registry is used to optimize memory usage across the JVM.
openai-count-tokens/src/main · high confidence
New typed domain models for Anthropic streaming and message responses
The Anthropic client now uses newly defined Scala case classes to represent message responses and streaming events, replacing previous ad-hoc or less structured handling. CreateMessageResponse models the full message payload, including content blocks (text, thinking, tool use, citations) and usage statistics with optional cache token counts. CreateMessageChunkResponse and MessageStreamEvent provide a typed, sealed-hierarchy representation of SSE stream events, distinguishing between message start, content block deltas (text, thinking, signature, input JSON, citations), block stops, and message deltas. This enables more robust parsing and access to streaming data, including support for thinking blocks and citation deltas in real-time responses.
anthropic-client/src/main/scala/io/cequence/openaiscala/anthropic/domain/response · high confidence
Robust JSON serialization and deserialization for Gemini API responses
This change introduces a dedicated JSON format layer for the Google Gemini client that significantly improves resilience against API evolution. It implements lenient enum parsing for fields like finish reasons and block reasons, allowing the client to gracefully handle new or unknown enum values from Google without failing the entire response. Additionally, it corrects serialization logic for \Part\ objects to properly handle \thoughtSignature\ fields required by Gemini 3, ensures empty content is handled correctly, and fixes Scala 3 compatibility issues in \Content\ serialization.
google-gemini-client/src/main/scala/io/cequence/openaiscala/gemini · high confidence
Structured error handling, retry logic, and JSON format consolidation in core
The core library now provides a unified, typed exception hierarchy (e.g., OpenAIScalaRateLimitException, OpenAIScalaJsonParseException) that exposes provider error details (HTTP status, error type, request ID) and supports pattern matching for retry decisions. A new RetryHelpers module implements exponential backoff with jitter and failover capabilities, automatically retrying on transient errors while preserving billed usage even when JSON parsing fails. Additionally, JsonFormats has been consolidated into the core project, and a new EnvHelper trait standardizes environment variable retrieval with clear error messages.
openai-core/src/main/scala/io/cequence/openaiscala · high confidence
Test coverage
Added comprehensive JSON serialization tests for Responses API tools; Added test configuration for OpenAI token counting; Added test coverage for chat-completion batch emulation, routing, and settings conversions; Added tests for AWS SigV4 signing logic; Added tests for Anthropic client JSON formats, streaming events, and authentication; Added tests for Gemini JSON serialization and lenient parsing; Added tests for Gemini client service implementation details; Added tests for JsonSchema numeric constraints; Added tests for Responses API routing and streamed service delegation; Added tests for VLMContent image format handling; Added tests for grader JSON serialization formats; Added tests for token counting with function call schemas and encoding fallbacks; Added tests for typed streaming, JSON batch, and Responses API parsing; Expanded test coverage for OpenAI Scala client JSON serialization, retry logic, and AWS Bedrock authentication.
Dependencies
Automated dependency updates and code formatting configuration
The repository now includes configuration files for automated maintenance: \.scala-steward.conf\ enables weekly dependency updates with grouped PRs for scalatest and sbt plugins, while pinning Akka to 2.6.x and logback to 1.4.x; \.scalafix.conf\ and \.scalafmt.conf\ enforce consistent code style and syntax rules across the codebase.
(repo-wide) · high confidence
Build infrastructure initialization with SBT 1.9.0 and dependency management
The project's build infrastructure has been initialized, establishing SBT version 1.9.0 and defining core dependencies including wsClient 1.0.0 and scalaMock 6.0.0. The build configuration also integrates several SBT plugins: sbt-sonatype and sbt-pgp for publishing, sbt-scalafix and sbt-scalafmt for code quality and formatting, and sbt-scoverage for test coverage analysis.
project · high confidence
Initial release of the OpenAI Scala Client library (v1.3.0)
This entry introduces the complete build structure and dependency configuration for the OpenAI Scala Client, establishing version 1.3.0 as the initial release. The project is organized into multiple modules including a core library, clients for OpenAI, Anthropic, Google Vertex AI, Google Gemini, Perplexity Sonar, and TypeSafe AI, along with streaming support, a token counting module, and Guice integration. The build defines support for Scala 2.12.18, 2.13.11, and 3.2.2, and configures dependencies such as the internal ws-client library, scala-logging, logback, and jtokkit for token counting.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 69.
Lenses
- Code Health 89
- Architecture 94
- Maturity 61
- Readiness 77
- Security 64
- Domain Modelling 100
Changes since last survey
- 300 commits — 261 feature/other, 39 fixes
By area
- openai-core/src — 92 commits
- openai-examples/src — 51 commits
- anthropic-client/src — 45 commits
- (root) — 37 commits
- openai-client/src — 28 commits
- google-gemini-client/src — 17 commits
- google-vertexai-client/src — 8 commits
- typesafe-client/src — 6 commits
- openai-count-tokens/src — 3 commits
- openai-client-stream/src — 2 commits
- openai-core/build.sbt — 2 commits
- perplexity-sonar-client/src — 2 commits
- project/Dependencies.scala — 2 commits
- (repo) — 1 commit
- .github/workflows — 1 commit
- claude-agent-client/src — 1 commit
- google-vertexai-client/build.sbt — 1 commit
- openai-count-tokens/README.md — 1 commit
Notable commits
- fix: Claude Opus 4.7 support, chat tool completion improvements, and review-driven fixes
- fix: Fix MiniMax Anthropic endpoint example
- fix: Fix PromptFeedback JSON serialization in Scala 3 by replacing unlift with manual extraction
- fix: Fix of \"
- fix: JSON format specs (test) for responses API fixed
- fix: Json schema fix
- fix: JsonSchema compilation fix
- fix: Managed Agents Sessions: conformance fixes (threads, resources, update)
- fix: Managed Agents: conformance fixes for memory, environments, credentials
- fix: Managed Agents: fix statuses query param + dedupe updateAgent metadata
- fix: Responses API - JSON format handling for CreateModelResponseSettings (Scala 3 fix)
- fix: Responses API - json formats test fix
- fix: Retry helpers - call-by-name future fix
- fix: Revert "Update scala-logging to 3.9.6 (#113)"
- fix: Scala 2.12 compilation fix
- fix: Vertex - finish reason and usage info fix. Closes #95, #96
- fix: WS version fix
- fix: fix(anthropic): carry the raw CreateMessageResponse on the tool completion
- fix: fix(anthropic): report only element names in STS parse errors
- fix: fix(batch): spread extra_params into OpenAI batch JSONL bodies
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
cequence-io/openai-scala-client was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit cfabe8842344da713615d0121a7804840649eb46 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.