REFERENCE

API Reference

Complete API documentation for the GOKA SDK and REST endpoints.

goka.inference.run()returns InferenceResult

Run inference on a single input

goka.inference.batch()returns InferenceResult[]

Batch inference for multiple inputs

goka.inference.stream()returns AsyncIterator

Stream inference results in real-time

example.ts
import { Goka } from '@goka/sdk';

const goka = new Goka({
  network: 'mainnet-beta',
  wallet: './wallet.json',
});

// Run inference
const result = await goka.inference.run({
  model: 'gpt-4-turbo',
  input: 'Analyze this market data...',
  maxTokens: 1000,
});

console.log(result.output);
// "Based on the data, I see..."

// Stream results
for await (const chunk of goka.inference.stream({
  model: 'gpt-4-turbo',
  input: 'Write a story...',
})) {
  process.stdout.write(chunk);
}