સામગ્રી પર જાઓ
Nymbot પર ક્લિક કરો

જ્ઞાનનો આધાર વિકાસકર્તાઓ

સંતુલન, ટોપ-અપ્સ અને કીઓ

તમારી પાસે શું છે તે તપાસો, લાઈટનિંગ પર ટોપ અપ કરો, તમારા પોતાના વૉલેટમાંથી આપમેળે ટોપ અપ કરો, દરેક વિનંતીની કિંમત જુઓ અને કોડમાંથી કીઓનું સંચાલન કરો.

એકાઉન્ટ્સ: Check the Balance

જેની સમિક્ષા અગાઉની કૌમોની ભવિષ્યવાણીથી લઇને ગદીર સુધી અને ગદીરથી લઇને વિલાદતે બાસઆદત સુધી અને વિલાદતથી લઇને ઝુહુરના સમય સુધી ખુદાવંદે મોતઆલે તે ઝાતે ગીરામી કદ્રને બાકી રાખીને જાણે પોતાના ઉચ્ચ અને મહાન હેતુની નીચે પોતાના મહેબુબ અને ચુંટાએલા એટલે કે મુસ્તઝ્અફ બંદાઓને માટે એક નિશાન કાએમ કરી દીધુ છે.

GET https://nymbot.ai/api/v1/credits/balance - API કીની જરૂર છે. POST જે ગ્રાહકો તેની અપેક્ષા રાખે છે તેમના માટે પણ તે કામ કરે છે.

balance એક જ આંકડાની અપેક્ષા રાખતા સાધનો માટે, વર્તમાન બિટકોઇન કિંમતે ડોલરમાં બંનેનું સંતુલન એકસાથે છે (null જો તમે કિંમત વાંચી શકતા હોવ તો) ઘરેલું કિંમત કિંમત અને કિંમતમાં છે, અને તેથી, આ કિંમત તે જ રીતે રાખવામાં આવે છે. key પૂછવામાં આવેલી ચાવીનું વર્ણન કરે છે. એક ચાવી જે તેની ટોચ પર પહોંચી ગઈ છે તે હજુ પણ સંતુલન ચકાસી શકે છે.

જવાબ

{
  "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"
  }
}
સ્થિતિક્યારે?
401ચાવી ખૂટે છે, અજ્ઞાત છે, રદ કરવામાં આવી છે અથવા સમાપ્ત થઈ ગઈ છે.

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);

પેટ્રોલ પંપ

તમે કેવી રીતે ટોપ અપ કરી શકો છો, અને મર્યાદાઓ. વીજળી એ એકમાત્ર પદ્ધતિ છે.

GET https://nymbot.ai/api/v1/topup/payment-methods - ચાવીની જરૂર નથી.

ટોપ-અપ 10 થી 1,000,000 સેટ્સ છે; પ્રો ટોપ-આપે ઓછામાં ઓછી એક પ્રો ક્રેડિટ ખરીદવી પડે છે, તેથી તે 100 સેટ્સથી શરૂ થાય છે. ડોલરની મર્યાદા બિટકોઇનની કિંમતને અનુસરે છે. bulk_bonus જો કે, આ એપ્લિકેશનમાં, મોટા ભાગના ગ્રાહકો માટે 10%, 15% અથવા 20% ઓછા ગ્રાહકો માટે 500, 1,000 અથવા 5,000 સ્પીડ અને 5,000, 10,000 અથવા 50,000 સ્પીડની ગ્રાહકો માટે ઓછા ગ્રાહકો માટે ઓછા ગ્રાહકો માટે ઓછા છે.

જવાબ

