Zig-ai: an OpenAI SDK with streaming support

I was missing an OpenAI SDK for my Zig projects, and the ones that existed didn’t have support for streaming. You can use this to call models like gpt-4o for terminal clients or whatever.

Tool use support is in the works :slight_smile:

This is my first published package so would love to hear your thoughts!

6 Likes

Welcome to Ziggit @eahl!

This is a good first library, looks focused and useful.

A bit of style feedback: Zig errors are, by convention, PascalCased, so you’d have error.BadRequest rather than error.BAD_REQUEST as would be normal in C and C++.

It would also be useful to clearly document which part of the system is responsible for what memory, which may also involve some decisions on your part.

4 Likes

Thank you for the feedback @mnemnion! I took your feedback and changed both the error naming and documented the memory responsibilities

2 Likes