대화 기록
채팅 UI의 백엔드 지속성을 위한 선택적 모듈입니다. 각 대화는 제목/메타데이터가 포함된 컨테이너입니다. 추가 메시지는 LLM을 트리거하지 않고 지속됩니다(채팅 완료와 함께 사용됨). 전체 CRUD + 메시지 추가.
conv = client.conversations.create(title="My Session")
client.conversations.append_message(
conv["conversation_id"], role="user", content="Hello!",
)
all_convs = client.conversations.list(limit=20)
detail = client.conversations.get(conv["conversation_id"])| title | string | Optional | 对话标题。可后续 update。 |
| metadata | object | Optional | 任意 JSON,关联你自己的 user_id / session_id / topic 等。最大 4KB。 |
| role | "user" | "assistant" | "system" | "tool" | Required | 消息角色。 |
| content | string | Required | 消息文本。注意:此 endpoint 只持久化,不触发 LLM。 |
계정 관리
등록/로그인/비밀번호 재설정/2FA/프로필 편집/GDPR 셀프 서비스 비활성화. 대부분의 엔드포인트는 웹 애플리케이션 흐름용입니다. 백엔드 통합은 나() / 비밀번호 변경 / 2FA입니다. 모든 보호된 엔드포인트는 Bearer 토큰을 사용합니다.
me = client.auth.me()
client.auth.update_profile(full_name="Jane Doe")
client.auth.change_password(
current_password="old-pwd",
new_password="new-pwd-123",
)
status = client.auth.two_fa_status()API 키 관리
API 키를 동적으로 생성/취소하고 월별 소비 한도(monthly_spend_cap_usd), 임계값 초과 경보 웹훅(HTTPS 전용) 및 지리적 라우팅 정책(cn 전용/해외 전용/임의)을 설정할 수 있습니다. create()는 full_key를 한 번만 반환하므로 반드시 저장하세요.
new = client.keys.create(name="prod-2026")
print(new["full_key"]) # 只此一次显示
client.keys.update_spend_cap(
new["key"]["key_id"],
monthly_spend_cap_usd="100",
)
client.keys.update_alert_webhook(
new["key"]["key_id"],
url="https://your-app.com/billing-alert",
)| name | string | Required | Key 显示名(用于在 dashboard 区分)。1-100 字符。 |
| monthly_spend_cap_usd | string | Optional | 月度上限 USD,字符串保留精度(如 "100.00")。超 cap 后该 key 该月所有请求被拒。 |
| clear | boolean | Default: false | true = 清除当前 cap(无限额)。 |
청구/사용량/충전
잔액, 일일 사용량, 티어별 분류 (by_tier: fast / balanced / passthrough / byok), Stripe 충전. 청구 티어는 요청의 model 필드로 결정 — model=nexevo/fast → fast 정액제; 실제 모델 ID → passthrough +5%. 모든 금액 문자열은 decimal로 처리하세요 — float 파싱 금지.
bal = client.billing.balance()
usage = client.billing.usage(days=7)
plan = client.billing.get_plan()
hint = client.billing.upgrade_hint()
if hint["hint"]:
print(f"建议: {hint['hint']['recommend_plan']}, "
f"可省 {hint['hint']['savings_pct']}%")
session = client.billing.checkout(
amount_usd=20,
idempotency_key="topup-2026-04-27-001",
)
print(session["checkout_url"])| amount_usd | number | Required | 充值金额 USD,> 0。 |
| idempotency_key | string | Required | 幂等 key,同 key 重试不会重复扣款。建议格式:topup-YYYY-MM-DD-序号。 |
조직/여러 사용자
비즈니스 계정의 다중 사용자 관리. 소유자/관리자/개발자, 회원 초대/삭제/소유권 이전의 세 가지 역할을 지원합니다. 모든 키 + 청구서는 조직 이름으로 공유되므로 회사 팀 액세스에 적합합니다.
org = client.organizations.create("Acme Inc")
client.organizations.invite_member(
org["organization"]["org_id"],
email="dev@acme.com",
role="developer",
)
members = client.organizations.list_members(org["organization"]["org_id"])
client.organizations.transfer_owner(
org["organization"]["org_id"],
new_owner_user_id="u_789",
)RLHF 피드백
채팅 응답 헤더 X-Nexevo-Generation-Id에서 Generation_id를 가져오고 추천/비추천 + 선택적 댓글 + 태그를 제출하세요. 피드백은 데이터 플라이휠로 직접 전달되며 자체 학습 라우팅은 이를 사용하여 향후 모델 선택을 최적화합니다.
resp = client.chat.completions.create(
model="nexevo/balanced",
messages=[{"role": "user", "content": "Hello!"}],
)
gen_id = resp["nexevo"]["generation_id"]
client.feedback.submit(
generation_id=gen_id,
rating=1,
comment="Helpful!",
tags=["accurate"],
)
summary = client.feedback.summary(days=7)| generation_id | string | Required | 从 chat 响应头 X-Nexevo-Generation-Id 或 SDK resp.nexevo.generation_id 拿。 |
| rating | 1 | -1 | Required | 1 = 👍, -1 = 👎。 |
| comment | string | Optional | 可选自由文本(最多 ~2K 字符)。 |
| tags | string[] | Optional | 可选标签。常用: accurate / incorrect / too_verbose / irrelevant。 |