Quickstart
Install the SDK, attach a wallet, and make a paid request.
1. Install
npm install galliun
2. Create a client
import {
GalliunClient,
createSuiWalletAdapter,
createInferenceSuiWalletAdapter,
} from "galliun";
const client = new GalliunClient({
baseUrl: "https://api.galliun.com",
chain: "sui",
wallet: createSuiWalletAdapter(suiSigner),
inferenceWallet: createInferenceSuiWalletAdapter(suiSigner),
});
Use Solana adapters (createSolanaWalletAdapter, createInferenceSolanaWalletAdapter) when paying on Solana. See Connect a wallet.
3. Call inference
const response = await client.inference.chat({
model: "openai:gpt-4o-mini",
messages: [{ role: "user", content: "Explain x402 payments." }],
});
console.log(response.choices[0]?.message.content);
4. Call a marketplace endpoint
const result = await client.marketplace.call({
path: "/p/demo-api/summarize",
method: "POST",
body: { text: "Hello from Galliun" },
});
Replace the path with a published endpoint from the directory.