Saltar al contenido principal
Todos los clientes
Unified Python SDK & YAML Router1M Context · ZDR

LiteLLM

Run a local or internal LiteLLM Proxy (`litellm_config.yaml`) or Python SDK pointed at bf16.ai with per-request price ceilings.

URL Base
https://api.bf16.ai/v1
Protocolo
openai-completions

Para quién es
Backend and platform engineers integrating bf16.ai into Python pipelines, DSPy, CrewAI, LangGraph, or internal team gateways via LiteLLM.

Arquitectura y Ventajas con bf16.ai

LiteLLM Proxy and Python SDK routing openai/* model definitions to https://api.bf16.ai/v1
LiteLLM maps model_list entries using the openai/ provider prefix directly to https://api.bf16.ai/v1 while passing X-BF16-Max-Price-Per-M-Output and Idempotency-Key headers.

LiteLLM powers model routing inside dozens of Python AI frameworks (DSPy, CrewAI, AutoGen, OpenHands, Aider) and runs standalone as an internal YAML-configured proxy gateway.

Prefixing model IDs with `openai/` in `litellm_config.yaml` tells LiteLLM to forward standard OpenAI Chat Completions (including streaming `usage`, `reasoning_content`, Vision images, and structured JSON Schema) straight to `https://api.bf16.ai/v1`.

Los comandos muestran $BF16_API_KEY. Inicia sesión para rellenar tu clave real automáticamente.

CONFIGURACIÓN EN 1 COMANDO

One-Command `litellm_config.yaml` Generator & Smoke Test

Writes a production-ready `litellm_config.yaml` in your current directory with all active bf16.ai 1M-context models and verifies gateway connectivity.

export BF16_API_KEY="sk-bf16-v1-..."
cat <<'EOF' > ./litellm_config.yaml
model_list:
  - model_name: glm-5.3-uncensored
    litellm_params:
      model: openai/zai-org/glm-5.3-uncensored
      api_base: https://api.bf16.ai/v1
      api_key: os.environ/BF16_API_KEY
    model_info:
      max_input_tokens: 1048576
      max_output_tokens: 131072
      supports_function_calling: true
  - model_name: deepseek-v4.1-flash-uncensored
    litellm_params:
      model: openai/deepseek/deepseek-v4.1-flash-uncensored
      api_base: https://api.bf16.ai/v1
      api_key: os.environ/BF16_API_KEY
    model_info:
      max_input_tokens: 1048576
      max_output_tokens: 65536
      supports_vision: true
      supports_function_calling: true
  - model_name: kimi-k3.1-pro-uncensored
    litellm_params:
      model: openai/moonshotai/kimi-k3.1-pro-uncensored
      api_base: https://api.bf16.ai/v1
      api_key: os.environ/BF16_API_KEY
    model_info:
      max_input_tokens: 1048576
      max_output_tokens: 131072
      supports_vision: true
      supports_function_calling: true
EOF
curl -fsS "https://api.bf16.ai/v1/models" -H "Authorization: Bearer $BF16_API_KEY" >/dev/null && echo "Wrote ./litellm_config.yaml — start with: litellm --config litellm_config.yaml --port 4000"
  1. 1

    Call Directly from Python via `litellm.completion`

    Prefix the model ID with `openai/` and point `api_base` to https://api.bf16.ai/v1.

    import os
    from litellm import completion
    
    res = completion(
        model="openai/deepseek/deepseek-v4.1-flash-uncensored",
        api_base="https://api.bf16.ai/v1",
        api_key=os.environ["BF16_API_KEY"],
        messages=[{"role": "user", "content": "Summarize CWE-416 remediation steps in strict JSON."}],
        temperature=0.1,
    )
    print(res.choices[0].message.content)
  2. 2

    Or Launch LiteLLM Proxy with `litellm_config.yaml`

    Generate `litellm_config.yaml` using the One-Command block above and start the proxy on port 4000.

    ./litellm_config.yaml
    export BF16_API_KEY=sk-bf16-v1-...
    litellm --config ./litellm_config.yaml --port 4000
LiteLLM Proxy — litellm_config.yaml
INSPECTOR DE PARÁMETROS
model_list[*].litellm_params · openai/ prefix

Referencia Campo por Campo

litellm_params.model
openai/zai-org/glm-5.3-uncensored

Leading `openai/` tells LiteLLM to use OpenAI-compatible wire format.

litellm_params.api_base
https://api.bf16.ai/v1
litellm_params.api_key
os.environ/BF16_API_KEY
Optional Cost Ceiling Header
X-BF16-Max-Price-Per-M-Output: "4.50"
LiteLLM also supports Anthropic passthrough on https://api.bf16.ai (without /v1) using anthropic/ model prefixes.

Selección Recomendada de Modelos

Asigna planificación compleja a modelos Flagship y subtareas o capturas a modelos Flash.

RolModel IDJustificaciónUSD / 1M Tokens
Batch Localization, Extraction & Agent Loopsdeepseek/deepseek-v4.1-flash-uncensoredHigh throughput + Vision + JSON schema adherence for automated Python pipelines.$0.26 in / $0.045 cached / $1.00 out
Security Triage & Code Generationzai-org/glm-5.3-uncensoredFlagship analytical accuracy across multi-step LangGraph / DSPy chains.$1.35 in / $0.25 cached / $4.20 out

Cómo saber que funcionó

  • Python completion() or GET http://127.0.0.1:4000/v1/models returns 200 OK.
  • Settled usage and cached token counts match bf16.ai/dashboard/logs.
  • curl https://api.bf16.ai/v1/models -H "Authorization: Bearer $BF16_API_KEY"

Controles de Producción y Presupuesto

  • Pass `user="end_user_opaque_id"` on multi-tenant commercial integrations per /legal/terms §4.4 so abuse isolation targets sub-users first.
  • Attach `extra_headers={"X-BF16-Max-Price-Per-M-Output": "1.50"}` on batch Flash workers as a hard unit-price circuit breaker.

Errores comunes

Síntoma
LiteLLM tries to call DeepSeek or Moonshot official endpoints with your bf16 key.
Causa
You passed `deepseek/...` without the leading `openai/` adapter prefix, so LiteLLM matched its built-in vendor prefix.
Solución
Always prefix with `openai/` (e.g. `openai/deepseek/deepseek-v4.1-flash-uncensored`).

¿Aún no lo tienes?

pip install "litellm[proxy]"
Documentación oficial