본문으로 건너뛰기
모든 클라이언트
OpenAI, Anthropic & Vercel AI SDKs1M Context · ZDR

curl 및 공식 SDK

키 작동을 가장 빠르게 확인하는 요청과 두 가지 공식 SDK 연동법.

기본 URL
https://api.bf16.ai/v1
프로토콜
openai-completions

대상 사용자
자체 코드나 서버에 bf16을 직접 연동하는 모든 개발자.

아키텍처 및 bf16.ai 연동 구조

Unified multi-protocol gateway on https://api.bf16.ai supporting OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and Vercel AI SDK
One sk-bf16-v1-* key speaks all three wire protocols against api.bf16.ai: /v1/chat/completions, /v1/responses, and /v1/messages.

bf16.ai exposes three native wire surfaces on a single prepaid USD balance: OpenAI Chat Completions (`POST https://api.bf16.ai/v1/chat/completions`), stateless OpenAI Responses (`POST https://api.bf16.ai/v1/responses`), and Anthropic Messages (`POST https://api.bf16.ai/v1/messages`).

Every response includes `x-request-id`, `x-bf16-model`, rate-limit headers, and optional `x-bf16-cost-usd` when `X-BF16-Include-Cost: true` is sent — plus 24-hour transactional `Idempotency-Key` protection so network retries never double-bill.

명령어에는 $BF16_API_KEY가 표시됩니다. 로그인하면 내 실제 키가 자동으로 채워집니다.

원커맨드 빠른 설정

One-Command End-to-End Streaming & Cost Header Probe

Sends a live Chat Completions request with `X-BF16-Include-Cost: true` and prints both the response headers (`x-bf16-cost-usd`) and JSON body.

export BF16_API_KEY="sk-bf16-v1-..."
curl -fsSi "https://api.bf16.ai/v1/chat/completions" \
  -H "Authorization: Bearer $BF16_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-BF16-Include-Cost: true" \
  -d '{"model":"deepseek/deepseek-v4.1-flash-uncensored","messages":[{"role":"user","content":"Say ok."}],"max_tokens":16}'
  1. 1

    단일 요청으로 확인

    curl https://api.bf16.ai/v1/models -H "Authorization: Bearer $BF16_API_KEY"
  2. 2

    OpenAI SDK

    base_url을 https://api.bf16.ai/v1로, api_key를 bf16 키로 지정하면 나머지 코드는 그대로 작동합니다.

    import OpenAI from 'openai';
    
    const client = new OpenAI({
      baseURL: 'https://api.bf16.ai/v1',
      apiKey: process.env.BF16_API_KEY, // sk-bf16-v1-...
    });
    
    const res = await client.chat.completions.create({
      model: 'zai-org/glm-5.3-uncensored',
      messages: [{ role: 'user', content: 'Say ok.' }],
    });
  3. 3

    Anthropic SDK

    base_url을 https://api.bf16.ai(/v1 제외)로 지정하고 x-api-key 또는 Bearer 토큰으로 키를 전달합니다.

    import Anthropic from '@anthropic-ai/sdk';
    
    const anthropic = new Anthropic({
      baseURL: 'https://api.bf16.ai', // no /v1
      apiKey: process.env.BF16_API_KEY, // sk-bf16-v1-...
    });
    
    const msg = await anthropic.messages.create({
      model: 'zai-org/glm-5.3-uncensored',
      max_tokens: 1024,
      messages: [{ role: 'user', content: 'Say ok.' }],
    });
api.bf16.ai — Multi-Protocol Wire Contract
설정 필드 인스펙터
Bearer sk-bf16-v1-* · Zero Session Cookies · ZDR

핵심 설정값 대조표

OpenAI SDK / Vercel AI SDK baseURL
https://api.bf16.ai/v1
Anthropic SDK baseURL
https://api.bf16.ai

No /v1 — @anthropic-ai/sdk appends /v1/messages.

Cost & Guard Headers
X-BF16-Include-Cost: true · X-BF16-Max-Price-Per-M-Output · Idempotency-Key
Commercial SaaS builders: pass `user` (OpenAI) or `metadata.user_id` (Anthropic) to isolate downstream sub-users cleanly.

역할별 권장 모델 구성

복잡한 설계는 플래그십 모델로, 병렬 서브에이전트와 스크린샷은 Flash 모델로 분리하세요.

역할모델 ID권장 사유USD / 1M 토큰
High-Throughput API, Vision & JSON Extractiondeepseek/deepseek-v4.1-flash-uncensoredFastest TTFT and lowest per-token rate with full 1M context + Vision + JSON Schema.$0.26 in / $0.045 cached / $1.00 out
Complex Code, Reasoning & Tool Loopszai-org/glm-5.3-uncensoredFlagship multi-turn tool calling across both OpenAI and Anthropic SDKs.$1.35 in / $0.25 cached / $4.20 out
2.8T Multimodal Flagshipmoonshotai/kimi-k3.1-pro-uncensoredMaximum creative, multilingual, and visual depth across 1M tokens.$1.95 in / $0.28 cached / $6.90 out

제대로 작동하는지 확인하는 방법

  • 응답에서 /models 카탈로그의 모델 ID를 확인할 수 있습니다.

운영 가드레일 및 예산 격리

  • Attach an `Idempotency-Key` header (8–128 visible ASCII chars) on non-idempotent background jobs so network timeouts never trigger duplicate inference.
  • Keep `sk-bf16-v1-*` keys strictly server-side in production apps.

자주 발생하는 오류

증상
Anthropic SDK에서 404 오류가 반환됩니다.
원인
기본 URL에 /v1이 들어가 SDK가 경로를 중복으로 붙였습니다.
해결
https://api.bf16.ai 주소를 사용하세요.