Owctopus
Log in

Quickstart

Pick the backend you already run. TypeScript, Python, and Go have an SDK. Every other backend sends the same JSON to the HTTP API.

1. Install

The HTTP tab needs no package. It is the call any language can make.

npm install @owctopus/sdk

2. Configure

Put the key in the environment of your server. The SDKs read OWCTOPUS_API_KEY. HTTP sends that value as a bearer token.

OWCTOPUS_API_KEY=ow_live_xxxxxxxxx

Point the client at http://localhost:3000 while you develop. Leave the base URL out in production and the call goes to https://api.owctopus.com.

const owctopus = new Owctopus({
  apiKey: process.env.OWCTOPUS_API_KEY,
  baseUrl: "http://localhost:3000",
});

3. Decide

import { Owctopus } from "@owctopus/sdk";

const owctopus = new Owctopus({
  apiKey: process.env.OWCTOPUS_API_KEY,
});

const result = await owctopus.decide({
  decision: "shipping_method",
  context: {
    cartValue: 4500,
    customerType: "premium",
    location: "Bangalore",
    deliveryUrgency: "high",
  },
  options: [
    { id: "standard", price: 40, deliveryDays: 4 },
    { id: "express", price: 90, deliveryDays: 2 },
    { id: "same_day", price: 180, deliveryDays: 0 },
  ],
});

console.log(result.decision.id);

cartValue, customerType, location, and deliveryUrgency are fields your app chose to send.price and deliveryDays are fields on your shipping options. A food app or a workout app sends different fields on the same method.

The first time this situation shows up, AI can choose among standard, express, and same-day, and Owctopus stores the run. After the pattern is learned and approved, a later call with the same kind of context is answered by the condition, without an AI call.