Jump to content

Recommended Posts

Posted

Context v1.5.0 — AI Gateway

Hi, just pushed a new release.

The main addition is a centralized AI Gateway — a ContextAI class that any ProcessWire module can use to make AI requests through a single shared configuration:

$ai = wire('context')->ai();

// Simple
$text = $ai->complete('Summarize: ' . $page->title);

// Full options
$result = $ai->chat([
    'messages'   => [['role' => 'user', 'content' => '...']],
    'model'      => 'openai/gpt-4o-mini',
    'caller'     => 'MyModule',
]);

// Gateway entry point for third-party modules
$result = $ai->gateway(['caller' => 'MyModule', 'messages' => [...]]);

Supported providers: OpenRouter (200+ models via one key), OpenAI, or any OpenAI-compatible endpoint.

New settings fieldset: provider, API key, default model, temperature, max tokens, timeout, global system prompt, and a Test Connection button that fires a live request and shows the response time.

The idea is that modules don't need to implement their own HTTP clients or manage API keys — they just call wire('context')->ai() and everything is configured in one place.

GitHub: https://github.com/mxmsmnv/Context

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...