terminalKodo API

Getting Started

Welcome to the Kodo API. Below you'll find what you need to get started.

Base Docs

To learn how to integrate into your agentic workflow, please see the following guide: https://docs.cdp.coinbase.com/x402/quickstart-for-buyersarrow-up-right

Base URL

https://api.kodo.fun

Current Version

V1

Cost

Each generate costs 0.02 USDC.

Quick Start

The following is a simple example on how to get started.

// Import the SDK
import { 
  decodeXPaymentResponse, 
  wrapFetchWithPayment 
} from "x402-fetch";
import { privateKeyToAccount } from "viem/accounts";

// Set url
const url = 'https://api.kodo.fun/v1/generate';

// Securely retrieve private key
const account = privateKeyToAccount(PRIVATE_KEY);

// Fetch with  payment
const fetchWithPayment = wrapFetchWithPayment(fetch, account);

// Get response
const response = await fetchWithPayment(url, {
  method: "POST",
  body: JSON.stringify({
    prompt: "A woman with long brown hair and blue eyes",
  }),
  headers: {
    "Content-Type": "application/json",
  },
});

Last updated