一行代码即可迁移,无需重写应用
Grid 原生兼容 OpenAI 协议,因此您现有的客户端无需任何封装即可直接运行。您所获得的是未来随时调整模型策略的自由度。
- 发布时间
Grid speaks the OpenAI protocol. The client library you already have works against it without a wrapper, an adapter, or a vendor SDK. You change the base URL and keep everything else.
from openai import OpenAI
client = OpenAI(
base_url="https://api.genai.forlex.cloud/v1",
api_key=os.environ["FORLEX_API_KEY"],
)
The point is not the saved afternoon#
Being able to move in one line is worth something, but it is not the argument. The argument is what the line buys you afterwards: you can swap models, pin a version, or let Grid pick a route for you, and none of those changes your integration.
That is the difference between a provider you can leave and a provider you have integrated with. The second one has priced its switching cost into your roadmap, whether or not anyone wrote it down.
Check the parameter before you depend on it#
Speaking a protocol is not the same as implementing every corner of it, and claiming otherwise would be the kind of thing you only discover in production. OpenAI compatibility lists what is supported today. Read it before you build on a parameter, not after.