First you need to claim access to an API key. We have an OpenAI API key available for testing purposes:

https://www.keypo.io/app/claim/0x63a601fd98b1e62b313b124f6c6366bc031c2a6d

In your IDE, import the @keypo/core and @keypo/api-client packages as well as ethers for configuring your wallet:

import { init } from "@keypo/core";
import { ApiClient } from "@keypo/api-client";
import { ethers } from 'ethers';

Initialize your wallet:

const PK = process.env.PK;
const RPC_URL = process.env.RPC_URL;
const provider = new ethers.providers.JsonRpcProvider(RPC_URL);
const wallet = new ethers.Wallet(PK, provider);

Initialize Keypo using your wallet address (same wallet used to claim access to the API key):

const keypo = await init(wallet.address);

Now you can initialize the API client and make API calls using your wallet! Make sure the string passed as the second variable in ApiClient matches the file name from the claim page.

const apiClient = new ApiClient(keypo, "openAIKey.txt");
    const response = await apiClient.call({
        method: "POST",
        url: "<https://api.openai.com/v1/chat/completions>",
        headers: {
            "Content-Type": "application/json",
            "Authorization": "Bearer ${apiKey}"
        },
        body: {
            model: "gpt-3.5-turbo",
            messages: [{ role: "user", content: "Write one sentence about a cat" }]
        }
    });