> Documentation index for agents: https://docs.rocketride.ai/llms.txt

# llm_baidu_qianfan

A RocketRide LLM node that calls Baidu Qianfan ERNIE chat models through Qianfan's OpenAI-compatible chat-completions API.

## What it does

Connects a pipeline to Baidu Qianfan ERNIE large language models for chat-based text
generation, question answering, summarization, and Chinese-language enterprise AI
workflows. Questions arriving on the `questions` lane are answered by the configured
ERNIE model and emitted on the `answers` lane.

Uses **langchain-openai** (`ChatOpenAI`) over the **openai** Python SDK, pointed at
Qianfan's OpenAI-compatible endpoint. Temperature is fixed at `0` for deterministic
output, and generation is capped at the profile's output-token limit.

When you save the node configuration, the node validates it live: it sends a tiny test
completion (`"Hi"`, max 8 tokens) to the configured endpoint and surfaces a specific
warning for an invalid API key, an empty model name, a non-positive token limit, a rate
limit, an unreachable base URL, or any other API error.

At runtime, rate-limit and connection errors are treated as retryable; authentication
and other API errors fail immediately with a user-facing message.

## Lanes

| Lane in     | Lane out  | Description                                          |
| ----------- | --------- | ---------------------------------------------------- |
| `questions` | `answers` | Send a question directly, receive a generated answer |

## Profiles

Default: **ERNIE 4.5 Turbo 128K** (`ernie-4-5-turbo-128k`).

| Profile | Model | Context tokens | Output tokens |
| ------- | ----- | -------------- | ------------- |
| `ernie-4-5-turbo-128k` **(default)** | `ernie-4.5-turbo-128k` | 128,000 | 4,096 |
| `ernie-4-5-turbo-32k` | `ernie-4.5-turbo-32k` | 32,768 | 4,096 |
| `ernie-5-0-thinking-preview` | `ernie-5.0-thinking-preview` | 128,000 | 8,192 |
| `custom` | _(user-specified)_ | 32,768 | 4,096 |

The named profiles pin the model name and token limits; only the API key, base URL, and
model source are editable. The **Custom** profile additionally exposes `model`,
`modelTotalTokens`, and `modelOutputTokens` so you can target any model available on
your Qianfan account.

## Configuration

Choose a named profile for a supported ERNIE model or `custom` for another model on
your account. Named profiles provide the model and token budgets; most pipelines only
need an API key and the correct regional endpoint.

### Base URL

Use `https://qianfan.baidubce.com/v2` for keys issued in China (the default) or
`https://api.baiduqianfan.ai/v1` for international keys. The endpoint and key must
belong to the same Qianfan environment.

## Authentication

Provide a Qianfan API key in `apikey`: it is required, and the node refuses to start
without one. The key must have access to the selected model.

An invalid or unauthorized key is reported as "Baidu Qianfan API key is invalid or
unauthorized" both at save-time validation and at runtime.

## Notes

### Model sync

Profiles are maintained by the `sync_models` tooling (`llm_baidu_qianfan` provider,
`ROCKETRIDE_BAIDU_QIANFAN_KEY`), which reads Qianfan's own model list. The filter keeps
the `ernie-*` text chat models; embedding, rerank, image, vision-language (`vl`), audio
and speech variants are excluded, because they belong in dedicated nodes.

The sync runs **only** with that key. Qianfan's IDs are its own — OpenRouter lists a
single ERNIE model, and none of the three this node serves — so a keyless run could add
nothing but a foreign ID. Without the key the provider is skipped and nothing changes:
see [Why some providers need their own key](https://github.com/rocketride-org/rocketride-server/blob/develop/tools/sync_models/README.md#why-some-providers-need-their-own-key).

---

<!-- ROCKETRIDE:GENERATED:PARAMS START -->
<!-- Generated by nodes:docs-generate. Do not edit by hand. -->

## Schema

| Field | Type | Description | Default |
|---|---|---|---|
| `baidu_qianfan.profile` | `string` | **Model**<br/>Baidu Qianfan model selection | `"ernie-4-5-turbo-128k"` |
| `baidu_qianfan.serverbase` | `string` | **Base URL**<br/>Qianfan OpenAI-compatible API endpoint. | `"https://qianfan.baidubce.com/v2"` |
| `model` | `string` | **Model**<br/>Baidu Qianfan model name |  |
| `modelOutputTokens` | `integer` | **Output Tokens**<br/>Maximum generated tokens |  |
| `modelTotalTokens` | `number` | **Tokens**<br/>Maximum context length in tokens |  |

## Dependencies

- `openai`
- `langchain`
- `langchain-core`
- `langchain-openai`

## Source

[<svg viewBox="0 0 16 16" width="15" height="15" fill="currentColor" aria-hidden="true" style="vertical-align:-0.15em;margin-right:0.35em"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg> View source](https://github.com/rocketride-org/rocketride-server/tree/develop/nodes/src/nodes/llm_baidu_qianfan)
<!-- ROCKETRIDE:GENERATED:PARAMS END -->