{
  "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);

સ્માર્ટફોન Topping Up Over Lightning

વીજળીનું ભરતિયું બનાવે છે જે ચાવીની માલિકીના નામમાં ક્રેડિટ ઉમેરે છે. તેને કોઈપણ વીજળીના પાકીટમાંથી ચૂકવો, પછી તપાસો ક્રેડિટ ઉમેરવા માટે.

POST https://nymbot.ai/api/v1/topup/create/btc-lightning - API કીની જરૂર છે.

ફ્લાઇટપ્રકારજરૂરીવર્ણન
amountનંબરહાકેટલો, માં currencyએક સંપૂર્ણ કિંમતો માટે.
currencyસ્ક્રીનના.SATS (વૃદ્ધિ અને અસરકારકતા) USD અથવા BTCડોલરની કિંમત અગાઉના Bitcoin કિંમતમાં બદલવામાં આવે છે.
tierસ્ક્રીનના.pro (વૈશ્વિક અર્થતંત્ર) અથવા standard: જે ક્રેડિટ બેલેન્સમાં જાય છે.

પ્રમાણભૂત ક્રેડિટ 10 સેટ્સ અને પ્રો ક્રેડિટ 100 સેટ્સ, વત્તા કોઈપણ જથ્થાબંધ બોનસ છે. credits આ પણ વાંચોઃ આ ફોટોગ્રાફી કેવી રીતે કરવી

જવાબ

{
  "invoice_id": "b7d41e0c95a2f38e6c1d0e9a4b7f2c61d3e8a05f9b2c4d7e1a6f3b8c0d5e2a9f4",
  "payment_request": "lnbc100u1p5...",
  "amount_sats": 10000,
  "credits": 115,
  "tier": "pro",
  "expires_at": "2026-09-30T09:27:00Z",
  "status": "pending"
}
સ્થિતિક્યારે?
400આ પણ વાંચોઃ Next Post:બિગ બોસ (unsupported_method), એક અજ્ઞાત ચલણ (unsupported_currency) અથવા સ્તર, ગુમ થયેલ રકમ, અથવા લઘુત્તમ (amount_too_small), ઉપર 1,000,000 sats (amount_too_large) અથવા લાઈટનિંગ વોલેટ દ્વારા ઇનકાર કર્યો હતો (amount_out_of_range).
429આ એન. આઈ. એમ. માટે 60 થી વધુ ઇન્વૉઇસેસ, અથવા આ સરનામાંથી 120, એક કલાકમાં (rate_limit_exceededસાથે, Retry-After).
502કૉંગ્રેસના અધ્યક્ષ અમિત શાહ (invoice_unavailableસાથે, 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);

ટોપ-અપની તપાસ કરી રહ્યા છીએ

મિત્રો,આવી અસંખ્ય ડોક્યુમેન્ટ્રીઓ સરળતાથી ઇન્ટરનેટના માધ્યમથી જોઇ શકાય છે પરંતુ તેમાં આપવામાં આવતા સંદેશનો આપણે બહું ઓછા સ્વીકાર કરીએ છીએ, પરંતુ એક વાત શિખવા જેવી જરૂર છે કે. creditedપછીથી ફરીથી તપાસ કરવી સલામત છેઃ તમે ગમે તેટલી વાર પૂછો, ક્રેડિટ એકવાર આવે છે.

GET https://nymbot.ai/api/v1/topup/status/{invoice_id} - એન. આઈ. એમ. માંથી ચાવીની જરૂર છે જેણે ભરતિયું બનાવ્યું હતું.

status છે. pending (હજુ સુધી ચૂકવણી કરવામાં આવી નથી), paid (ચૂકવણી, પરંતુ હજુ સુધી જમા નથી; ફરીથી તપાસો), credited (તમારા બેલેન્સ પર) અથવા expired (સમયસર ચૂકવણી કરવામાં આવી નથી). બાકીની જગ્યાઓ ભરતિયું ટોચ પર હોય તે સ્તર માટે છે.

જવાબ

{
  "invoice_id": "b7d41e0c95a2f38e6c1d0e9a4b7f2c61d3e8a05f9b2c4d7e1a6f3b8c0d5e2a9f4",
  "status": "credited",
  "amount_sats": 10000,
  "credits": 115,
  "tier": "pro",
  "expires_at": null,
  "balance_credits": 523.33,
  "balance_sats": 52333
}
સ્થિતિક્યારે?
400ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ ઇન્ટરનલ.
404આ પણ વાંચો: આટલા વર્ષોમાં ભારતમાં આતંકી હુમલાનો સામનો કરવો પડી રહ્યો છે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);

Historique માટે

વિનંતી દીઠ એક પંક્તિઃ તે શું હતું, કયા મોડેલ, કેટલા ટોકન્સ અને તેની કિંમત શું છે. કોઈ સંકેત અથવા જવાબો રાખવામાં આવતા નથી, તેથી કોઈ પરત કરવામાં આવતું નથી. પંક્તિઓ 90 દિવસ માટે રાખવામાં આવે છે, સૌથી નવી પ્રથમ. એક કી જે તેની ટોચ પર પહોંચી ગઈ છે તે હજુ પણ તેનો ઇતિહાસ વાંચી શકે છે.

GET https://nymbot.ai/api/v1/queries/history - એક API કીની જરૂર છે, જે તેની પોતાની વિનંતીઓ જુએ છે, અથવા હસ્તાક્ષરિત વિનંતી તમારા NIMM પરથી, જે દરેક કીવર્ડને જોઈ શકે છે.

ફ્લાઇટપ્રકારજરૂરીવર્ણન
pageપૂર્ણાંક (ક્વેરી)ના.મૂળભૂત 1, મહત્તમ 1,000 પર; ઊંચું પાનું છે 400 invalid_value.
page_countપૂર્ણાંક (ક્વેરી)ના.સ્માર્ટફોન, સ્માર્ટફોન, સ્માર્ટફોન, સ્માર્ટફોન, સ્માર્ટફોન
start_date
end_date
શબ્દમાળા (ક્વેરી)ના.ISO 8601 ડેટા અથવા સમય.
modelશબ્દમાળા (ક્વેરી)ના.માત્ર આ મોડેલ.
typeશબ્દમાળા (ક્વેરી)ના.chat, responses, messages, image, video, speech, transcription અથવા embedding.
all_keysબુલિયન (ક્વેરી)ના.ચાવી સાથેઃ true તે જ nym ની દરેક કીનો સમાવેશ કરે છે. મૂળભૂત રીતે false.
key_idશબ્દમાળા (ક્વેરી)ના.સત્તાવાર જાહેરાત સાથે, અથવા all_keys=true: માત્ર આ કી છે.

જવાબ

