القيمة المُعادة
{
id: "…", // the account id
email: "you@example.com",
credits: 10869, // the balance, at the moment of the call
pack: "go" // the plan this account is on
}{
"id": "…", # the account id
"email": "you@example.com",
"credits": 10869, # the balance, at the moment of the call
"pack": "go", # the plan this account is on
}idstringالحساب، مستقر، يستحق أن يسجل بجانب أي شيء تُعيده
emailstringالعنوان الذي فتح به الحساب
creditsintegerالتوازن. القراءة، لا التحفظ - انظر: أولاً-.
packstringالخطة، إنها ما يقرر الحصص، وليس ما يقرر سعر النموذج.
The server holds more than this; the method narrows it to the four fields a program actually branches on. When you need the wider record, updateProfile() returns it.
1 ف-5، 1 ف-4، 1 ف-3، 1 خ م، 1 خ ع (رأ)، 1 م و، 1 م أ م، 1 م أ م
| القيمة | المعنى |
|---|---|
| (يُرجى الاتصال بـ: | الخطة تبدأ الحساب |
| "لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، لا، | خطة مُسدّدة. |
| هذا | خطة مدفوعة الأجر، مع المزيد من كل شيء |
| :: مؤسسة | تم وضعها بترتيب وليس بخدمة ذاتية. |
| freemium | An older name that follows free. |
اقرأ الخطة لتقرير ما الذي يجب عرضه، لا يجب أبداً حساب سعر: النموذج يكلف ما (ك) ما تنظمه الخطة هو مقدار الغرفة التي توجد فيها الخدمة - المخازن، صناديق البريد، المضيفين - وهذه الحدود يمكن قراءتها من الخدمة التي تطبقها.
متى يكون هذا لا يكون متى يكون لا يكون
null وليس الأمر كما يبدو المفتاح الخاطئ: مفتاح خاطئ يفشل تبادل الجلسات، قبل ذلك بوقت طويل.
| Symptom | ما حدث |
|---|---|
| غير مأذون به | تم رفض المفتاح أو تم إلغاؤه |
| لا يمكن | لا جواب عند القاعدةUrl. تحقق من العنوان أولاً. |
| الوقت المحدد لـ | شيء ما أجاب عليه ببطء شديد أو لا على الإطلاق |
| عُرِد لا عُرِـ: | وقد نجح الطلب، ولم يكن هناك حساب وراءه. |
(أ) التحقق من التحقق من تنفيذ الإجراء
هذا هو النداء الذي يجب القيام به عند بدء التشغيل. إنها تتدرب على المفتاح، التبادل، مخبأ الجلسة، وطلب موثق،
import { IaGenify, IaGenifyError, Unauthorized } from "iagenify";
export async function checkIaGenify(api) {
try {
const user = await api.getUser();
if (!user) return { ok: false, why: "no account behind this key" };
return { ok: true, email: user.email, credits: user.credits };
} catch (err) {
if (err instanceof Unauthorized) return { ok: false, why: "key refused or revoked" };
if (err instanceof IaGenifyError && err.code === "unreachable") {
return { ok: false, why: `no answer at ${api.baseUrl}` };
}
throw err;
}
}from iagenify import IaGenifyError, Unauthorized
def check_iagenify(api):
try:
user = api.get_user()
if not user:
return {"ok": False, "why": "no account behind this key"}
return {"ok": True, "email": user["email"], "credits": user["credits"]}
except Unauthorized:
return {"ok": False, "why": "key refused or revoked"}
except IaGenifyError as error:
if error.code == "unreachable":
return {"ok": False, "why": f"no answer at {api.base_url}"}
raiseقراءة الموازِل
ويصدق الرقم عندما يقرأ ولا شيء يحمله. يبدأ تشغيل الثانية في وقت لاحق ينفق مقابل نفس التوازن، كما تفعل كل عملية أخرى على الحساب.
أولاً، التحقق من الإنفاق بعد ترك نافذة حيث لا ينبغي أن ينجح كل من النجاح والثاني. أعطي التشغيل ميزانية بدلاً من ذلك: يتم إنفاذها حيث يحدث الإنفاق، وليس حيث نظرت.
// Fragile: two processes both read 400 and both start a 300-credit run
const { credits } = await api.getUser();
if (credits < 300) throw new Error("not enough");
await agent.run({ message });
// Sound: the ceiling travels with the run, and a shortfall is refused at the debit
const agent = api.agents.create({ runtime: "local", machine: pc, budget: 300 });
await agent.run({ message });# Fragile: two processes both read 400 and both start a 300-credit run
if api.get_user()["credits"] < 300:
raise RuntimeError("not enough")
agent.run(message=message)
# Sound: the ceiling travels with the run, and a shortfall is refused at the debit
agent = api.agents.create(runtime="local", machine=pc, model=model, budget=300)
agent.run(message=message)(أ) عجز في الأسطح NotEnoughCredits ( ٢ تيموثاوس ٣ : ١ ) فَمَاذَا يَجِبُ أَنْ يَتَحَمَّلَ ٱلْمَسِيحِيُّونَ ٱلْمُسْتَعِدُّونَ ؟ ).
كيف يمكن أن نسميها
كل مكالمة هي رحلة ذهاب وإياب. قراءتها مرة واحدة في مكان العمل، ومرة أخرى بعد شيء ينفق، يكفي؛ التصويت حسب الطلب يضيف إلى التأخير إلى نقاط النهاية الخاصة بك ويخبرك لا شيء جديد بين الإنفاق.
let cached = null;
let readAt = 0;
export async function user(api, maxAgeMs = 60_000) {
if (!cached || Date.now() - readAt > maxAgeMs) {
cached = await api.getUser();
readAt = Date.now();
}
return cached;
}import time
_cached = None
_read_at = 0.0
def user(api, max_age=60):
global _cached, _read_at
if _cached is None or time.monotonic() - _read_at > max_age:
_cached = api.get_user()
_read_at = time.monotonic()
return _cached