https://github.com/FOLLGAD/zig-ai
OpenAI SDK with streaming support
https://github.com/FOLLGAD/zig-ai
openai zig zig-package
Last synced: 28 days ago
JSON representation
OpenAI SDK with streaming support
- Host: GitHub
- URL: https://github.com/FOLLGAD/zig-ai
- Owner: FOLLGAD
- Created: 2024-11-30T21:23:56.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-02-16T18:17:11.000Z (9 months ago)
- Last Synced: 2025-07-12T07:34:08.272Z (4 months ago)
- Topics: openai, zig, zig-package
- Language: Zig
- Homepage:
- Size: 16.6 KB
- Stars: 42
- Watchers: 1
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# zig-ai
A simple OpenAI API client for Zig with streaming support.
Find examples in the [`examples`](./examples) directory.
## Installation
```bash
$ zig fetch --save git+https://github.com/FOLLGAD/zig-ai
```
and add `zig-ai` to your `build.zig` file:
```zig
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "stream-cli",
.root_source_file = b.path("examples/stream-cli.zig"),
.target = target,
.optimize = optimize,
});
const module = b.dependency("zig-ai", .{
.root_source_file = b.path("src/llm.zig"),
});
exe.root_module.addImport("zig-ai", module.module("zig-ai"));
}
```
## Usage
See the `examples` directory for usage examples.