weightsapi.추론콘솔
내비게이션
문서 십만 건 일괄 처리

문서 십만 건 일괄 처리

JSONL 배치를 준비하고 제출한 다음 출력 파일을 폴링하세요.

요구 사항#

Python 3.11 이상. 추가 패키지 불필요. WEIGHTSAPI_API_KEY를 자신의 키로 설정하세요. AI 접근에는 로그인, 최소 100 USD의 확인된 충전 1회, 승인된 API 키, 요청에 충분한 사용 가능 크레딧이 필요합니다. 이후 각 충전도 최소 100 USD이며, 요청을 충당할 때 더 적은 잔액도 계속 사용할 수 있습니다. 크레딧은 거래 검증이 필요합니다. 트래픽을 보내기 전에 모델 가용성은 서비스 상태를 확인하세요.

레시피 실행#

import os, json, time, urllib.request
BASE = os.environ.get("WEIGHTSAPI_BASE_URL", "https://weightsapi.com/v1")
KEY = os.environ["WEIGHTSAPI_API_KEY"]
# Confirm batch-service availability before attempting upload or submission.
with open("batch.jsonl", "w", encoding="utf-8") as f:
    for i in range(100_000):
        f.write(json.dumps({"custom_id":str(i),"method":"POST","url":"/v1/chat/completions",
            "body":{"model":"Qwen/Qwen3-32B","messages":[{"role":"user","content":"Summarize document "+str(i)}],"max_tokens":64}})+"\n")
print("Wrote 100,000 independent requests to batch.jsonl.")
print("Upload with the provider's batch adapter, then submit /v1/batches with completion_window=24h.")
print("Do not send this file to the synchronous endpoint: the batch discount applies only to batch jobs.")

프로덕션 전에#

이 레시피는 로컬에서 JSONL 파일을 생성합니다. 업로드, 제출, 결과 검색에는 지원되는 배치 배포가 필요합니다. 작업 부하를 제출하기 전에 서비스 상태를 확인하고 배치 조건을 확인하세요. 나열된 할인 또는 완료 기간이 작업 수락을 보장하지 않습니다.