Skip to content

豆包 基础

这是豆包 AI 平台的基础知识文档。

什么是豆包?

豆包是字节跳动开发的 AI 智能助手,提供对话、内容生成、知识查询等功能。

核心功能

  • 智能对话
  • 内容生成
  • 知识查询
  • 多轮交互
  • 自定义训练

快速开始

python
# 使用豆包 API 进行对话
import requests

api_key = 'your_api_key'
url = 'https://api.doubao.com/v1/chat/completions'

headers = {
    'Authorization': f'Bearer {api_key}',
    'Content-Type': 'application/json'
}

payload = {
    'model': 'doubao-pro',
    'messages': [
        {'role': 'system', 'content': '你是一个智能助手'}, 
        {'role': 'user', 'content': 'Hello, Doubao!'}]
}

response = requests.post(url, headers=headers, json=payload)
print(response.json()['choices'][0]['message']['content'])