example/

directory
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2026 License: MIT

README

example

Runnable example programs demonstrating how to use the relay library.

Examples

Directory Description
basic/ Chat completion with the OpenAI provider and in-memory usage metering
gemini/ Chat completion using the Gemini provider
midjourney/ Midjourney image generation task submission and polling
realtime/ OpenAI Realtime API WebSocket session bridging
suno/ Suno music generation task submission and polling

Running

export OPENAI_API_KEY="sk-..."
cd example/basic && go run main.go

Each example creates a relay.Client with a provider and optional meter.MemoryMeter, sends a request, and prints the response and aggregated usage statistics.

Directories

Path Synopsis
Example: basic chat completion with OpenAI provider and usage metering.
Example: basic chat completion with OpenAI provider and usage metering.
Example: Gemini native format chat completion.
Example: Gemini native format chat completion.
Example: Midjourney task submission and polling.
Example: Midjourney task submission and polling.
Example: OpenAI Realtime API WebSocket session.
Example: OpenAI Realtime API WebSocket session.
Example: Suno music generation task submission and polling.
Example: Suno music generation task submission and polling.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL