Last updated: 2026-11-17

API Server

Model Discovery

All API Sections

Model discovery serializer for the OpenAI-compatible /v1/models endpoint.

Produces an allocator-owned JSON byte slice listing the loaded model with its basename as `id`, a fixed `owned_by` of "zinc", and per-slot context length. Never exposes parent directories or other private metadata.

3 exports shown

struct

ChatModel

#
pub const ChatModel = struct

Memory Layout

Size: 64 bytes (alignment: 8)

Offset Size Align Field Type
0 16 8 display_name ?[]const u8
16 16 8 homepage_url ?[]const u8
56 1 1 supports_thinking_toggle bool
32 24 8 mtp server.mtp_policy.Capability

No public doc comment yet.

src/server/model_discovery.zig:8

function

serializeChatModel

#
pub fn serializeChatModel(allocator: std.mem.Allocator, model_path: []const u8, context_length: u32, options: ChatModel) ![]u8

Describe the already-loaded native model to the shared browser UI.

This is a single active, manually loaded model, not a hot-switchable catalog entry.

src/server/model_discovery.zig:17

function

serializeModels

#
pub fn serializeModels(allocator: std.mem.Allocator, model_path: []const u8, context_length: u32) ![]u8

Model discovery serializer — produces OpenAI-compatible /v1/models JSON.

Returns an allocator-owned byte slice; caller must free with the same allocator.

src/server/model_discovery.zig:44