{
  "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);

ખાતાની વિનંતીઓ પર સહી કરી રહ્યા છીએ

કીઓ બનાવવી, બદલવી અને રદ કરવી, ખાતાનો સારાંશ અને સ્વચાલિત ટોપ-અપ્સ API કી લેતા નથી. તેઓ તમારા NIM માંથી સહી લે છે, જેથી લીક થયેલી કી તેની કેપ સુધી ખર્ચ કરી શકે છે પરંતુ ક્યારેય બીજી કી બનાવી શકતી નથી અથવા તેની પોતાની કેપ વધારી શકતી નથી.

એપ્લિકેશન તમારા માટે આ કરે છેઃ તેનામાં બધું આઉટડોર શીટ આ અંતિમ બિંદુઓનો ઉપયોગ કરે છે. તમારે ફક્ત તમારા પોતાના કોડમાંથી કીઓનું સંચાલન કરવા માટે આ વિભાગની જરૂર છે.

આ એપ્લિકેશન એક 27235 (NIP-98) પ્રકારના Nostr પ્રતિક્રિયા છે, જે એપ્લિકેશન પર base64-encoded છે. Authorization Header with the Word એપ્લિકેશન Nostr સામેઃ

એવોર્ડ

{
  "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": "..."
}
  • u is the full URL of the request, query string included, precisely as sent. (કારણ કે, કૉપિરાઇટ)
  • method તે HTTP પદ્ધતિ છે.
  • payload હેક્સમાં કાચા વિનંતી બોડીનું SHA-256 છે. તે આના પર જરૂરી છે POST અને PATCH, અને તમે જે બોડી મોકલો છો તે તમે જે બોડી મોકલી છે તેના માટે બાઈટ હોવી જોઈએ.
  • created_at સર્વરની ઘડિયાળની 60 સેકન્ડની અંદર હોવું જોઈએ.
  • દરેક ઘટના એકવાર કામ કરે છે, એ GET સમાવવામાં આવેલ છે, જેથી કેપ્ચર કરેલ હેડર ફરીથી ચલાવી શકાતું નથી. દરેક વિનંતી માટે નવું સાઇન કરો. એક ઉમેરો nonce રેન્ડમ મૂલ્ય સાથે ટેગ કરો જેથી એક જ સેકન્ડમાં સહી કરેલી બે વિનંતીઓ હજુ પણ અલગ પડે.
  • હસ્તાક્ષરિત વિનંતીનો મુખ્ય ભાગ મહત્તમ 64 KB હોઈ શકે છે, અને શરીરની જરૂરિયાતો Content-Type: application/json.

ગુમ થયેલ ઘટના પાછી આવે છે 401 missing_nostr_authએક કે જે ખરાબ રીતે રચાયેલું છે, ખરાબ રીતે સહી કરેલું છે, ખૂબ જૂનું છે, અથવા કોઈ અલગ URL, પદ્ધતિ અથવા બોડી રિટર્ન માટે છે invalid_nostr_auth, સંદેશમાં કારણ સાથે; ફરીથી વપરાયેલું પાછું આવે છે nostr_auth_replayedએક એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એ 429 સાથે Retry-After.

બ્રાઉઝર્સ આ અંતિમ બિંદુઓને ફક્ત નિમ્બોટની પોતાની સાઇટ્સ પરથી જ કૉલ કરી શકે છે (https://nymbot.ai, https://nymchat.app અને તેમના પેટા ડોમેન્સ). અન્ય કોઈપણ સાઇટ પરના પૃષ્ઠને કોઈ સી. ઓ. આર. એસ. હેડર પાછું મળતું નથી, તેથી તેઓ શું પરત કરે છે તે વાંચી શકાતું નથી. સ્ક્રિપ્ટ્સ અને મૂળ એપ્લિકેશન્સ, જે ના મોકલે છે Originઅને અસંખ્ય અસંખ્ય છે.

તમારી જાતની કિંમત

સહી કરવા માટે તમારી એન. આઈ. એમ. ની ગુપ્ત ચાવીની જરૂર છે ( nsec), જે દરેક વસ્તુને નિયંત્રિત કરે છેઃ તમારી ઓળખ, તમારો ઇતિહાસ અને તમારું સંતુલન. તેને ફક્ત તમે વિશ્વાસ કરો છો તે મશીન પર સ્ક્રિપ્ટમાં મૂકો, તેને ફાઇલમાં લખવાને બદલે વાતાવરણમાંથી વાંચો, અને જ્યારે તમે કરી શકો ત્યારે એપ્લિકેશનને પસંદ કરો.

આ સાધનો હેડર બનાવે છે. આ પાનુંના પછીના નમૂનાઓ તેનો ઉપયોગ કરે છે. NOSTR_SECRET_HEX; સી. યુ. આર. એલ. નો ઉપયોગ કરે છે એન. એ. સી. આદેશ-વાક્ય સાધન, જે એન. એસ. સી. અથવા હેક્સ કી લે છે, અને sha256sum macOS પર, 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");
}

કૉપિરાઇટ Summary

એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન ઓટોમેટિક ટોપ-અપ સ્માર્ટફોન, or null જો કે, એક્ઝિક્યુટિવ એક્ઝિક્યુટિવ એક્ઝિક્યુટિવ નથી.

GET https://nymbot.ai/api/v1/account આટલી જરૂર છે A હસ્તાક્ષરિત વિનંતી.

જવાબ

{
  "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());

કીઓનું સંચાલન કરો

એપ્લિકેશનની મુખ્ય સૂચિ પાછળના અંતિમ બિંદુઓ. તે બધાને એક જરૂર છે હસ્તાક્ષરિત વિનંતીદરેક કી આ સ્વરૂપમાં પરત કરવામાં આવે છે, જેમાં ISO 8601 માં સમય અને sats માં રકમ હોય છેઃ

મુખ્ય વસ્તુ

{
  "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 ચાવી ઓળખવા માટે પૂરતું છે પરંતુ તેનો ઉપયોગ કરવા માટે નહીં. ચાવી પોતે જ એક જ વાર પરત કરવામાં આવે છે, જ્યારે તે બનાવવામાં આવે છે.

યાદી કીઓ

GET https://nymbot.ai/api/v1/keys સત્તાધીશો

ફ્લાઇટપ્રકારજરૂરીવર્ણન
include_revokedબુલિયન (ક્વેરી)ના.રદ કરેલી કીઓ શામેલ કરો. મૂળભૂત false.

જવાબ

{ "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);

કીબોર્ડ બનાવો

POST https://nymbot.ai/api/v1/keys સત્તાવાર માહિતી - Returns 201.

ફ્લાઇટપ્રકારજરૂરીવર્ણન
nameસ્ક્રીનહા1 થી 40 ટિપ્પણીઓ, તમારા અન્ય સક્રિય ટિપ્પણીઓ (પ્રતિક્રિયા કેસ) થી અલગ છે.
limit_satsઇન્ટરનેશનલના.સેટ્સમાં ખર્ચની મર્યાદા, ઓછામાં ઓછી 1. તેને કોઈ મર્યાદા વિના છોડી દો.
reset_periodસ્ક્રીનના.daily, weekly અથવા monthlyજરૂરિયાત limit_sats.Let it out for a cap that never resets. – એક કેટેગરીમાં એક કેટેગરીમાં એક કેટેગરીમાં એક કેટેગરીમાં એક કેટેગરી છે.
expire_atstring અથવા integerના.જ્યારે કી કામ કરવાનું બંધ કરે છેઃ એક ISO 8601 સમય, અથવા 1970 થી મિલિસેકન્ડ્સ.

જવાબ (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"
  }
}
સ્થિતિક્યારે?
400આ પણ વાંચો : અફઘાનિસ્તાનના રાષ્ટ્રપતિ ડોનાલ્ડ ટ્રમ્પ (duplicate_name); એક કેપ કે જે ઓછામાં ઓછી 1 ની સંપૂર્ણ સંખ્યા નથી; કેપ વિના રીસેટ સમયગાળો; ભૂતકાળમાં સમાપ્તિ; એક અજ્ઞાત ક્ષેત્ર (unknown_parameter); અથવા પહેલેથી જ 25 સક્રિય કીઓ (too_many_keys).
429એક કલાકમાં આ એન. આઈ. એમ. દ્વારા 60 થી વધુ કીઓ, અથવા આ સરનામાંથી 120 કીઓ બનાવવામાં આવે છે (rate_limit_exceededસાથે, 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);

એક ચાવી વાંચવી

GET https://nymbot.ai/api/v1/keys/{id} સત્તાધીશો

રીટર્ન {"data": {…}} મુખ્ય વસ્તુ સાથે, અથવા 404 key_not_found જો તમારી કોઈ ચાવી પાસે તે ઓળખપત્ર નથી.

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);

ચાવી બદલવી

PATCH https://nymbot.ai/api/v1/keys/{id} સત્તાધીશો

વિદેશી કંપનીઓ name, limit_sats, reset_period અને expire_at, ચાવી બનાવતી વખતે જે નિયમો હોય તે જ નિયમો સાથે. null આ પણ વાંચો: આંતરરાષ્ટ્રીય ક્રિકેટ ટીમના કેપ્ટન વિરાટ કોહલીએ આંતરરાષ્ટ્રીય ક્રિકેટ ટીમના કેપ્ટન વિરાટ કોહલીના કેપ્ટન વિરાટ કોહલીના કેપ્ટન વિરાટ કોહલીના કેપ્ટન વિરાટ કોહલીના કેપ્ટન વિરાટ કોહલીના કેપ્ટન વિરાટ કોહલીના કેપ્ટન વિરાટ કોહલીના કેપ્ટન વિરાટ કોહલીના કેપ્ટન વિરાટ કોહલીના કેપ્ટન વિરાટ કોહલીના (400 key_revoked). રીટર્ન {"data": {…}} અદ્યતન કી ઓબ્જેક્ટ સાથે.

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);

ક્રેડિટ ક્રેડિટ

DELETE https://nymbot.ai/api/v1/keys/{id} સત્તાધીશો

ચાવી તરત જ અટકાવે છે, સારા માટે. તે સાથે યાદીમાં રહે છે revoked_at સેટ કરો, અને તેની સાથે જોઈ શકાય છે include_revoked=trueજેની સમિક્ષા અગાઉની કૌમોની ભવિષ્યવાણીથી લઇને ગદીર સુધી અને ગદીરથી લઇને વિલાદતે બાસઆદત સુધી અને વિલાદતથી લઇને ઝુહુરના સમય સુધી ખુદાવંદે મોતઆલે તે ઝાતે ગીરામી કદ્રને બાકી રાખીને જાણે પોતાના ઉચ્ચ અને મહાન હેતુની નીચે પોતાના મહેબુબ અને ચુંટાએલા એટલે કે મુસ્તઝ્અફ બંદાઓને માટે એક નિશાન કાએમ કરી દીધુ છે કે જેથી માયુસીની ધુળ દામન પર બેસવા ન પામે

જવાબ

{ "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());

NWC Auto-Top-Up એપ્લિકેશન

લાઈટનિંગ વૉલેટને નોસ્ટર વૉલેટ કનેક્ટ સાથે જોડો અને જ્યારે API ખર્ચ ઓછો હોય ત્યારે Nymbot પોતે જ સંતુલનમાં ટોચ પર આવે છે. એપ્લિકેશનની API શીટમાં સમાન સેટિંગ્સ હોય છે; આ તેની પાછળના અંતિમ બિંદુઓ છે. તે બધાને એક સંતુલનની જરૂર છે. હસ્તાક્ષરિત વિનંતી.

તે કેવી રીતે કાર્ય કરે છેઃ તમે જે બેલેન્સ જોવાનું પસંદ કર્યું હોય તેના પર API વિનંતી ચાર્જ થયા પછી, જો તે બેલેન્સ તમારા થ્રેશોલ્ડથી નીચે આવી ગયું હોય, તો Nymbot તમારી ટોપ-અપ રકમ માટે ભરતિયું બનાવે છે, તેને ચૂકવવા માટે તમારા વૉલેટને પૂછે છે, અને ક્રેડિટ ઉમેરે છે. તે દરેક Nym અને બેલેન્સ માટે દર 5 મિનિટમાં વધુમાં વધુ એકવાર ટોચ પર આવે છે, જેથી વિનંતીઓનો વિસ્ફોટ વૉલેટને દૂર કરી શકતો નથી. એપ્લિકેશનોમાં ખર્ચ તેને ટ્રિગર કરતું નથી. છેલ્લા ટોપ-અપના સમય અને કદ અને છેલ્લી ભૂલ, સેટિંગ્સમાં છે; જો ચુકવણી ભૂલ પછી પસાર થઈ હોય, તો તેની ભરતિયું તપાસો ટોપ-અપ સ્થિતિ તેને શ્રેય આપો.

તમે વૉલેટને કનેક્ટ કરો તે પહેલાં

કનેક્શન સ્ટ્રિંગ જે કોઈ પણ તેને પકડી રાખે છે તેને તમારા વૉલેટને ચૂકવણી કરવા માટે કહે છે. નિમ્બોટ તેને એન્ક્રિપ્ટ કરેલ સંગ્રહિત કરે છે અને તેનો ઉપયોગ ફક્ત તેના પોતાના ટોપ-અપ ઇન્વૉઇસેસ ચૂકવવા માટે કરે છે, પરંતુ તમારા વૉલેટમાં ખર્ચના બજેટ સાથે જોડાણ કરો, જેથી તે ક્યારેય સૌથી વધુ ચૂકવણી કરી શકે તે તમે પસંદ કરેલ નંબર છે. વૉલેટને ટેકો આપવો પડશે pay_invoice.

વૉલેટને જોડી રહ્યા છીએ

POST https://nymbot.ai/api/v1/nwc-auto-topup/connect સત્તાધીશો

ફ્લાઇટપ્રકારજરૂરીવર્ણન
nwc_urlસ્ક્રીનહાજોડાણ શબ્દમાળા, શરૂ થાય છે nostr+walletconnect://. નિમ્બોટે પાકીટ માટે પૂછે છે get_info તેને સાચવતા પહેલા, અને તેને એનક્રિપ્ટેડ સંગ્રહિત કરો.
threshold_satsઇન્ટરનેશનલહાજ્યારે બેલેન્સ આટલા સેટ્સથી નીચે આવે ત્યારે ટોપ અપ કરો. ઓછામાં ઓછું 1,000.
topup_satsઇન્ટરનેશનલહાદર વખતે કેટલું ઉમેરવું. 1,000 થી 1,000,000 sats.
tierસ્ક્રીનના.pro (વૈશ્વિક અર્થતંત્ર) અથવા standard: જોવા અને ટોપ અપ કરવા માટેનું સંતુલન.

જવાબ

{
  "data": {
    "connected": true,
    "threshold_sats": 5000,
    "topup_sats": 20000,
    "tier": "pro",
    "last_topup_at": null,
    "last_topup_sats": null,
    "last_error": null
  }
}
સ્થિતિક્યારે?
400જોડાણ શબ્દમાળા નથી (invalid_nwc_url); વૉલેટએ તેના રિલે પર જવાબ આપ્યો ન હતો (nwc_unreachable) અથવા ચેક આપવાનો ઇનકાર કર્યો હતો (nwc_rejected); ક્રેડિટ ક્રેડિટ ક્રેડિટ ક્રેડિટ નથી (nwc_missing_permission); અથવા મર્યાદાની બહારની રકમ.
501ઓનલાઇન ઓનલાઇન ઓનલાઇન ઓનલાઇન ઓનલાઇન ઓનલાઇન ઓનલાઇન (nwc_unavailable). આ જ બાબત અન્ય બે અંતિમ બિંદુઓને લાગુ પડે છે.

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());

સેટિંગ્સ વાંચો

GET https://nymbot.ai/api/v1/nwc-auto-topup સત્તાધીશો

કૉપિરાઇટ ઑનલાઇન ઑનલાઇન ઑનલાઇન ઑનલાઇન ઑનલાઇન connected: false અને અન્ય ક્ષેત્રો null જ્યારે કોઈ પાકીટ જોડાયેલ ન હોય. જોડાણ શબ્દમાળા પોતે ક્યારેય પરત કરવામાં આવતી નથી.

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());

