此语言仍有 25 条内容或界面任务待翻译;未完成部分显示中文原文。
AI Tools Navigation / Local Deployment / 火山方舟 OpenAI SDK 兼容接口
本地部署 · 火山引擎

火山方舟 OpenAI SDK 兼容接口

Modify a small set of configurations such as base_url, model, and api_key to call Ark model services using the OpenAI SDK.

AI 辅助整理
OpenAI SDK compatibilityLLMAPILangChaindeep thinking

Tool Introduction

Volcano Ark's models API maintain compatibility with OpenAI API as much as possible. Developers only need to modify a small set of configurations such as base_url, model, and api_key in their existing OpenAI SDK code to access Ark models (the documentation examples use doubao-seed-2-1-pro-260915). The documentation provides Python examples covering chat completions calls, passing a thinking field via extra_body to toggle deep thinking, passing a request ID via custom headers to correlate logs, and integration with the LangChain OpenAI SDK. Note that: text embedding models are being gradually deprecated, and embedding-capable models do not support OpenAI API, so the Ark SDK must be used instead; community third-party SDKs are not maintained by the Volcano Engine team. Suitable for developers who already have OpenAI ecosystem code and want to migrate to or integrate with Ark-hosted models.

Who It's For

Python developers and backend engineers who already have OpenAI SDK or LangChain integration code and need to access Volcano Ark-hosted models (such as the doubao-seed series). This judgment is based on the integration scenarios the documentation targets: the documentation uses Python and LangChain OpenAI SDK examples to explain how to integrate Ark model services into existing systems.

Recommended Steps

  1. 01

    Install or upgrade the OpenAI SDK (openai>=1.0, Python 3.7 or above).

  2. 02

    Complete the preparation steps, such as obtaining the API Key and activating models, per the quick start guide.

  3. 03

    Create an OpenAI client, set base_url to https://ark.cn-beijing.volces.com/api/v3, and pass api_key via the ARK_API_KEY environment variable.

  4. 04

    In chat.completions.create, replace model with the Ark model ID (the example uses doubao-seed-2-1-pro-260915).

  5. 05

    For fields not supported by the OpenAI SDK, such as deep thinking, pass the thinking configuration via the extra_body dictionary.

  6. 06

    To correlate logs or enable data encryption, set custom headers via extra_headers (e.g., X-Client-Request-Id).

  7. 07

    For LangChain, install langchain-openai and configure ChatOpenAI with the same api_key, base_url, and model ID.

  8. 08

    When text embedding is needed, note that it does not support OpenAI API; use the Ark SDK instead and refer to the embedding documentation.

Know Before You Use

请核对官方的地区支持、数据政策和商用约定。

费用与套餐:以官网当前说明为准,本站不提供套餐价格保证。

Product Selection Assistant

让需求变成可修改的筛选条件

依据已录入参数生成条件,结果可查看和修改。帧率与性能需核对实测,不能仅凭算力数值保证。