Chat completions
const response = await client.inference.chat({
model: "openai:gpt-4o-mini",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Explain x402 payments." },
],
temperature: 0.7,
max_tokens: 1024,
});
const text = response.choices[0]?.message.content;
Request fields
| Field | Description |
|---|---|
model |
Model ID (provider:model) |
messages |
Chat messages (system, user, assistant, tool) |
temperature |
Optional sampling temperature |
max_tokens |
Optional max completion tokens |
tools |
Optional tool definitions (see Tool calls) |
storeConversation |
Optional — persist the turn (requires auth) |
conversationId |
Optional — continue a managed conversation |
Response
OpenAI-style choices, usage, plus optional Galliun fields:
| Field | Description |
|---|---|
usage |
Token counts |
cost |
USDC cost breakdown |
payment |
Payment proof echoed on success |
conversationId |
Set when using managed conversations |
Client setup: Create a client.
Streaming
Server-side stream: true is not supported as an SSE client flow in the current SDK. Prefer client.inference.chat for complete JSON responses.