Zoonk.AI.AIClient.OpenRouterClient (Zoonk v0.1.0-dev)

View Source

OpenRouter service implementation for generating AI responses.

This module handles communication with the OpenRouter API, supporting structured outputs with JSON schema. OpenRouter provides access to multiple AI providers through an OpenAI-compatible chat completions API.

Summary

Functions

Generate an object.

Functions

generate_object(payload)

Generate an object.

Creates a structured object using the OpenRouter API. The model name should have the "open-" prefix removed before sending to the API.

Examples

iex> OpenRouterClient.generate_object(%AIPayload{model: "openai/gpt-4o"})
{:ok, %{field: "value"}}