How to connect the OpenAI SDK to the GPT88 API
Connect to the GPT88 API through the OpenAI-compatible interface by changing the base URL, API key, and model.
The problem
Existing OpenAI SDK projects usually need only a base URL, API key, and model change.
Shortest working configuration
OPENAI_API_KEY=your_gpt88_api_key
OPENAI_BASE_URL=https://api.gpt88.cc/v1
OPENAI_MODEL=gpt-5.6-solKeep API keys in server-side environment variables or a secret manager. Never commit them or expose them in frontend code.
Complete examples
curl https://api.gpt88.cc/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.6-sol","messages":[{"role":"user","content":"返回 OK"}],"max_tokens":32}'import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["OPENAI_API_KEY"],
base_url=os.getenv("OPENAI_BASE_URL", "https://api.gpt88.cc/v1"),
)
response = client.chat.completions.create(
model=os.getenv("OPENAI_MODEL", "gpt-5.6-sol"),
messages=[{"role": "user", "content": "返回 OK"}],
max_tokens=32,
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
baseURL: process.env.OPENAI_BASE_URL ?? "https://api.gpt88.cc/v1",
});
const response = await client.chat.completions.create({
model: process.env.OPENAI_MODEL ?? "gpt-5.6-sol",
messages: [{ role: "user", content: "返回 OK" }],
max_tokens: 32,
});
console.log(response.choices[0].message.content);Common errors
- 401: check the Bearer key.
- 404: keep the base URL at /v1.
- model_not_found: copy the exact model ID.
- 429: reduce concurrency and back off.
Pricing and billing
Actual cost depends on the current model, group multiplier, input, and output usage shown in the GPT88 console.