Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
了解如何在 Pydantic AI 中配置 OpenAI provider,接入 siflow endpoint,并使用算秩模型实现类型化 structured outputs 和 tool calling。
glm-5.2
export SIFLOW_API_KEY="<Your API Key>"
OpenAIChatModel
OpenAIProvider
base_url
import os from pydantic_ai import Agent from pydantic_ai.models.openai import OpenAIChatModel from pydantic_ai.providers.openai import OpenAIProvider model = OpenAIChatModel( "glm-5.2", provider=OpenAIProvider( base_url="https://api.siflow.cn/model-api/v1", api_key=os.environ["SIFLOW_API_KEY"], ), ) agent = Agent(model)
OpenAIChatModel("<id>")
OpenAIModel
OpenAIProvider(base_url=…)
https://api.siflow.cn/model-api/v1
/chat/completions
OpenAIProvider(api_key=…)
result = agent.run_sync("In one short sentence, which model are you?") print(result.output) # → a normal completion from siflow, e.g. "I am GLM, a large language model…"