본문으로 건너뛰기
Drop-in API Converter

Convert OpenAI & Anthropic Requests to bf16.ai Snippets

Pick your wire protocol and model to copy working snippets for cURL, Python (pip install bf16ai), TypeScript (bf16-ai-sdk-provider), Go (bf16-go), Rust (bf16), or npx bf16ai. Note: Anthropic SDKs use https://api.bf16.ai without /v1.

Wire Protocol
Create API Key

cURL

OpenAI Chat Completions base URL: https://api.bf16.ai/v1
curl -sS https://api.bf16.ai/v1/chat/completions \
  -H "Authorization: Bearer $BF16_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "deepseek/deepseek-v4.1-flash-uncensored",
  "stream": false,
  "messages": [
    {
      "role": "system",
      "content": "You are a concise principal systems engineer."
    },
    {
      "role": "user",
      "content": "Audit this SQL migration helper for injection sinks and output strict JSON."
    }
  ]
}'

Python (`pip install bf16ai`)

Python 3.9+ SDK
from bf16ai import Client

client = Client()  # reads BF16_API_KEY, zero external dependencies
reply = client.chat(
    "deepseek/deepseek-v4.1-flash-uncensored",
    messages=[
        {"role": "system", "content": "You are a concise principal systems engineer."},
        {"role": "user", "content": "Audit this SQL migration helper for injection sinks and output strict JSON."},
    ],
)
print(reply["choices"][0]["message"]["content"])

TypeScript (`bf16-ai-sdk-provider`)

Node.js / Vercel AI SDK v6
import { generateText } from "ai";
import { createBf16 } from "bf16-ai-sdk-provider";

const bf16 = createBf16({ apiKey: process.env.BF16_API_KEY });
const { text } = await generateText({
  model: bf16("deepseek/deepseek-v4.1-flash-uncensored"),
  system: "You are a concise principal systems engineer.",
  prompt: "Audit this SQL migration helper for injection sinks and output strict JSON.",
});

Go / Rust / CLI

Multi-language SDKs & Zero-Touch CLI
npx bf16ai claude   # Zero-touch coding agent launcher
npx bf16ai opencode # OpenCode launcher
npx bf16ai doctor   # Verify API key & latency

# --- Go (github.com/BF16-AI/bf16-go) ---
package main

import (
  "context"
  "fmt"
  "os"
  bf16 "github.com/BF16-AI/bf16-go"
)

func main() {
  client := bf16.New(os.Getenv("BF16_API_KEY"))
  res, _ := client.ChatCompletion(context.Background(), bf16.ChatRequest{
    Model: "deepseek/deepseek-v4.1-flash-uncensored",
    Messages: []bf16.Message{
      {Role: "system", Content: "You are a concise principal systems engineer."},
      {Role: "user", Content: "Audit this SQL migration helper for injection sinks and output strict JSON."},
    },
  })
  fmt.Println(res.Choices[0].Message.Content)
}

# --- Rust (cargo add bf16) ---
use bf16::{Client, ChatRequest, Message};

let client = Client::from_env()?;
let res = client.chat(&ChatRequest::new(
    "deepseek/deepseek-v4.1-flash-uncensored",
    vec![Message::system("You are a concise principal systems engineer."), Message::user("Audit this SQL migration helper for injection sinks and output strict JSON.")],
)).await?;

More Free Developer Tools