API client
The Zak_ai API client layer consists of two classes:
\Wegewerk\— low-level PSR HTTP wrapperAi3Core\ Api\ Zak Ai Client \Wegewerk\— account-level operationsAi3Core\ Api\ Zak Ai Account
Both classes are registered as services and can be injected via constructor DI.
ZakAiClient
Zak handles authentication and the raw HTTP layer. It reads
credentials from the environment at construction time (see
Environment variables). The base URL defaults to
https://.
Public methods:
| Method | Description |
|---|---|
post | Sends a JSON POST and returns the decoded response.
Appends model to the payload automatically. |
put | Sends a JSON PUT. |
get | Sends a GET request (no body). |
has | Returns true if ZAKAI_ is non-empty. |
has | Returns true if ZAKAI_ is non-empty. |
All request methods accept optional $extra and a
$require flag. When $require is true (default) and
no API key is set, a \Runtime is thrown before the request
is sent.
ZakAiAccount
Zak wraps the account-related endpoints:
| Method | Description |
|---|---|
request | POST / — request a new API key. |
confirm | PUT / — confirm the pending API key. |
query | GET / — return the current credit balance. |
client | Proxy for Zak. |
client | Proxy for Zak. |
Note
request and confirm are called internally
by the Zak_ai management view in the
backend module. Direct calls by other Code is not intended.