R
Relayby Ai5labs
← Back to all models

baidu/ernie-4.5-21b-a3b

$0.07
Input / 1M
$0.28
Output / 1M
120K
Context
Speed

Capabilities

tools

Use ernie-4.5-21b-a3b via Relay

Configure the model alias in YAML, then call it from Python.

YAML
# models.yaml
version: 1
models:
  ernie:
    target: baidu/ernie-4.5-21b-a3b
    credential: $env.BAIDU_API_KEY
Python
from relay import Hub

async with Hub.from_yaml("models.yaml") as hub:
    resp = await hub.chat(
        "ernie",
        messages=[{"role": "user", "content": "Hello"}],
    )
    print(resp.text, resp.cost_usd)

pip install ai5labs-relay · full docs on GitHub

Compare with