01첫 요청
API 키 발급과 호출은 Standard 이상 요금제에서 제공됩니다. 운영 요청은 서버에서 발급한 고객 API 키를 Bearer 토큰으로 전달하며, 키를 브라우저나 앱 번들에 포함하지 마세요.
curl https://blindpick.ai/api/v1/chat/completions \
-H "Authorization: Bearer $BLINDPICK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"messages": [{"role": "user", "content": "Summarize this document in three lines"}],
"router": {"optimize_for": "balanced", "fallback": "approved-models"}
}'
OpenAI JavaScript SDK
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.BLINDPICK_API_KEY,
baseURL: "https://blindpick.ai/api/v1"
});
const result = await client.chat.completions.create({
model: "auto",
messages: [{ role: "user", content: "Analyze the key risks" }]
});
console.log(result.choices[0].message.content);
02Streaming
stream: true returns OpenAI-compatible SSE deltas and [DONE]. Enable stream_options.include_usage to receive usage in the final chunk.
const stream = await client.chat.completions.create({
model: "auto",
messages: [{ role: "user", content: "Create a launch checklist" }],
stream: true,
stream_options: { include_usage: true }
});
for await (const event of stream) {
process.stdout.write(event.choices[0]?.delta?.content ?? "");
}
The X-Blindpick-Stream-Mode response header is native or buffered. Use X-Request-Id and X-Blindpick-Decision-Id for support and execution tracing.
03Routing 옵션
| 필드 | 값 | 용도 |
|---|
model | auto or a model ID | Automatic selection or fixed model |
router.optimize_for | auto, quality, balanced, latency, throughput, cost, reliability | 목표를 모델 점수·provider 정렬·폴백 설정으로 자동 변환 |
router.provider_sort | latency, throughput, price | OpenRouter 사용 시 승인 provider 안에서 정렬 |
router.preset | balanced, performance, speed, economy | 이전 버전 호환용 저수준 가중치 |
router.provider | provider ID | 지정 시 해당 모델 공급자로 강제 제한 |
router.data_class | general, confidential, restricted | 데이터 처리 경로 제한 |
router.fallback | off, same-model, approved-models | 실패 시 허용 범위 |
router.max_cost_usd | 양수 | 요청당 비용 상한 |
optimize_for combines intent, Arena-style preference confidence, quality, speed, cost, and provider health to build model and execution settings. Request options cannot weaken the API key's security or cost policy.
Send the same request to POST /api/v1/routes/preview to inspect detected intent, compiled policy, candidate scores, and selection rationale without executing it.
04오류와 재시도
| HTTP | 의미 | 권장 처리 |
|---|
| 400 | 요청 또는 정책 제약 오류 | 요청을 수정하고 재시도하지 않음 |
| 401 / 403 | 키·scope·권한 오류 | 키와 권한 확인 |
| 402 | 크레딧 부족 | 충전 또는 한도 조정 |
| 409 | capability 확인 또는 실행 상태 충돌 | 응답 지시에 따라 명시적 capability 선택 |
| 429 | 요청 한도 초과 | 지수 백오프와 jitter 적용 |
| 503 | Temporary provider or service unavailability | Retry-After — retry sparingly after the indicated time |
Errors use error.message, error.type, and error.code. Do not automatically retry payment or permission errors; retry only 429 and 503 responses under the same idempotency conditions.
05고급 Responses API
Use POST /api/v1/responses for Agent and development tasks beyond chat. First query GET /api/v1/capabilities for features executable by the current key; unavailable capabilities are never silently replaced with ordinary chat.
POST /api/v1/responses — create a synchronous response or background jobGET /api/v1/responses/:id — retrieve status and resultGET /api/v1/responses/:id/events — progress event SSEPOST /api/v1/responses/:id/cancel — cancel a task