> ## Documentation Index
> Fetch the complete documentation index at: https://javaai.pig4cloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SiliconFlow API 对接

<Card title="写在最前：问题咨询请直接点击此处提交 ISSUE" icon="star" href="https://github.com/pig-mesh/deepseek4j/issues">
  * ⭐️ **请先 Star 本项目后再提问，作者精力有限，未 Star 直接 Close**
  * 🐞 [GitHub ISSUE](https://github.com/pig-mesh/deepseek4j/issues) 需包含：问题截图 + SDK版本 + 配置代码
</Card>

本文将介绍如何使用 deepseek4j 接入硅基流动的 R1 模型。

\##硅基流动配置准备

### 1. 获取硅基流动访问凭证

1. 登录硅基流动控制台 [https://cloud.siliconflow.cn/account/ak](https://cloud.siliconflow.cn/i/YKcJJTYP)
2. 创建新的 API 密钥并保存

<img src="https://minio.pigx.vip/oss/202502/1738983332.png" alt="1738983332" />

## deepseek4j 配置

### 1. 配置文件设置

在 `application.properties` 或 `application.yml` 中添加以下配置：

<Warning>注意模型名称：deepseek-ai/DeepSeek-R1</Warning>

```yaml theme={"system"}
deepseek:
  base-url: https://api.siliconflow.com/v1
  model: deepseek-ai/DeepSeek-R1
  api-key: your-api-key

```

### 2. 代码示例

```java theme={"system"}
@Autowired
private DeepSeekClient deepSeekClient;

@GetMapping(value = "/chat", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<ChatCompletionResponse> chat(String prompt) {
    return deepSeekClient.chatFluxCompletion(prompt);
}
```

<Card title="PIG AI应用开发平台 | 适合中大型企业构建自主可控的AI中台" icon="link" href="https://ai.pig4cloud.com">
  **为Java开发者提供全栈式AI工程化解决方案**，强类型/高可维护性架构，内置30+主流大模型支持。

  * **🔍 知识引擎体系**：RAG 知识引擎全自动化多模态解决方案
  * **📝 AI-OCR 中枢**：复杂非标场景高精度识别
  * **⚙️ 业务智能融合**：函数编排 + Chat2SQL，无缝对接现有业务系统
  * **🛡️ N维风控体系**：敏感词/IP/Token/User 规则控制引擎
</Card>

<Card title="文档有误？请协助编辑" icon="pencil" href="https://github.com/javaai-pig4cloud-com/javaai-docs/edit/main/deepseek/siliconflow.mdx">
  发现文档问题？点击此处直接在 GitHub 上编辑并提交 PR，帮助我们改进文档！
</Card>

<Card title="文档有误？请协助编辑" icon="pencil" href="https://github.com/javaai-pig4cloud-com/javaai-docs/edit/main/deepseek/siliconflow.mdx">
  发现文档问题？点击此处直接在 GitHub 上编辑并提交 PR，帮助我们改进文档！
</Card>
