OpenAI SDK and curl
Who it’s for
Section titled “Who it’s for”Developers building their own server-side integrations with Python, Node, or direct HTTP.
Prerequisites
Section titled “Prerequisites”- An OpenAI-compatible SDK or curl
- A GlideflowAI API key
Get your API key
Section titled “Get your API key”Create a key in the GlideflowAI dashboard.
Base URL
Section titled “Base URL”Use https://api.glideflowai.com/v1.
Model ID
Section titled “Model ID”Start with glm-5.2. Copy exact IDs from the model catalog.
Minimal working config
Section titled “Minimal working config”from openai import OpenAI
client = OpenAI( api_key="sk-your-key", base_url="https://api.glideflowai.com/v1",)
r = client.chat.completions.create( model="glm-5.2", messages=[{"role": "user", "content": "Hello"}], max_tokens=1024,)
print(r.choices[0].message.content)Test it
Section titled “Test it”curl https://api.glideflowai.com/v1/chat/completions \ -H "Authorization: Bearer sk-your-key" \ -H "Content-Type: application/json" \ -d '{"model":"glm-5.2","messages":[{"role":"user","content":"Say OK"}],"max_tokens":512}'Common errors
Section titled “Common errors”glm-5.2andqwen3.7-max-2026-06-08can use a tiny output-token budget for reasoning and return empty visible text. Start at 512 or more.- Streaming can include a usage chunk where
choicesis empty. Official SDKs skip it. Custom clients must checkchoices.lengthbefore readingchoices[0]. - HTTP 503 with
无可用渠道means the model ID is wrong or unavailable for the key.
Notes / limitations
Section titled “Notes / limitations”/v1/chat/completions is the recommended endpoint for SDK use. /v1/responses is also available and works for every model.