OpenAI CLI Integration Guide for Turing Platform
OpenAI CLI is the official command-line tool provided by OpenAI, allowing you to call the Responses, Chat, Embeddings, Images, Audio, and other APIs directly from the terminal. It is essentially a lightweight HTTP client that points to any OpenAI-compatible endpoint via the OPENAI_BASE_URL environment variable — the Turing Platform's /api/v1 is natively compatible, and only two environment variables need to be configured.
Turing's OpenAI-compatible API works with any client that follows the OPENAI_BASE_URL convention: openai-python / openai-node SDKs, LiteLLM, LangChain, LlamaIndex, aider, Continue.dev, and more. The configuration approach is the same as described here — point the base URL to https://live-turing.cn.llm.tcljd.com/api/v1 and set your API Key in OPENAI_API_KEY.
Prerequisites
- A Turing Platform API Key (how to obtain one)
- macOS / Linux / WSL2 (the Go version requires Go 1.25+, or install via Homebrew)
Step 1: Installation
OpenAI provides two CLIs — choose one:
Official Go version (recommended, consistent with official documentation syntax)
# Homebrew
brew install openai/tools/openai
# Or go install
go install github.com/openai/openai-cli/cmd/openai@latest
openai --version
CLI bundled with the Python SDK (legacy, included when you install the openai package via pip)
pip install openai
openai --version # e.g. 1.102.0
- Go version:
openai responses create --model X --input "..."(consistent with official documentation) - Python version:
openai api chat.completions.create -m X -g user "...", and does not support theembeddings/responsessubcommands — for those endpoints, use the Python SDK directly.
Step 2: Configure Environment Variables
export OPENAI_API_KEY="<your Turing API Key>"
export OPENAI_BASE_URL="https://live-turing.cn.llm.tcljd.com/api/v1"
Add these to ~/.zshrc or ~/.bashrc to make them persistent.
Step 3: Verify
Go version
# List models
openai models list
# Responses API
openai responses create \
--model turing/gpt-5.5 \
--input "Introduce the Turing Platform in one sentence"
# Chat Completions
openai chat completions create \
--model turing/gpt-5.5 \
--message role=user,content="hello"
Python version
# List models
openai api models.list
# Chat Completions
openai api chat.completions.create \
-m turing/gpt-5.5 \
-g user "hello"
# Use the Python SDK for Embeddings / Responses
python -c "import openai; print(openai.OpenAI().responses.create(\
model='turing/gpt-5.5', input='hello').output_text)"
python -c "import openai; print(len(openai.OpenAI().embeddings.create(\
model='turing/text-embedding-3-small', input='hello').data[0].embedding))"
Common API Reference
| Use case | Go version command | Python version command / alternative |
|---|---|---|
| List models | openai models list | openai api models.list |
| Chat Completions | openai chat completions create | openai api chat.completions.create |
| Responses API | openai responses create | Python SDK: client.responses.create(...) |
| Embeddings | openai embeddings create | Python SDK: client.embeddings.create(...) |
| Image generation | openai images generate | openai api images.generate |
| Speech synthesis / transcription | openai audio:speech create / audio:transcriptions create | openai api audio.transcriptions.create |
For the full list of subcommands and parameters, refer to the OpenAI CLI official documentation.
Troubleshooting
401 / 403
- Confirm
OPENAI_API_KEYis set:echo $OPENAI_API_KEY - The API Key must be a Turing Platform key starting with
sk-
404 Not Found
- Confirm that
OPENAI_BASE_URLends with/api/v1— do not omit/v1 - Correct:
https://live-turing.cn.llm.tcljd.com/api/v1
Incorrect model name
- Turing model names typically include the
turing/prefix (e.g.turing/gpt-5.5,turing/text-embedding-3-small) - Full list: Model list or
openai models list