Base sa kahibalo Mga Developer
Ang balanse, top-ups ug keys
Tan-awa ang imong kinahanglanon, top up sa Lightning, top up automatically gikan sa imong bag-o, tan-awa ang unsa ang kinahanglanon, ug sa paghimo sa mga keys gikan sa code.
Kini nga panid gihubad sa makina alang sa kasayon. Ang English nga orihinal mao ang bersyon nga magamit.
Ang balanse
Ang duha sa imong balanse, ug unsay sa kapusanan niini nga key mao ang gigamit.
GET https://nymbot.ai/api/v1/credits/balance Gikan sa usa ka API key. POST Dili usab, alang sa mga kliyente nga nagtan-aw niini.
balance mao ang duha ka balanse sama sa dolyar sa kasalukuyan nga presyo sa Bitcoin, alang sa mga instrumento nga nagatigom sa usa ka single number (null Ang ubang mga dapit mao ang sa credits ug sats, nga mao ang kung unsa ang mga balanse sa katapusan. key Ang usa ka key nga nahibal-an sa iyang cap, ug ang usa ka key nga nahibal-an sa iyang cap, ug ang usa ka key nga nahibal-an sa iyang cap.
Tungod niini
{
"balance": 49.18,
"balance_sats": 42037,
"standard": { "credits": 120.4, "sats": 1204 },
"pro": { "credits": 408.33, "sats": 40833 },
"key": {
"id": "4f0c9a1be27d3856",
"name": "laptop scripts",
"limit_sats": 20000,
"period_used_sats": 3412,
"total_used_sats": 18230,
"reset_period": "monthly",
"reset_at": "2026-10-01T00:00:00Z"
}
}
| Ang status | Ang |
|---|---|
401 | Ang key mao ang missing, unknown, revoked o gikuha. |
cURL
curl https://nymbot.ai/api/v1/credits/balance \
-H "Authorization: Bearer $NYMBOT_API_KEY"
Python
import os
import requests
res = requests.get(
"https://nymbot.ai/api/v1/credits/balance",
headers={"Authorization": "Bearer " + os.environ["NYMBOT_API_KEY"]},
)
balance = res.json()
print(balance["standard"]["sats"], balance["pro"]["sats"])
JavaScript
const res = await fetch("https://nymbot.ai/api/v1/credits/balance", {
headers: { "Authorization": "Bearer " + process.env.NYMBOT_API_KEY },
});
const balance = await res.json();
console.log(balance.standard.sats, balance.pro.sats);
Ang pagbayad sa
Unsaon sa pag-usab, ug ang mga limitasyon. Lightning mao ang usa ka methode.
GET https://nymbot.ai/api/v1/topup/payment-methods maayo ang key.
Ang usa ka top-up mao ang 10 ngadto sa 1,000,000 sats; ang usa ka Pro top-up kinahanglan nga buhi ang usa ka Pro credit, aron kini nagsimula sa 100 sats. bulk_bonus gitawag ang extra credit sa mas dakong top-ups, sama sa sa app: 10%, 15% o 20% higayon sa standard top-ups gikan sa 500, 1,000 o 5,000 sats, ug sa Pro top-ups gikan sa 5,000, 10,000 o 50,000 sats.
Tungod niini
{
"supported_methods": [
{
"method": "btc-lightning",
"display_name": "Bitcoin Lightning",
"supported_currencies": ["SATS", "USD", "BTC"],
"limits": {
"SATS": { "min": 10, "max": 1000000 },
"USD": { "min": 0.02, "max": 1170 },
"BTC": { "min": 1e-7, "max": 0.01 }
},
"tiers": ["standard", "pro"],
"default_tier": "pro",
"tier_min_sats": { "standard": 10, "pro": 100 },
"sats_per_credit": { "standard": 10, "pro": 100 },
"bulk_bonus": [
{ "bonus": 0.1, "standard_sats": 500, "pro_sats": 5000 },
{ "bonus": 0.15, "standard_sats": 1000, "pro_sats": 10000 },
{ "bonus": 0.2, "standard_sats": 5000, "pro_sats": 50000 }
]
}
]
}
cURL
curl https://nymbot.ai/api/v1/topup/payment-methods
Python
import requests
methods = requests.get("https://nymbot.ai/api/v1/topup/payment-methods").json()
print(methods["supported_methods"][0]["limits"])
JavaScript
const methods = await (await fetch("https://nymbot.ai/api/v1/topup/payment-methods")).json();
console.log(methods.supported_methods[0].limits);
Ang yuta palibot sa Lightning
Gikan sa usa ka Lightning bill nga nagpadala sa credit sa nym ang key sa. Pagbayad niini gikan sa bisan unsa nga Lightning wallet, unya Ang Ipahamtang ang credit.
POST https://nymbot.ai/api/v1/topup/create/btc-lightning Gikan sa usa ka API key.
| Ang | Ang | Naa kay | Ang opisina |
|---|---|---|---|
amount | Ang numero | Oo | Unsa ang, sa currencyAng ilang mga numero mao ang sats. |
currency | Ang | maayo | SATS Ang hari kay sa inyo. USD Ang BTCAng mga dolyar mao ang konvert sa kasalukuyan nga presyo sa Bitcoin. |
tier | Ang | maayo | pro Ang yuta palibot sa standardUnsa ang balanse sa kredito? |
Ang usa ka standard credit mao ang 10 sats ug usa ka Pro credit 100 sats, plus bisan unsa nga bulk bonus;
credits Gikan sa pag-usab niini nga impormasyon.
Tungod niini
{
"invoice_id": "b7d41e0c95a2f38e6c1d0e9a4b7f2c61d3e8a05f9b2c4d7e1a6f3b8c0d5e2a9f4",
"payment_request": "lnbc100u1p5...",
"amount_sats": 10000,
"credits": 115,
"tier": "pro",
"expires_at": "2026-09-30T09:27:00Z",
"status": "pending"
}
| Ang status | Ang |
|---|---|
400 | Hapit nalukop sa kaumahan ang palibot sa Zapyškis.[5]unsupported_methodAng c - c - c - c - c - c - c - c - c - c - c - c - cunsupported_currencyAdunay nangutana, “O Mensahero ni Allah, kinsa ang makasulod sa Paraiso?”amount_too_smallAlang sa ubang mga dapit sa mao gihapon nga ngalan, tan-awa ang (amount_too_largeAdunay nangutana, “O Mensahero ni Allah, kinsa ang makasulod sa Paraiso?”amount_out_of_range). |
429 | Alang sa ubang mga dapit sa mao gihapon nga ngalan, tan-awa ang 120 ka molupyo.[1]rate_limit_exceededAng Retry-After). |
502 | Maayo tanan ang resulta (invoice_unavailableAng Retry-After). |
cURL
curl https://nymbot.ai/api/v1/topup/create/btc-lightning \
-H "Authorization: Bearer $NYMBOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"amount": 10000, "currency": "SATS", "tier": "pro"}'
Python
import os
import requests
res = requests.post(
"https://nymbot.ai/api/v1/topup/create/btc-lightning",
headers={"Authorization": "Bearer " + os.environ["NYMBOT_API_KEY"]},
json={"amount": 10000, "currency": "SATS", "tier": "pro"},
)
invoice = res.json()
print(invoice["payment_request"])
JavaScript
const res = await fetch("https://nymbot.ai/api/v1/topup/create/btc-lightning", {
method: "POST",
headers: {
"Authorization": "Bearer " + process.env.NYMBOT_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ amount: 10000, currency: "SATS", tier: "pro" }),
});
const invoice = await res.json();
console.log(invoice.payment_request);
Maayo kaayo ang top-up.
Nagtan-aw kon unsa ang impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon sa impormasyon. creditedPag-checking taas sa pag-usab mao ang sigurado: ang credit landes usa ka beses, bisan unsa ang pipila ka beses nga nagtan-aw.
GET https://nymbot.ai/api/v1/topup/status/{invoice_id} — gikinahanglan ang usa ka key gikan sa nym nga gihimo ang invoice.
status Ang pending Wala na lang ta kahibaw, paid Wala, wala sila muadto sa sine gabii. credited Unsay iyang gitudlo kanila bahin niini? expired (Ang Pinadayag :) Apan gilupig sila; ug wala nay dapit pa alang kanila didto sa langit.
Tungod niini
{
"invoice_id": "b7d41e0c95a2f38e6c1d0e9a4b7f2c61d3e8a05f9b2c4d7e1a6f3b8c0d5e2a9f4",
"status": "credited",
"amount_sats": 10000,
"credits": 115,
"tier": "pro",
"expires_at": null,
"balance_credits": 523.33,
"balance_sats": 52333
}
| Ang status | Ang |
|---|---|
400 | Ang id dili ang 64-karakter nga id gikan sa creation call. |
404 | Hapit nalukop sa kaumahan ang palibot sa Zapyškis.[5]invoice_not_found). |
cURL
curl https://nymbot.ai/api/v1/topup/status/$INVOICE_ID \
-H "Authorization: Bearer $NYMBOT_API_KEY"
Python
import os, time
import requests
headers = {"Authorization": "Bearer " + os.environ["NYMBOT_API_KEY"]}
url = "https://nymbot.ai/api/v1/topup/status/" + invoice["invoice_id"]
while True:
status = requests.get(url, headers=headers).json()["status"]
if status in ("credited", "expired"):
break
time.sleep(3)
print(status)
JavaScript
const headers = { "Authorization": "Bearer " + process.env.NYMBOT_API_KEY };
const url = "https://nymbot.ai/api/v1/topup/status/" + invoice.invoice_id;
let status;
do {
await new Promise((r) => setTimeout(r, 3000));
status = (await (await fetch(url, { headers })).json()).status;
} while (status !== "credited" && status !== "expired");
console.log(status);
Tungod niini,
Ang usa ka linya sa matag pagtan-aw: unsa ang mao, unsa ang modelo, unsa ang mga token, ug unsa ang kinatibuk-ang kinahanglanon. Walang mga prompts o mga tubag wala magpatalinghog, aron ang usa ka wala magpatalinghog. Ang mga linya magpatalinghog alang sa 90 ka adlaw, ang pinakabag-o sa unang. Ang usa ka key nga nakuha ang iyang cap wala pa mahitungod sa pagtan-aw sa iyang history.
GET https://nymbot.ai/api/v1/queries/history — kinahanglan ang usa ka API key, nga makita ang iyang mga requests, o sa usa ka Ang petisyon sa imong nym, nga makita sa tanan nga mga key.
| Ang | Ang | Naa kay | Ang opisina |
|---|---|---|---|
page | Ang tanan maayo. | maayo | Ang default 1, sa labing taas nga 1,000; ang usa ka taas nga panid mao ang 400 invalid_value. |
page_count | Ang tanan maayo. | maayo | Pag-usab sa 20 nga mga panid, sa labing taas nga 100. |
start_dateend_date | Tungod niini, ang | maayo | ISO 8601 Ang mga petsa o mga oras. |
model | Tungod niini, ang | maayo | Kini mao ang modelo. |
type | Tungod niini, ang | maayo | chat, responses, messages, image, video, speech, transcription Ang embedding. |
all_keys | Ang tanang tawo (Query) | maayo | Ang usa ka key: true Kini mao ang usa ka bahin sa pag-uswag sa mga tawo.Default. false. |
key_id | Tungod niini, ang | maayo | Alang sa ubang mga dapit sa mao gihapon nga ngalan, o sa all_keys=trueKini mao ang key. |
Tungod niini
{
"data": [
{
"id": "q_71c4e9a0",
"timestamp": "2026-09-30T08:12:00Z",
"model": "anthropic/claude-sonnet-5",
"type": "chat",
"input_tokens": 1240,
"output_tokens": 380,
"cached_tokens": 0,
"cost_sats": 16.2,
"cost_usd": 0.01895,
"balance": "pro",
"key_id": "4f0c9a1be27d3856",
"web_search": false,
"status": "ok"
}
],
"pagination": { "page": 1, "page_count": 20, "total": 311, "total_pages": 16 }
}
cURL
curl "https://nymbot.ai/api/v1/queries/history?page_count=50&type=chat" \
-H "Authorization: Bearer $NYMBOT_API_KEY"
Python
import os
import requests
res = requests.get(
"https://nymbot.ai/api/v1/queries/history",
headers={"Authorization": "Bearer " + os.environ["NYMBOT_API_KEY"]},
params={"page_count": 50, "type": "chat"},
)
for row in res.json()["data"]:
print(row["timestamp"], row["model"], row["cost_sats"])
JavaScript
const res = await fetch("https://nymbot.ai/api/v1/queries/history?page_count=50&type=chat", {
headers: { "Authorization": "Bearer " + process.env.NYMBOT_API_KEY },
});
for (const row of (await res.json()).data) console.log(row.timestamp, row.model, row.cost_sats);
Pagtuon sa mga requests
Ang paghimo, pagpalambo ug pag-revoke keys, ang account summary ug ang automatic top-ups dili makahimo sa usa ka API key. sila makahimo sa usa ka signature gikan sa imong nym, aron ang usa ka leaked key makahimo sa pag-usab sa iyang cap, apan wala pa makahimo sa usa ka lain-laing key o makahimo sa iyang kap.
Ang app naghimo niini alang kanimo: ang tanan sa iyang Ang tanang Kini mao ang usa ka bahin alang sa pag-manage sa mga key gikan sa imong code.
Ang signature mao ang usa ka Nostr event sa matang sa 27235 (NIP-98), nga gipaila base64-coded sa
Authorization Ang header mao ang Nostr Adunay nangutana:
Ang event
{
"kind": 27235,
"created_at": 1790726400,
"tags": [
["u", "https://nymbot.ai/api/v1/keys"],
["method", "POST"],
["nonce", "9c4e21f07a3b...16 random bytes in hex"],
["payload", "3f1a0d7c8e2b...sha256 of the exact request body in hex"]
],
"content": "",
"pubkey": "your public key in hex",
"id": "...",
"sig": "..."
}
uKini mao ang tinuod nga URL sa request, nga naglakip sa string sa query, sama sa nagpadala.methodKini mao ang usa ka HTTP method.payloadmao ang SHA-256 sa raw request body, sa hex.POSTugPATCHUnsay iyang gitudlo kanila bahin sa pag-abiabi?created_atKini kinahanglan nga moabut sa 60 segundo gikan sa server nga oras.- Ang mga tawo nagpatin-aw sa usa ka adlaw, a
GETGikan sa pag-uswag sa usa ka bahin sa pag-uswag sa usa ka bahin sa pag-uswag sa usa ka bahin.nonceAng tag mao ang usa ka random value sa diha nga duha ka mga requests signed sa sama nga segundo wala pa nagkaila. - Ang body sa usa ka signature request mahimong sa maximum 64 KB, ug ang body kinahanglan
Content-Type: application/json.
Maayo na lang kay maayo ang event. 401 missing_nostr_auth; ang usa nga dili formed, dili signed, kaayo na, o alang sa usa ka lain-laing URL, method o body returns
invalid_nostr_authHapit nalukop sa kaumahan ang palibot sa Zapyškis.[5]
nostr_auth_replayedAng usa ka API key nga gitawag ngadto sa mga endpoints mao ang gikuha. Ang signature mao ang checked tungod sa pagtan-aw sa lawas, ug ang matag address mahimo sa 30 ka beses sa usa ka minuto (ang usa ka IPv6 address gitawag ingon sa iyang tibuok /64); sa dihang kini makuha 429 Ang
Retry-After.
Alang sa ubang mga dapit sa mao gihapon nga ngalan, tan-awa ang Nymbot (https://nymbot.ai,
https://nymchat.app Alang sa ubang mga dapit sa mao gihapon nga ngalan, tan-awa ang CORS headers.
OriginMaayo tanan ang epekto.
Ang signing kinahanglan nga ang imong nym's secret key (ang nsec), nga kontrolado sa tanan: ang imong identidad, ang imong kasaysayan ug ang imong balanse. I-set niini lamang sa usa ka script sa usa ka makina nga imong panginahanglan, basahin kini gikan sa mga dapit sa pag-usab niini ngadto sa mga file, ug prefer sa app sa diha nga imong makahimo.
Kini nga mga kasakit sa paghimo sa header. Ang mga ulahi nga mga halimbawa sa niini nga pahina naggamit niini. sila makakita sa secret key sa hex gikan sa NOSTR_SECRET_HEXAng CURL usa sa usa ka
Ang Mga tool sa command-line, nga adunay usa ka nsec o hex key, ug sha256sum Ang tanan, shasum -a 256).
cURL
nostr_auth() {
method="$1"; url="$2"; body="$3"
nonce=$(openssl rand -hex 16)
if [ -n "$body" ]; then
hash=$(printf '%s' "$body" | sha256sum | cut -d' ' -f1)
event=$(nak event --sec "$NOSTR_SECRET_HEX" -k 27235 -t "u=$url" -t "method=$method" -t "nonce=$nonce" -t "payload=$hash")
else
event=$(nak event --sec "$NOSTR_SECRET_HEX" -k 27235 -t "u=$url" -t "method=$method" -t "nonce=$nonce")
fi
printf 'Nostr %s' "$(printf '%s' "$event" | base64 | tr -d '\n')"
}
Python
# pip install coincurve requests
import base64, hashlib, json, os, time
from coincurve import PrivateKey, PublicKeyXOnly
SECRET = bytes.fromhex(os.environ["NOSTR_SECRET_HEX"])
def nostr_auth(method, url, body=b""):
pubkey = PublicKeyXOnly.from_secret(SECRET).format().hex()
tags = [["u", url], ["method", method], ["nonce", os.urandom(16).hex()]]
if body:
tags.append(["payload", hashlib.sha256(body).hexdigest()])
created_at = int(time.time())
serialized = json.dumps([0, pubkey, created_at, 27235, tags, ""], separators=(",", ":"), ensure_ascii=False)
event_id = hashlib.sha256(serialized.encode()).digest()
event = {
"id": event_id.hex(),
"pubkey": pubkey,
"created_at": created_at,
"kind": 27235,
"tags": tags,
"content": "",
"sig": PrivateKey(SECRET).sign_schnorr(event_id).hex(),
}
return "Nostr " + base64.b64encode(json.dumps(event).encode()).decode()
JavaScript
// npm install nostr-tools
import { createHash, randomBytes } from "node:crypto";
import { finalizeEvent } from "nostr-tools/pure";
const secret = Buffer.from(process.env.NOSTR_SECRET_HEX, "hex");
export function nostrAuth(method, url, body = "") {
const tags = [["u", url], ["method", method], ["nonce", randomBytes(16).toString("hex")]];
if (body) tags.push(["payload", createHash("sha256").update(body).digest("hex")]);
const event = finalizeEvent(
{ kind: 27235, created_at: Math.floor(Date.now() / 1000), tags, content: "" },
secret,
);
return "Nostr " + Buffer.from(JSON.stringify(event)).toString("base64");
}
Ang koneksyon sa
Unsay gipakita sa API sheet sa app sa ibabaw: ang imong public key, ang duha balances, unsa ka ka mga keys active (non revoked o expired), ug ang Ang mga top-up Ang mga tawo, o
null Unsa ang server maayo alang niini?
GET https://nymbot.ai/api/v1/account Naa kay Ang petisyon.
Tungod niini
{
"data": {
"pubkey": "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d",
"balances": {
"standard": { "credits": 120.4, "sats": 1204 },
"pro": { "credits": 408.33, "sats": 40833 }
},
"keys_active": 3,
"nwc_auto_topup": {
"connected": true, "threshold_sats": 5000, "topup_sats": 20000, "tier": "pro",
"last_topup_at": null, "last_topup_sats": null, "last_error": null
}
}
}
cURL
URL=https://nymbot.ai/api/v1/account
curl "$URL" -H "Authorization: $(nostr_auth GET "$URL")"
Python
import requests
url = "https://nymbot.ai/api/v1/account"
print(requests.get(url, headers={"Authorization": nostr_auth("GET", url)}).json())
JavaScript
const url = "https://nymbot.ai/api/v1/account";
const res = await fetch(url, { headers: { "Authorization": nostrAuth("GET", url) } });
console.log(await res.json());
Ang mga key
Ang mga endpoints ubos sa listahan sa key sa app. Ang tanan niini kinahanglan nga usa ka Ang petisyonAng matag key gibalik niini nga form, uban sa mga times sa ISO 8601 ug mga halos sa sats:
Ang objekto
{
"id": "4f0c9a1be27d3856",
"name": "laptop scripts",
"hint": "sk-nymbot-Qm7x…c2Lw",
"limit_sats": 20000,
"reset_period": "monthly",
"reset_at": "2026-10-01T00:00:00Z",
"expire_at": null,
"period_used_sats": 3412,
"total_used_sats": 18230,
"created_at": "2026-08-14T09:21:07Z",
"updated_at": "2026-09-02T17:40:55Z",
"last_used_at": "2026-09-30T08:12:00Z",
"revoked_at": null
}
hint Kini mao ang gidaghanon alang sa pag-uswag sa usa ka key, ug wala pa sa pag-uswag niini.
Ang mga key
GET https://nymbot.ai/api/v1/keys Ipahamtang ang
| Ang | Ang | Naa kay | Ang opisina |
|---|---|---|---|
include_revoked | Ang tanang tawo (Query) | maayo | Gikan sa pag-uswag ug pag-uswag. default false. |
Tungod niini
{ "data": [ { "id": "4f0c9a1be27d3856", "name": "laptop scripts", "hint": "sk-nymbot-Qm7x…c2Lw", "...": "..." } ] }
cURL
URL=https://nymbot.ai/api/v1/keys
curl "$URL" -H "Authorization: $(nostr_auth GET "$URL")"
Python
import requests
url = "https://nymbot.ai/api/v1/keys"
for key in requests.get(url, headers={"Authorization": nostr_auth("GET", url)}).json()["data"]:
print(key["id"], key["name"], key["period_used_sats"], key["limit_sats"])
JavaScript
const url = "https://nymbot.ai/api/v1/keys";
const { data } = await (await fetch(url, { headers: { "Authorization": nostrAuth("GET", url) } })).json();
for (const key of data) console.log(key.id, key.name, key.period_used_sats, key.limit_sats);
Kini ang key
POST https://nymbot.ai/api/v1/keys Dili sila kaayo. 201.
| Ang | Ang | Naa kay | Ang opisina |
|---|---|---|---|
name | Ang | Oo | 1 ngadto sa 40 characters, lain-laing sa imong lain-laing active keys (ngalantahan sa kaso). |
limit_sats | Ang | maayo | Ang gasto cap sa sats, sa halos 1. Magpadala niini alang sa wala pa cap. |
reset_period | Ang | maayo | daily, weekly Ang monthlyNaa kay limit_satsIpahamtang kini alang sa usa ka cap nga wala pa reset. |
expire_at | Ang tinuod nga integer | maayo | Sa diha nga ang key nagtrabaho: usa ka ISO 8601 oras, o miliseconds gikan sa 1970. |
Ang tanang (201)
{
"data": {
"id": "4f0c9a1be27d3856",
"name": "laptop scripts",
"hint": "sk-nymbot-Qm7x…c2Lw",
"limit_sats": 20000,
"reset_period": "monthly",
"key": "sk-nymbot-Qm7x...c2Lw",
"...": "the rest of the key object"
}
}
| Ang status | Ang |
|---|---|
400 | Ang ubang mga dapit sa mao gihapon nga ngalan (duplicate_name(Ang Pinadayag :) Apan gilupig sila; ug wala nay dapit pa alang kanila didto sa langit.unknown_parameterAdunay 25 ka molupyo.[1]too_many_keys). |
429 | Alang sa ubang mga dapit sa mao gihapon nga ngalan, tan-awa ang 120 ka molupyo.[1]rate_limit_exceededAng Retry-After). |
cURL
URL=https://nymbot.ai/api/v1/keys
BODY='{"name":"laptop scripts","limit_sats":20000,"reset_period":"monthly"}'
curl "$URL" \
-H "Authorization: $(nostr_auth POST "$URL" "$BODY")" \
-H "Content-Type: application/json" \
-d "$BODY"
Python
import json
import requests
url = "https://nymbot.ai/api/v1/keys"
body = json.dumps({"name": "laptop scripts", "limit_sats": 20000, "reset_period": "monthly"}).encode()
res = requests.post(
url,
data=body,
headers={"Authorization": nostr_auth("POST", url, body), "Content-Type": "application/json"},
)
print(res.json()["data"]["key"])
JavaScript
const url = "https://nymbot.ai/api/v1/keys";
const body = JSON.stringify({ name: "laptop scripts", limit_sats: 20000, reset_period: "monthly" });
const res = await fetch(url, {
method: "POST",
headers: { "Authorization": nostrAuth("POST", url, body), "Content-Type": "application/json" },
body,
});
console.log((await res.json()).data.key);
Kusog kaayo ang key
GET https://nymbot.ai/api/v1/keys/{id} Ipahamtang ang
Ang {"data": {…}} Ang bahin sa objekto, o 404
key_not_found Kung wala sa imong key ang id niini.
cURL
URL=https://nymbot.ai/api/v1/keys/4f0c9a1be27d3856
curl "$URL" -H "Authorization: $(nostr_auth GET "$URL")"
Python
import requests
url = "https://nymbot.ai/api/v1/keys/4f0c9a1be27d3856"
print(requests.get(url, headers={"Authorization": nostr_auth("GET", url)}).json()["data"])
JavaScript
const url = "https://nymbot.ai/api/v1/keys/4f0c9a1be27d3856";
console.log((await (await fetch(url, { headers: { "Authorization": nostrAuth("GET", url) } })).json()).data);
Unsa ang key
PATCH https://nymbot.ai/api/v1/keys/{id} Ipahamtang ang
Magpatingin sa tanan name, limit_sats, reset_period ug
expire_atSama sa mga prinsipyo sa pagpakigsulti sa usa ka key. null Maayo kaayo ang mga butang sa pag-uswag ug pag-uswag sa mga butang sa pag-uswag ug pag-uswag. (400 key_revokedAng balik
{"data": {…}} Ang mga bahin sa object key.
cURL
URL=https://nymbot.ai/api/v1/keys/4f0c9a1be27d3856
BODY='{"limit_sats":50000,"expire_at":null}'
curl -X PATCH "$URL" \
-H "Authorization: $(nostr_auth PATCH "$URL" "$BODY")" \
-H "Content-Type: application/json" \
-d "$BODY"
Python
import json
import requests
url = "https://nymbot.ai/api/v1/keys/4f0c9a1be27d3856"
body = json.dumps({"limit_sats": 50000, "expire_at": None}).encode()
res = requests.patch(
url,
data=body,
headers={"Authorization": nostr_auth("PATCH", url, body), "Content-Type": "application/json"},
)
print(res.json()["data"])
JavaScript
const url = "https://nymbot.ai/api/v1/keys/4f0c9a1be27d3856";
const body = JSON.stringify({ limit_sats: 50000, expire_at: null });
const res = await fetch(url, {
method: "PATCH",
headers: { "Authorization": nostrAuth("PATCH", url, body), "Content-Type": "application/json" },
body,
});
console.log((await res.json()).data);
Unsa ang key
DELETE https://nymbot.ai/api/v1/keys/{id} Ipahamtang ang
Unsaon sa pag-usab sa mga butang sa listahan sa mga butang sa listahan sa mga butang sa listahan revoked_at Ang yuta palibot sa include_revoked=trueKini mao ang usa ka labing taas nga bahin sa 50 ka mga bahin; kini mao ang usa ka labing taas nga bahin sa 50 ka bahin sa mga bahin.
Tungod niini
{ "data": { "id": "4f0c9a1be27d3856", "revoked": true } }
cURL
URL=https://nymbot.ai/api/v1/keys/4f0c9a1be27d3856
curl -X DELETE "$URL" -H "Authorization: $(nostr_auth DELETE "$URL")"
Python
import requests
url = "https://nymbot.ai/api/v1/keys/4f0c9a1be27d3856"
print(requests.delete(url, headers={"Authorization": nostr_auth("DELETE", url)}).json())
JavaScript
const url = "https://nymbot.ai/api/v1/keys/4f0c9a1be27d3856";
const res = await fetch(url, { method: "DELETE", headers: { "Authorization": nostrAuth("DELETE", url) } });
console.log(await res.json());
Alang sa ubang mga dapit sa mao gihapon nga ngalan, tan-awa ang Auto-top-up.
I-connect ang usa ka Lightning wallet uban sa Nostr Wallet Connect ug ang Nymbot moapil sa usa ka balanse sa diha nga ang mga gasto sa API moapil niini. Ang API sheet sa app adunay sama nga mga setting; kini mao ang mga endpoints ubos niini. Ang petisyon.
Kon unsaon pagtrabaho: sa dihang ang usa ka API request gibutang sa balanse nga imong pagpili sa pagtan-aw, sa diha nga ang balanse moabut sa ubos sa imong threshold, ang Nymbot naghimo sa usa ka faktura alang sa imong top-up amount, nagpadala sa imong wallet sa pagbayad niini, ug nagdugang sa credit. Kini naghimo sa maximum sa usa ka beses sa 5 minutos alang sa matag nym ug balanse, aron ang usa ka bug sa mga requests dili makabaton sa wallet. Gikan sa mga apps dili pagpatin-aw niini. Ang oras ug gidak-on sa pinakaduol nga top-up, ug ang pinakaduol nga error, anaa sa mga setting; kon ang usa ka pagbayad gihimo sa sulod sa usa ka error, pagpatin-aw sa iyang bill sa Ang status sa top-up Ipahamtang ang
Ang Nymbot makahimo niini nga encrypted ug nganong gamiton niini nga alang sa pagbayad sa iyang mga top-up invoices, apan paghimo sa usa ka koneksyon lamang alang niini, uban sa usa ka gasto budget sa imong wallet, aron ang labing maayo nga siya mahimong magbayad mao ang usa ka numero nga gipili ka. pay_invoice.
Unsaon paghubad ug wallet
POST https://nymbot.ai/api/v1/nwc-auto-topup/connect Ipahamtang ang
| Ang | Ang | Naa kay | Ang opisina |
|---|---|---|---|
nwc_url | Ang | Oo | Ang koneksyon sa string, nga nagsimula nostr+walletconnect://Nymbot nagpadala sa wallet alang sa get_info Bisan pa niana, wala gyud ko nagtuga-tuga ug usab pa. |
threshold_sats | Ang | Oo | Gikan sa ibabaw sa kada ang balanse moabut sa ubos niini nga ilang sats. Sa ubos sa 1,000. |
topup_sats | Ang | Oo | Unsa ang gidaghanon sa pag-abot sa 1,000 ngadto sa 1,000,000 sats? |
tier | Ang | maayo | pro Ang yuta palibot sa standard: ang balanse sa pagtan-aw ug top up. |
Tungod niini
{
"data": {
"connected": true,
"threshold_sats": 5000,
"topup_sats": 20000,
"tier": "pro",
"last_topup_at": null,
"last_topup_sats": null,
"last_error": null
}
}
| Ang status | Ang |
|---|---|
400 | Maayo gani kay maayo ang sayop (invalid_nwc_urlHapit nalukop sa kaumahan ang palibot sa Zapyškis.[5]nwc_unreachableHapit nalukop sa kaumahan ang palibot sa Zapyškis.[5]nwc_rejectedMaayo gani kay maayo ang sayop (nwc_missing_permission); o sa usa ka halos sa mga limitasyon. |
501 | Hapit nalukop sa kaumahan ang palibot sa Zapyškis.[5]nwc_unavailable2 Ang ubang mga dapit sa mao gihapon nga ngalan gikinahanglan. |
cURL
URL=https://nymbot.ai/api/v1/nwc-auto-topup/connect
BODY='{"nwc_url":"nostr+walletconnect://...","threshold_sats":5000,"topup_sats":20000,"tier":"pro"}'
curl "$URL" \
-H "Authorization: $(nostr_auth POST "$URL" "$BODY")" \
-H "Content-Type: application/json" \
-d "$BODY"
Python
import json, os
import requests
url = "https://nymbot.ai/api/v1/nwc-auto-topup/connect"
body = json.dumps({
"nwc_url": os.environ["NWC_URL"],
"threshold_sats": 5000,
"topup_sats": 20000,
"tier": "pro",
}).encode()
res = requests.post(
url,
data=body,
headers={"Authorization": nostr_auth("POST", url, body), "Content-Type": "application/json"},
)
print(res.json())
JavaScript
const url = "https://nymbot.ai/api/v1/nwc-auto-topup/connect";
const body = JSON.stringify({
nwc_url: process.env.NWC_URL,
threshold_sats: 5000,
topup_sats: 20000,
tier: "pro",
});
const res = await fetch(url, {
method: "POST",
headers: { "Authorization": nostrAuth("POST", url, body), "Content-Type": "application/json" },
body,
});
console.log(await res.json());
Ipahamtang ang mga setting
GET https://nymbot.ai/api/v1/nwc-auto-topup Ipahamtang ang
Nagpatin-aw ang sama nga object sa paghubad, uban sa connected: false Ang ubang mga dapit sa
null sa wala pa ang wallet konektado. Ang konektado nga string wala pa moabut.
cURL
URL=https://nymbot.ai/api/v1/nwc-auto-topup
curl "$URL" -H "Authorization: $(nostr_auth GET "$URL")"
Python
import requests
url = "https://nymbot.ai/api/v1/nwc-auto-topup"
print(requests.get(url, headers={"Authorization": nostr_auth("GET", url)}).json())
JavaScript
const url = "https://nymbot.ai/api/v1/nwc-auto-topup";
console.log(await (await fetch(url, { headers: { "Authorization": nostrAuth("GET", url) } })).json());
Ang koneksyon
DELETE https://nymbot.ai/api/v1/nwc-auto-topup/connection Ipahamtang ang
Gikan sa pag-alagad nga koneksyon string. Wala gihapon nga top-ups nga gihimo. Para sa pagtan-aw, ikaw usab mahimo sa pag-revoke ang koneksyon sa imong wallet.
Tungod niini
{ "data": { "connected": false, "threshold_sats": null, "topup_sats": null, "tier": null, "last_topup_at": null, "last_topup_sats": null, "last_error": null } }
cURL
URL=https://nymbot.ai/api/v1/nwc-auto-topup/connection
curl -X DELETE "$URL" -H "Authorization: $(nostr_auth DELETE "$URL")"
Python
import requests
url = "https://nymbot.ai/api/v1/nwc-auto-topup/connection"
print(requests.delete(url, headers={"Authorization": nostr_auth("DELETE", url)}).json())
JavaScript
const url = "https://nymbot.ai/api/v1/nwc-auto-topup/connection";
const res = await fetch(url, { method: "DELETE", headers: { "Authorization": nostrAuth("DELETE", url) } });
console.log(await res.json());
Pagbayad sa Pagpangita uban sa Unang Key
Ang fixed-price endpoints makahimo alang sa usa ka request sa usa ka panahon sa Lightning, uban sa bisan unsa nga key, bisan unsa nga account ug bisan unsa nga balanse: POST /images/generations, POST /images/edits,
POST /videos, POST /audio/speech, POST /audio/transcriptions,
POST /audio/translations ug POST /embeddingsChat, Responses, ug Mga mensahe hangtod karon kinahanglan nga usa ka key. Ang usa ka request nga adunay usa ka key gibutang ngadto sa balanse sama sa usa ka normal; ang pag-payment flow lamang nagpatin-aw sa wala pa ang key.
Ang Nymbot naghisgot sa duha ka bersyon sa sama nga idea, gikan sa usa ka backend: Lightning Labs'
Ang 402 (Ang ngalan niini gitawag ug ang ngalan niini). LSATAng proyekto sa IETF
Ang pagbayad Ang HTTP authentication scheme anaa sa lightning Ang
charge Unsaon sa pag-usab sa imong mga kliyente.
Pagbayad uban sa usa ka key mao ang sa API_L402_SECRET Adunay ang 32 ka byte, sama sa hex (64 ka karakter) o base64 (44). openssl rand -hex 32Alang sa ubang mga dapit sa mao gihapon nga ngalan, tan-awa ang One Piece. API_L402_SECRET_PREVIOUS alang sa usa ka adlaw: ang mga credentials, status URLs ug mga challenge nga gihimo ubos niini magtrabaho hangtod sa pag-usab.
Ang challenge
Ipahamtang ang request sa No. Authorization Ako mao ang gilunsad, bisan unsa ang gihimo, ug ikaw 402 Payment Required sa usa ka faktura alang sa eksaktong unsa ang mga gastos sa pagtan-aw: ang sama nga presyo nga magbayad sa usa ka key, konvert sa 10 sats sa usa ka standard credit o 100 sats sa usa ka Pro credit ug rounded hangtod sa usa ka tibuok sat (ang halos 1 sat, ug ang halos 0.05 credit minimum). WWW-Authenticate Alang sa ubang mga dapit sa mao gihapon nga ngalan:
HTTP/1.1 402 Payment Required
Content-Type: application/problem+json; charset=utf-8
Cache-Control: no-store
WWW-Authenticate: L402 macaroon="AgJC...", invoice="lnbc2370n1..."
WWW-Authenticate: LSAT macaroon="AgJC...", invoice="lnbc2370n1..."
WWW-Authenticate: Payment id="kM9x...", realm="nymbot", method="lightning", intent="charge",
request="eyJhbW91bnQiOiIyMzciLC...", description="Nymbot API POST /images/generations (237 sats)",
digest="sha-256=:X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=:", expires="2026-09-30T12:15:00.000Z",
opaque="eyJlbmRwb2ludCI6IlBPU1QgL2ltYWdlcy9nZW5lcmF0aW9ucyJ9"
{
"type": "https://paymentauth.org/problems/payment-required",
"title": "Payment Required",
"status": 402,
"detail": "This request costs 237 sats. Pay the Lightning invoice, then send the identical request again ...",
"challengeId": "kM9x...",
"amount_sats": 237,
"invoice": "lnbc2370n1...",
"payment_hash": "9db1370f...",
"expires_at": "2026-09-30T12:15:00.000Z",
"error": { "message": "This request costs 237 sats. ...", "type": "payment_required", "code": "payment_required", "param": null }
}
Ang pagbayad request Ang usa ka parameter mao ang base64url JSON:
{"amount":"237","currency":"sat","methodDetails":{"invoice":"lnbc...","network":"mainnet","paymentHash":"..."}}.
Ang problema mao ang bahin sa final, sa Content-Type (sa media type ug, alang sa multipart, ang iyang limitasyon) ug sa SHA-256 sa eksakto nga body bytes nga imong magpadala, ug moabut sa 15 minutos. Ang Tungod niini, ang sama
Content-Type Hapit nalukop sa kaumahan ang palibot sa Zapyškis.[5]/images/edits, /audio/transcriptions, /audio/translationsAng labing taas nga library sa HTTP pagpili sa usa ka bag-o nga border sa matag usa ka panahon sa pag-encode sa usa ka form, aron sa pag-encode sa usa ka beses ug sa pagpadala sa duha ka beses ang mga byte.
Ang matag address mahimo sa pagpangita alang sa 30 mga problema sa matag minuto (ang usa ka IPv6 address gitawag alang sa iyang tibuok /64). Ang mga requests nga ang address dili mahibalo nagdala sa usa ka mas tibuok 10 sa matag minuto, ug adunay usa ka total nga cap sa mga problema sa Nymbot sa tibuok mga address; usa ka requests nga gihimo sa usa ka challenge (tan-awa, uban sa usa ka body nga dili gilunsad sa JSON) dili gitawag ngadto sa niini. 429 Ang Retry-AfterAng mga payload endpoints nga gitawag uban sa usa ka key o credential usab gitawag ngadto sa kinatibuk-ang limitasyon sa 120 unauthenticated requests matag minuto matag address. Content-Type maayo application/json (Ang
multipart/form-data Wala, wala sila muadto sa sine gabii. 415 Wala, wala sila muadto sa sine gabii.
Ang mga embeddings hinungdan gikan sa usa ka estimate sa mga token sa input, uban sa usa ka 1.5× margin, tungod kay ang real nga count mao ang mahitungod sa unya. Ang tanang token.
Ipahamtang ang pagbayad
Pagbayad sa kalikasan uban sa bisan unsa nga Lightning wallet. Ang wallet naghatag kaninyo sa preimage, 64 hex characters. Busa magpadala sa sama nga mga panginahanglan uban sa usa sa niini:
| Ang programa | Ang |
|---|---|
| Ang 402 | Authorization: L402 <macaroon>:<preimage> (LSAT Ang tanan ( |
| Ang pagbayad | Authorization: Payment <base64url JSON>Unsa ang JSON? {"challenge": {every parameter of the challenge, as sent}, "payload": {"preimage": "<hex>"}} |
Ang usa ka payloan nagpatin-aw sama sa usa nga gihimo uban sa usa ka key. nymbot
Ang objekto dili adunay mga field sa balanse: {"payment": "l402", "tier": "pro", "paid_sats": 237,
"charged_sats": 237}Naa kay wala X-Nymbot-Balance-Sats Ang usa ka pagbayad sa pag-payment scheme adunay usa ka Payment-Receipt ang header (base64url JSON uban sa challenge id, ang pagbayad hash sama sa reference, status ug
timestampAng pagbayad nga mga requests wala pag-alagad sa bisan unsa nga nym, aron sila dili makita sa history sa mga query.
| Ang status | Ang |
|---|---|
402 payment_already_used | Ang pag-usab mao ang usa ka bag-o nga challenge alang sa niini nga pag-usab, aron ang usa ka client nga caches ang iyang bag-o nga credential (sa lnget Maayo kaayo na lang kay pasumbingay. |
402 payment_mismatch | Alang sa ubang mga dapit sa mao gihapon nga ngalan, Content-Type o lawas, o bayad ubos pa kay kini nga kinahanglanon kini kosto. Ang bag-o nga challenge alang sa kini nga panan-awon gihimo uban niini; kon ang pagbayad mao ang mas maliit, ang imong bayad sa pagbalik ingon sa usa ka Ang tanang token (refund_token ug refund_sats Ang yuta palibot sa |
402 payment_expired | Alang sa ubang mga dapit sa mao gihapon nga ngalan, tan-awa ang 15 ka minuto. Ang tanang token (refund_token ug refund_sats Ang yuta palibot sa Bukhara kay hapit tanan walay tanom.[4] |
401 invalid_preimage | Ang preimage dili hash sa pagbayad nga hash sa faktura. Ang pagbayad dili gigamit. |
401 invalid_payment_credential | Ang credential mao ang malformed, nausab sa Nymbot sa pag-edition niini, o mga ngalan sa usa ka pagbayad hash Nymbot wala nag-edition sa usa ka faktura alang. |
429 rate_limit_exceeded | Alang sa ubang mga dapit sa mao gihapon nga ngalan, tan-awa ang 30 ka mga credentials o keys nga wala makahimo sa pag-verify gikan niini nga address sa usa ka minuto, o usa ka reimbursement token gipaabot sa 60 ka beses sa usa ka minuto. Retry-After. |
cURL
BODY='{"model":"nano-banana","prompt":"a lighthouse at dusk","response_format":"b64_json"}'
URL=https://nymbot.ai/api/v1/images/generations
# 1. Get the challenge
CH=$(curl -s -D - -o /dev/null "$URL" -H "Content-Type: application/json" -d "$BODY" | grep -i '^www-authenticate: L402')
MAC=$(echo "$CH" | sed -E 's/.*macaroon="([^"]+)".*/\1/')
INVOICE=$(echo "$CH" | sed -E 's/.*invoice="([^"]+)".*/\1/')
# 2. Pay $INVOICE with your wallet and copy the preimage
PREIMAGE=...
# 3. Send the identical request with the credential
curl "$URL" -H "Content-Type: application/json" -H "Authorization: L402 $MAC:$PREIMAGE" -d "$BODY"
lnget
# lnget (Lightning Labs) pays L402 challenges from your own lnd node and retries for you
lnget -X POST -H "Content-Type: application/json" \
-d '{"model":"nano-banana","prompt":"a lighthouse at dusk","response_format":"b64_json"}' \
https://nymbot.ai/api/v1/images/generations
Python
import base64, json, re
import requests
url = "https://nymbot.ai/api/v1/images/generations"
body = json.dumps({"model": "nano-banana", "prompt": "a lighthouse at dusk", "response_format": "b64_json"}).encode()
headers = {"Content-Type": "application/json"}
challenge = requests.post(url, data=body, headers=headers)
assert challenge.status_code == 402
info = challenge.json()
print("Pay", info["amount_sats"], "sats:", info["invoice"])
preimage = pay_with_your_wallet(info["invoice"]) # 64 hex characters
# L402
mac = re.search(r'L402 macaroon="([^"]+)"', challenge.headers["WWW-Authenticate"]).group(1)
res = requests.post(url, data=body, headers={**headers, "Authorization": f"L402 {mac}:{preimage}"})
print(res.json()["nymbot"])
JavaScript
const url = "https://nymbot.ai/api/v1/images/generations";
const body = JSON.stringify({ model: "nano-banana", prompt: "a lighthouse at dusk", response_format: "b64_json" });
const headers = { "Content-Type": "application/json" };
const challenge = await fetch(url, { method: "POST", headers, body });
const www = challenge.headers.get("www-authenticate");
// The Payment scheme: echo every challenge parameter back with the preimage
const start = www.indexOf("Payment ");
const params = Object.fromEntries([...www.slice(start + 8).matchAll(/(\w+)="((?:[^"\\]|\\.)*)"/g)].map((m) => [m[1], m[2]]));
const { invoice } = JSON.parse(Buffer.from(params.request, "base64url").toString()).methodDetails;
const preimage = await payWithYourWallet(invoice);
const credential = Buffer.from(JSON.stringify({ challenge: params, payload: { preimage } })).toString("base64url");
const res = await fetch(url, { method: "POST", headers: { ...headers, Authorization: `Payment ${credential}` }, body });
console.log((await res.json()).nymbot, res.headers.get("payment-receipt"));
Ang mga kliyente gibuhat sa mppx uban sa usa ka Lightning nga methode sa paghimo challenge sa mga tawo; point sila sa endpoint ug magbayad sila pagbayad.
Ang video
Ang pagbayad POST /videos Ang 202 Ako mao ang usa ka keyed one, plus a
status_url: GET Kini mao ang usa ka signature ug nagtrabaho alang sa 24 oras, sa diha nga ang trabaho mao ang gibuhat.
{
"id": "vid_...",
"status": "in_progress",
"status_url": "https://nymbot.ai/api/v1/videos/vid_...?exp=1790000000&sig=...",
"nymbot": {
"payment": "l402", "tier": "pro", "paid_sats": 4800, "charged_sats": 4800,
"refund_token": "REFUND-5E0B..."
}
}
Naa kay refund_token Hapit nalukop sa kaumahan ang palibot sa Zapyškis.[4]GET /api/v1/l402/refunds Ang "status": "pending"(Ang Pinadayag :) Apan gilupig sila; ug wala nay dapit pa alang kanila didto sa langit.
refund_sats Alang sa usa ka pag-reimbursado nga trabaho, apan wala pa ang token, aron sa paghatag sa status sa URL dili naghatag sa pag-reimbursado.
Ang pagbansay
Kon ang usa ka pagbayad nga pagtan-aw misulti ug ang provider gibutang sa Nymbot alang sa pagtan-aw, ang pagbayad gihimo ug ang error nag-ingon nga kini, uban sa charged_satsUnsay iyang gitudlo kanila bahin sa pag-usab, ug sa pag-usab, ug sa pag-usab, ug sa pag-usab, ug sa pag-usab. Ang tanang token Gikan sa pagbayad niini:
{
"error": {
"message": "The image generator failed. Nothing was charged. Please try again. The 237 sats you paid are on refund token REFUND-...",
"type": "api_error",
"code": "upstream_error",
"refund_token": "REFUND-0C15DBED145D59131BA70298A413ADEB3D9B9AB082C476EA70A5BD38FCA5DE6D",
"refund_sats": 237,
"refund_expires_at": "2026-10-30T12:00:00.000Z"
}
}
Unused parts balik sa sama nga paagi: kon kamo misulti alang sa duha ka pictures ug ang usa misulod unfilling, ang pag-uswag sa nymbot ang object adunay usa ka reimbursement token alang sa usa ka bug-os nga; ang usa ka transcription nga ang length nga dili mahimo sa pag-read up sa dugang nga ang file mahimo (maot labaw pa kay sa 30 minutos), ug ang diferensya ngadto sa real nga length magpadala ingon sa usa ka reimbursement token; kung kini mahimo nga mas labaw pa kay sa 30 minutos, kini mao ang gikuha sa 413
Ang pagpatin-aw ug pag-usab sa pag-usab mao ang pag-usab sa pag-usab sa pag-usab sa pag-usab sa pag-usab.
Ang usa ka reimbursement token mao ang usa ka random 256-bit code. Ang Nymbot mag-alagad lamang sa iyang hash, ug kini mamatay sa 30 ka adlaw. Kini adunay usa ka sat balance, ug imong mahimo:
- Pagbayad niini niini. Naa kay
Authorization: Bearer REFUND-…(Ang Pinadayag :) Apan gilupig sila; ug wala nay dapit pa alang kanila didto sa langit.refund_token_satsAngnymbotAng usa ka token mao ang usa ka halos ubos pa kay sa mga solusyon sa mga responses402refund_insufficientAng usa ka bug-os sa pag-atubangan sa usa ka pulong sa usa ka pulong. - Unsa ang
GET /api/v1/l402/refundsAng usa ka header magpatalinghog{"sats": 237, "status": "open", "expires_at": "..."}. - Ang usa ka token mahimo sa 60 ka beses sa matag minuto.
- Ipahamtang ang mga butang sa nym. Ipahamtang ang Unsa ang regalo? sa Nymbot app, o sa call
POST /api/v1/l402/refunds/redeemAng A Ang petisyon ug{"refund_token": "REFUND-...", "balance": "standard"}(Ang"pro"Ang tibuok credits moabut ngadto sa balanse (10 sats matag sa default, 100 sa Pro); sats nga dili makahimo sa tibuok credit sa token alang sa API requests.
cURL
URL=https://nymbot.ai/api/v1/l402/refunds/redeem
BODY='{"refund_token":"REFUND-...","balance":"standard"}'
curl "$URL" \
-H "Authorization: $(nostr_auth POST "$URL" "$BODY")" \
-H "Content-Type: application/json" \
-d "$BODY"
Tungod niini
{ "data": { "credited": 23, "tier": "standard", "balance_credits": 123, "remaining_sats": 7 } }