Skip to content
向量潮汐 / Vectide

VECTIDE · Practical documentation

Connect with the OpenAI Python SDK

Store credentials in environment variables and set base_url for a Chat Completions request.

Updated 14 October 2026 · Maintained by Vectide

Initialize OpenAI with your Vectide key and base_url, then use an exact model ID from your plan. This example covers basic text chat; it does not establish support for every OpenAI API.

Install and configure

python -m pip install openai

Set VECTIDE_API_KEY and VECTIDE_MODEL in the environment running your program. You can start with glm-5.3 if your plan includes it. Inject credentials into the process instead of committing them in source code.

A minimal request

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["VECTIDE_API_KEY"],
    base_url="https://vectide.cn/v1",
    timeout=60.0,
    max_retries=0,
)
response = client.chat.completions.create(
    model=os.environ["VECTIDE_MODEL"],
    messages=[{"role": "user", "content": "Reply with a short greeting."}],
    stream=False,
)
print(response.choices[0].message.content)

Automatic retries are disabled here to make the first request easier to inspect. Before production use, add bounded retry and timeout behavior appropriate to the error, and reconcile any repeated usage.

Separate SDK and service issues

SymptomCheck
Missing environment variableConfirm the variables reach the terminal or service process running Python.
401 / 403Check credentials, account and model entitlement without logging the full key.
404Keep base_url at /v1; do not append /chat/completions.
curl works; SDK failsCompare model ID, base_url, SDK version and additional parameters.
Response returned; task failedInspect completion and application parsing, tools and context settings.

After setup

Validate streaming, tools and optional fields with your selected model and workload before increasing usage. The example follows the official SDK client pattern; your account access must be checked with your own credentials.

References and service information: OpenAI Python SDK Chat Completions reference

Continue with