કનેક્શન

DELETE https://nymbot.ai/api/v1/nwc-auto-topup/connection સત્તાધીશો

સંગ્રહિત જોડાણ શબ્દમાળાને દૂર કરે છે. વધુ ટોપ-અપ્સ કરવામાં આવતા નથી. ખાતરી કરવા માટે, તમે તમારા વૉલેટમાં જોડાણને પણ રદ કરી શકો છો.

જવાબ

{ "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());

ચાવી વગર વિનંતી દીઠ ચૂકવણી

કોઈ ચાવી, કોઈ ખાતું અને કોઈ બેલેન્સ વિના, લાઈટનિંગ પર એક સમયે એક વિનંતી માટે ફિક્સ્ડ-પ્રાઈસ એન્ડપોઇન્ટ્સ ચૂકવી શકાય છેઃ POST /images/generations, POST /images/edits, POST /videos, POST /audio/speech, POST /audio/transcriptions, POST /audio/translations અને POST /embeddings. ચેટ, પ્રતિસાદ અને સંદેશાઓને હંમેશા ચાવીની જરૂર હોય છે. ચાવી ધરાવતી વિનંતીને હંમેશની જેમ બેલેન્સમાં બિલ કરવામાં આવે છે; ચુકવણીનો પ્રવાહ ત્યારે જ શરૂ થાય છે જ્યારે કોઈ ચાવી મોકલવામાં ન આવે.

નિમ્બોટ એક જ વિચારની બે આવૃત્તિઓ બોલે છે, એક બેકએન્ડમાંથીઃ લાઈટનિંગ લેબ્સ ' એન402 (અથવા આટલું જ નહીં, પણ આટલું જ નહીં, આટલું જ નહીં, LSAT) અને IETF પ્રોજેક્ટ ચુકવણી સાથે HTTP પ્રમાણીકરણ યોજના lightning પદ્ધતિ અને charge ઇરાદો. તમારો ગ્રાહક જે સમજે તેનો ઉપયોગ કરો.

તમારું પોતાનું સર્વર ચલાવો

ચાવી વિના ચૂકવણી ત્યારે જ ચાલુ રહે છે જ્યારે API_L402_SECRET 32 અલગ-અલગ બેટ્સ, જેમ કે હેક્સ (64 અલગ-અલગ અલગ અલગ અલગ બટ્સ) અથવા Base64 (44). openssl rand -hex 32એક લાંબા અથવા કાયદાકીય મૂલ્યાંકન એકાઉન્ટ ફોર્મેટને અટકાવે છે અને એપ્લિકેશનને લૉન્ચ કરે છે કે તે શું છે. API_L402_SECRET_PREVIOUS એક દિવસ માટે: કૉપિરાઇટ્સ, સ્થાપના URLs, અને તે હેઠળ કરવામાં આવેલા પ્રતિક્રિયાઓ સતત કામ કરે છે.

વિનંતી

ના સાથે વિનંતી મોકલો Authorization હોમ પેજ / હોમ પેજ / હોમ પેજ / હોમ પેજ / હોમ પેજ / હોમ પેજ / હોમ પેજ / હોમ પેજ 402 Payment Required તે વિનંતીની બરાબર કિંમત માટે ભરતિયું સાથેઃ એક ચાવી જે કિંમત ચૂકવશે તે જ કિંમત, 10 સેટ્સ પર પ્રમાણભૂત ક્રેડિટ અથવા 100 સેટ્સ પર પ્રો ક્રેડિટમાં રૂપાંતરિત થશે અને સંપૂર્ણ સેટ સુધી પૂર્ણ થશે (ઓછામાં ઓછું 1 સેટ્સ, અને ઓછામાં ઓછું 0.05 ક્રેડિટ ન્યૂનતમ). જવાબ ત્રણ ધરાવે છે WWW-Authenticate સમાન ભરતિયું માટે પડકારો

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 }
}

