오류 envelope는 엔드포인트마다 다릅니다. HTTP 상태와 존재하는 경우 error.type을 사용하세요. error.code는 문자열 또는 숫자이며 생략될 수 있습니다. error.message는 표시용입니다.
1
2
3
4
5
6
7
{"error":{"message":"Insufficient credits. Please top up to continue.","type":"invalid_request_error","code":"insufficient_credits"}}
HTTP 상태 및 오류.코드
오류 envelope는 엔드포인트마다 다릅니다. HTTP 상태와 존재하는 경우 error.type을 사용하세요. error.code는 문자열 또는 숫자이며 생략될 수 있습니다. error.message는 표시용입니다.
코드
이름
설명
424종속성 실패직접 설정한 BYOK 키가 업스트림 제공자에 의해 거부되었습니다. BYOK 설정에서 확인하거나 교체하세요. strict 모드에서만 발생합니다
400잘못된 요청잘못된 요청, 빈 messages 배열, 또는 필수 필드 누락
401승인되지 않음API 키가 누락, 잘못됨, 또는 비활성화됨
402결제 필요계정 크레딧 부족, 키별 지출 한도 도달, 또는 월간/주간 예산 상한 초과
403금지됨계정이 정지되었거나 권한이 없음
404찾을 수 없음Requested model, generation, key, or other resource does not exist
409충돌Resource is not in the required state, such as an incomplete video job
410사라Requested model has been retired and must be replaced
413페이로드가 너무 큼요청 바디가 10 MB 초과; 콘텐츠 크기를 줄이거나 요청을 분할하세요
416범위가 만족스럽지 않음Requested byte range is invalid for generated video content
429요청이 너무 많습니다속도 제한 초과; 재시도 전 Retry-After 헤더를 확인하세요
432무료 한도 소진Tavily 호환 엔드포인트(/v1/search, /v1/extract, /v1/crawl, /v1/map): 무료 검색 한도를 모두 사용했거나 잔액이 0 이하입니다. 크레딧을 충전한 뒤 계속하세요. 응답 본문은 Tavily 형식입니다: {"detail":{"error":"..."}}
500서버 오류BazaarLink 내부 오류
502잘못된 게이트웨이모든 업스트림 소스가 요청을 처리하지 못했습니다. 요청에 오류가 반환됩니다.
503서비스를 이용할 수 없습니다이 모델에 구성된 업스트림 공급자 없음; 관리자에게 문의하세요
504게이트웨이 시간 초과Upstream connection or stream stalled and timed out
기계 판독 가능한 청구 코드
A 402 can represent different controls. Use these stable codes to choose the correct action.
코드
설명
byok_key_invalid직접 설정한 BYOK 키가 업스트림 제공자에 의해 거부되었습니다. BYOK 설정에서 확인하거나 교체하세요. strict 모드에서만 발생합니다.
budget_cap_reachedA weekly or monthly budget cap was reached; raise or reset the cap.
credit_limit_exceededA monthly-billing organization's credit line was exhausted; contact billing.
insufficient_creditsThe prepaid balance is insufficient; add credits.
spend_limit_exceededThe API key reached its daily, weekly, or monthly spend limit.
capacity_unavailableThis model is temporarily at capacity. Retry shortly; the Retry-After header says how long to wait.
Stable error.code catalog
These string codes are emitted by public inference and media paths. Branch on the string code when present; the HTTP status remains the broad failure class.
모델 및 엔드포인트
모델 조회, 수명 주기, 가격 책정, 양식 및 엔드포인트 호환성 오류입니다.
코드
HTTP 상태
unknown_model400
invalid_model_id400
model_not_found404
model_retired410
model_endpoint_mismatch400
embedding_on_chat_endpoint400
model_not_priced400
invalid_modality_for_model400
요청 및 안전
잘못된 매개변수, 컨텍스트, 도구, 스키마 및 콘텐츠 안전 거부.
코드
HTTP 상태
missing_required_field400
unsupported_param400
max_tokens_invalid400
context_too_long400
tool_use_unsupported400
malformed_tool_messages400
invalid_response_format_schema400
invalid_tools_definition400
content_moderation403
content_filter403
unknown_4xx400
이미지 생성 및 편집
이미지 입력, 멀티파트 편집, 출력 및 이미지 파이프라인 오류입니다.
코드
HTTP 상태
invalid_image_url400
input_images_not_supported400
invalid_content_type400
mask_not_supported400
unsupported_response_format400
missing_prompt400
missing_image400
too_many_images400
invalid_image_type400
image_too_large400
invalid_n400
pipeline_error502
no_images502
업스트림 라우팅
공급자 연결, 인증, 제한 및 가용성 오류를 삭제했습니다.
코드
HTTP 상태
upstream_unreachable502
upstream_auth_failed502
upstream_rate_limited429
capacity_unavailable429
upstream_unavailable502/503
byok_key_invalid424
콘텐츠 검토
모든 요청은 모델로 전달되기 전에 자동 콘텐츠 검토를 거칩니다. 이용 정책을 위반하는 요청은 모델에 전달되지 않고 거부되며 403 오류가 반환됩니다.
차단되는 콘텐츠 카테고리
검토는 당사의 이용 정책(Acceptable Use Policy)에 따라 이루어지며, 주로 다음 카테고리의 콘텐츠를 차단합니다:
성적 착취 콘텐츠
폭력적 위협
불법 행위 실행 안내
생물학적 위해 관련 콘텐츠
403 응답 형식
검토에 의해 차단된 요청은 다음 형식의 오류를 반환합니다:
1
2
3
4
5
6
7
{"error":{"message":"Your prompt was blocked by content moderation.","type":"invalid_request_error","code":"content_filter"}}
요청은 자동 콘텐츠 안전 검토를 거치며, 최신 입력의 텍스트와 이미지는 제3자 콘텐츠 안전 점수 서비스로 전송될 수 있습니다.
위반, 위반 의심, 기준 근접 또는 무작위 표본으로 판정된 요청은 컴플라이언스 증빙, 분쟁 처리 및 감사를 위해 전문 또는 앞부분을 보관할 수 있으며, 고정된 삭제 기간은 약속하지 않습니다.
그 외 일반 성공 요청은 프롬프트와 응답 내용을 보관하지 않으며, ZDR 키 요청에는 앞의 두 항목이 적용되지 않습니다.
속도 제한, 예산 및 비상 브레이크
These controls can reject an otherwise valid request and require different recovery actions.
제어
HTTP 상태
식별 방법
요청 속도 제한429문자열 코드 또는 숫자 코드 429입니다. Retry-After와 X-RateLimit-* 헤더를 사용하세요.
속도 제한 페널티 블록429숫자 코드 429 및 임시 제한 메시지; 재시도 후를 사용하십시오.
글로벌 소비 비상 브레이크503숫자 코드 503, 글로벌 지출 한도 메시지 및 30초 또는 300초 후 재시도.
Scoped spend brake429Numeric code 429 and a spend circuit-breaker message naming the scope.
청구 및 예산 관리402위에 나열된 안정적인 청구 문자열 코드를 사용하세요.
오류 envelope는 엔드포인트마다 다릅니다. HTTP 상태와 존재하는 경우 error.type을 사용하세요. error.code는 문자열 또는 숫자이며 생략될 수 있습니다. error.message는 표시용입니다.
비디오 및 미디어 리소스 상태
Video validation commonly returns numeric code 400. Missing jobs return 404, retired models 410, unfinished video content 409, and invalid video byte ranges 416.
재시도 정책
Retry only failures that may recover without changing the request. Honor Retry-After or use exponential backoff with jitter. Do not stack SDK and manual retries.
백오프로 재시도
429, 502, 503, and 504. Check the original generation job before creating another after an ambiguous network failure.
재시도하기 전에 수정하세요
400, 401, 402, 403, 404, 409, 410, 413, and 416. Fix the request, credentials, balance, permissions, resource state, or Range header first.
오류 처리
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import random
import time
from openai import OpenAI, APIStatusError
client = OpenAI(
base_url="https://api.bazaarlink.ai/v1",
api_key="sk-bl-YOUR_API_KEY",
max_retries=0, # Avoid double retries; this example handles them.
)
RETRYABLE = {429, 502, 503, 504}
for attempt inrange(5):
try:
response = client.chat.completions.create(
model="openai/gpt-4o",
messages=[{"role": "user", "content": "Hello!"}],
)
breakexcept APIStatusError as error:
if error.status_code notin RETRYABLE or attempt == 4:
raise
retry_after = error.response.headers.get("Retry-After")
delay = (
float(retry_after)
if retry_after
elsemin(8, 0.5 * (2 ** attempt)) + random.uniform(0, 0.25)
)
time.sleep(delay)
스트리밍 오류 형식
토큰 스트리밍 전에 발생한 오류는 JSON 바디와 함께 표준 HTTP 오류 응답을 반환합니다.
스트림이 시작되면 HTTP 응답은 이미 200입니다. 각 SSE 데이터 프레임을 파싱하고, 최상위 error 또는 choices[0].finish_reason === "error"가 나타나면 실패한 불완전 응답으로 처리하세요.
스트림이 시작된 후 실패하면 BazaarLink가 최상위 error 객체가 담긴 마지막 SSE 이벤트를 보내고 이어서 data: [DONE]을 보낼 수 있습니다. 응답을 불완전한 것으로 처리하고, 부분 출력을 완료된 결과로 사용하지 마세요.
1
2
3
4
5
data: {"error":{"message":"The request could not be completed.","type":"upstream_error","code":502}}
data: [DONE]
// Branch on error.code; error.type can vary by failure path.
Support
Hi! How can we help you? Send a message and we'll get back to you soon.