Skip to content

OpenAI SDK and curl

Developers building their own server-side integrations with Python, Node, or direct HTTP.

  • An OpenAI-compatible SDK or curl
  • A GlideflowAI API key

Create a key in the GlideflowAI dashboard.

Use https://api.glideflowai.com/v1.

Start with glm-5.2. Copy exact IDs from the model catalog.

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)
Terminal window
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}'
  • glm-5.2 and qwen3.7-max-2026-06-08 can 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 choices is empty. Official SDKs skip it. Custom clients must check choices.length before reading choices[0].
  • HTTP 503 with 无可用渠道 means the model ID is wrong or unavailable for the key.

/v1/chat/completions is the recommended endpoint for SDK use. /v1/responses is also available and works for every model.