નોટબંધી request આ પણ વાંચો : Base64url JSON {"amount":"237","currency":"sat","methodDetails":{"invoice":"lnbc...","network":"mainnet","paymentHash":"..."}}.

આ ઉપરાંત, એક નિર્ણય લેવામાં આવે છે, અને Content-Type (અમેરિકન પ્રકાર અને, મલ્ટિપ્લેક્સ માટે, તેના લંબાઈ) અને SHA-256 માટે તમે મૂકવામાં આવેલ ચોક્કસ શરીર બેટ્સ, અને 15 મિનિટમાં રહે છે. ઓનલાઈન જવાબ આપો: The same Content-Type JSON બેટ્સમેન અને JSON બેટ્સમેન (/images/edits, /audio/transcriptions, /audio/translationsHTTP બ્રાઉઝર (HTTP Boundary) અને HTTP બ્રાઉઝર (HTTP Boundary) એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટને એકાઉન્ટ કરે છે.

દરેક સરનામું એક મિનિટમાં 30 પડકારો પૂછી શકે છે (એક IPv6 સરનામું તેના સંપૂર્ણ/64 તરીકે ગણવામાં આવે છે). વિનંતીઓ કે જેનું સરનામું જાણીતું નથી તે એક મિનિટમાં 10 સખત શેર કરે છે, અને તમામ સરનામાંઓમાં નિમ્બોટ મુદ્દાઓ પર એકંદર મર્યાદા હોય છે; પડકાર કરવામાં આવે તે પહેલાં નકારવામાં આવેલી વિનંતી (ઉદાહરણ તરીકે જે. એસ. ઓ. એન. માન્ય નથી તેવા મુખ્ય ભાગ સાથે) તેના તરફ ગણાતી નથી. તેનાથી આગળ જવાબ છે 429 સાથે Retry-After, મુખ્ય ભાગને વાંચતા પહેલા મોકલવામાં આવે છે. કી અથવા ઓળખપત્ર વિના બોલાવવામાં આવતા ચૂકવેલ અંતિમ બિંદુઓ પણ સરનામાં દીઠ એક મિનિટમાં 120 અપ્રમાણિક વિનંતીઓની સામાન્ય મર્યાદા તરફ ગણવામાં આવે છે. મુખ્ય ભાગને વાંચતા પહેલા ઓળખપત્રની તપાસ કરવામાં આવે છે, અને જેની વિનંતી હોય તેની તપાસ કરવામાં આવે છે. Content-Type નું application/json (અથવા multipart/form-data આ પણ વાંચોઃ UPLOAD (Refused) 415 અને તેમાંથી કોઈને આશ્ચર્ય થયું નથી.

મિત્રો,આવી અસંખ્ય ડોક્યુમેન્ટ્રીઓ સરળતાથી ઇન્ટરનેટના માધ્યમથી જોઇ શકાય છે પરંતુ તેમાં આપવામાં આવતા સંદેશનો આપણે બહું ઓછા સ્વીકાર કરીએ છીએ, પરંતુ એક વાત શિખવા જેવી જરૂર છે કે, ભલે આપણે ધનવાન હોઇએ કે છાશવારે હોટલ કે રેસ્ટોરન્ટમાં જમવા જઇએ ત્યારે ક્યારેય આપણી થાળીમાં પડેલ અન્નનો બગાડ ક્યારેય ના કરીએ અને જો તે ખોરાક વધારે માત્રામાં છે તો તરત જ તેને પાર્સલ કરાવીને કોઇ ભૂખ્યાની આંતરડી ઠારીએ કારણ કે અંતે તો આપણી પરંપરા છે ને જ્યાં અન્નનો ટુકડો. રિફંડ ટોકન.

ચુકવણીની વિગતો

ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરનેશનલ ઇન્ટરને

યોજનામથાળું
એન402Authorization: L402 <macaroon>:<preimage> (LSAT આ પણ વાંચો)
ચુકવણીAuthorization: Payment <base64url JSON>જે. એસ. ઓ. એન. ક્યાં છે {"challenge": {every parameter of the challenge, as sent}, "payload": {"preimage": "<hex>"}}

Payment Request Answers exactly as one made with a key (અથવા એક કાઉન્ટર સાથે કરવામાં આવેલા એક કાઉન્ટર) nymbot ઑબ્જેક્ટ પાસે કોઈ સંતુલન ક્ષેત્રો નથીઃ {"payment": "l402", "tier": "pro", "paid_sats": 237, "charged_sats": 237}, અને તે કોઈ X-Nymbot-Balance-Sats હેડર. ચુકવણી યોજના સાથે ચૂકવવામાં આવેલી વિનંતીને પણ એક મળે છે Payment-Receipt હેડર (base64url JSON with the challenge id, the payment hash as) reference, status અને timestamp). ચૂકવેલ વિનંતીઓ કોઈપણ એન. આઈ. એમ. સાથે જોડાયેલી નથી, તેથી તે ક્વેરી ઇતિહાસમાં દેખાતી નથી.

સ્થિતિક્યારે?
402 payment_already_usedદરેક ચુકવણી એક વિનંતી માટે ચૂકવણી કરે છે. આ વિનંતી માટે પ્રતિસાદ એ એક નવો પડકાર છે, તેથી ગ્રાહક જે તેની છેલ્લી ઓળખાણપત્રને કેશ કરે છે (જેમ કે lnget આ પણ વાંચો: આટલું જ નહીં, આટલું જ નહીં
402 payment_mismatchગૂગલ એપ્લિકેશન્સ માટે એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન, Content-Type અથવા બોડી, અથવા આ વિનંતી કરતાં ઓછું ચૂકવે છે હવે ખર્ચ થાય છે. આ વિનંતી માટે એક નવો પડકાર તેની સાથે આવે છે; જો ચુકવણી ખૂબ ઓછી હોય, તો તમે જે ચૂકવણી કરી છે તે એક રકમ તરીકે પરત આવે છે. રિફંડ ટોકન (refund_token અને refund_sats શરીરમાં).
402 payment_expiredપડકારને 15 મિનિટથી વધુ સમય વીતી ગયો છે. તેની સાથે એક નવો પડકાર પણ આવે છે. જો પ્રિમેજ દર્શાવે છે કે તમે ચૂકવણી કરી છે, તો તમે જે ચૂકવણી કરી છે તે ચૂકવણી તરીકે પરત આવે છે. રિફંડ ટોકન (refund_token અને refund_sats શરીરમાં), એકવાર; પછી ઓળખપત્રનો ઉપયોગ કરવામાં આવે છે.
401 invalid_preimagePreimage એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન એપ્લિકેશન
401 invalid_payment_credentialઓળખ ખોટી છે, નિમ્બોટે તેને જારી કર્યા પછી બદલવામાં આવી હતી, અથવા ચુકવણી હેશનું નામ નિમ્બોટે ક્યારેય બિલ બહાર પાડ્યું ન હતું. નિમ્બોટને ખબર નથી તેવી ચેતવણી સાથેનો મેકરૂન, અથવા વિરોધાભાસી ચેતવણીઓ સાથે, નકારવામાં આવે છે.
429 rate_limit_exceeded30 થી વધુ ઓળખપત્રો અથવા ચાવીઓ કે જે ચકાસવામાં નિષ્ફળ રહી હતી તે એક મિનિટમાં આ સરનામા પરથી આવી હતી, અથવા એક રિફંડ ટોકન એક મિનિટમાં 60 થી વધુ વખત મોકલવામાં આવ્યું હતું. રાહ જુઓ 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"));

ગ્રાહકોને સ્થાપિત mppx એક Lightning પ્રક્રિયા સાથે, ચુકવણી પ્રતિક્રિયા આપોઆપ કરી શકો છો; આઉટપુટ પર તેઓને શોધી શકો છો અને તેમને ચૂકવણી કરો.

વિડિઓ

નોટિસ POST /videos જવાબો 202 એક અક્ષય કુમાર, plus a status_url: GET તે કામને અનુસરવા માટે કોઈ ચાવી વગર. તે સહી કરેલું છે અને 24 કલાક સુધી કામ કરે છે, જ્યાં સુધી કામ રાખવામાં આવે.

{
  "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..."
  }
}

સલાહ આપો refund_token આ પ્રતિસાદમાંથીઃ તે ફક્ત અહીં બતાવવામાં આવ્યું છે. તે ખાલી છે જ્યારે વિડિયો રેન્ડર કરે છે (GET /api/v1/l402/refunds જવાબો "status": "pending"); જો રેન્ડર અનબિલ કરવામાં નિષ્ફળ જાય, તો ચુકવણી તેના પર આવે છે. સ્થિતિ URL દર્શાવે છે refund_sats રિફંડ કરેલ નોકરી માટે પરંતુ ટોકન ક્યારેય નહીં, તેથી સ્થિતિ યુઆરએલ શેર કરવાથી રિફંડ શેર થતું નથી. ટોકન તપાસવાથી નિષ્ફળ કાર્ય પણ નક્કી થાય છે જેને કોઈએ મતદાન કર્યું નથી.

રિફંડ્સ

મિત્રો,આવી અસંખ્ય ડોક્યુમેન્ટ્રીઓ સરળતાથી ઇન્ટરનેટના માધ્યમથી જોઇ શકાય છે પરંતુ તેમાં આપવામાં આવતા સંદેશનો આપણે બહું ઓછા સ્વીકાર કરીએ છીએ, પરંતુ એક વાત શિખવા જેવી જરૂર છે કે, ભલે આપણે ધનવાન હોઇએ કે છાશવારે હોટલ કે રેસ્ટોરન્ટમાં જમવા જઇએ ત્યારે ક્યારેય આપણી થાળીમાં પડેલ અન્નનો બગાડ ક્યારેય ના કરીએ અને જો તે ખોરાક વધારે માત્રામાં છે તો તરત જ તેને પાર્સલ કરાવીને કોઇ ભૂખ્યાની આંતરડી ઠારીએ કારણ કે અંતે તો આપણી પરંપરા છે ને જ્યાં અન્નનો ટુકડો. charged_sats, અલગ અલગ અલગ અલગ કીબોર્ડ કીબોર્ડ કીબોર્ડ કીબોર્ડ કીબોર્ડ કીબોર્ડ કીબોર્ડ કીબોર્ડ કીબોર્ડ કીબોર્ડ કીબોર્ડ રિફંડ ટોકન તમે શું કરશો તે વાંચો:

{
  "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"
  }
}

