← All publications

A coding API for Sanad

Sanad can now accept model requests through a dedicated API, translate message formats, and stream responses back to coding clients.

Connecting a coding tool to a model

We have added a dedicated AI service to Sanad. It accepts messages from a client, translates them into the inference request, and returns the answer in the format the client expects. Streaming responses let the client show the answer while it is being generated.

A coding tool depends on more than the final text of an answer. It needs consistent message roles, tool-call structure, errors, and completion signals. A mismatch in any of those can break the interaction even when the underlying model is producing useful output. The first implementation gives us a single place to handle that contract.

One request path, separate responsibilities

The AI service handles message conversion and inference. Sanad’s gateway handles the account-facing request path. Keeping those responsibilities separate lets us work on model integration without embedding account and access logic into every response adapter.

The implementation includes a model-list endpoint, request validation, and conversion between the supported message formats. Both completed and streamed responses pass through the same public model identity, so a client does not have to learn the infrastructure behind a request.

The first integration boundary

This establishes the API foundation for coding-client integration. Compatibility still has to be exercised against the behavior of each client: partial tool arguments, interrupted streams, malformed messages, and errors during generation are part of the interface.

The immediate work is to make those interactions predictable. A client should be able to distinguish a completed answer from an interrupted request and preserve enough state for the developer to decide what to do next.

Further reading