વપરાશકર્તાઓ માટે અલગ-અલગ પ્રકારના ફેરફાર કરો: જો તમે બે ફોટા માટે પૂછ્યું છે અને એક અલગ-અલગ ફેરફાર થયો છે, તો nymbot Object carries a refund token for the missing one; a transcription whose length could not be read up front is priced for the longest the file could be (never more than 30 minutes), and the difference to the real length comes back as a refund token; if it turns out to be longer than 30 minutes, it is refused with 413 જેની સમિક્ષા અગાઉની કૌમોની ભવિષ્યવાણીથી લઇને ગદીર સુધી અને ગદીરથી લઇને વિલાદતે બાસઆદત સુધી અને વિલાદતથી લઇને ઝુહુરના સમય સુધી ખુદાવંદે મોતઆલે તે ઝાતે ગીરામી કદ્રને બાકી રાખીને જાણે પોતાના ઉચ્ચ અને મહાન હેતુની નીચે પોતાના મહેબુબ અને ચુંટાએલા એટલે કે મુસ્તઝ્અફ બંદાઓને માટે એક નિશાન કાએમ કરી દીધુ છે કે જેથી માયુસીની ધુળ દામન પર બેસવા ન પામે

રિફંડ ટોકન એ રેન્ડમ 256-બીટ કોડ છે. નિમ્બોટ ફક્ત તેના હેશને સંગ્રહિત કરે છે, અને તે 30 દિવસ પછી સમાપ્ત થાય છે. તે એસએટી બેલેન્સ ધરાવે છે, અને તમે કરી શકો છોઃ

  • તેનો ઉપયોગ કરો. જિંદગી Authorization: Bearer REFUND-… ઉપરના કોઈપણ અંતિમ બિંદુઓ પર (ઓપનએઆઈ એસડીકે તેને તેની એપીઆઈ કી તરીકે લે છે). કિંમત ટોકનમાંથી આવે છે અને જે બાકી રહે છે તે તેના પર રહે છે (refund_token_sats માં તા. nymbot ઓબ્જેક્ટ). વિનંતીના જવાબ કરતાં ઓછું મૂલ્ય ધરાવતું ટોકન 402 refund_insufficientએક અનબિલ નિષ્ફળતા એ જ ટોકન પર સેટ્સને પાછું મૂકે છે.
  • તપાસો આ. GET /api/v1/l402/refunds આ પણ વાંચો: The same header returns {"sats": 237, "status": "open", "expires_at": "..."}.
  • એક ટોકનનો ઉપયોગ એક મિનિટમાં વધુમાં વધુ 60 વખત કરી શકાય છે.
  • તેને એન. આઈ. એમ. પર ખસેડો. તેમાં પેસ્ટ કરો ભેટ મેળવો Nymbot એપ્લિકેશનમાં, અથવા કૉલ POST /api/v1/l402/refunds/redeem સાથે A હસ્તાક્ષરિત વિનંતી અને {"refund_token": "REFUND-...", "balance": "standard"} (અથવા "pro"). સંપૂર્ણ ક્રેડિટ બેલેન્સમાં જાય છે (ધોરણ પર દરેક 10 સેટ, પ્રો પર 100); જે સેટ સંપૂર્ણ ક્રેડિટ બનાવતા નથી તે API વિનંતીઓ માટે ટોકન પર રહે છે.

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"

જવાબ

{ "data": { "credited": 23, "tier": "standard", "balance_credits": 123, "remaining_sats": 7 } }