Skip to main content

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.

Also applies to other OpenAI-compatible clients

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:

# 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
The two CLIs have different subcommand syntax
  • 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 the embeddings / responses subcommands — 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 caseGo version commandPython version command / alternative
List modelsopenai models listopenai api models.list
Chat Completionsopenai chat completions createopenai api chat.completions.create
Responses APIopenai responses createPython SDK: client.responses.create(...)
Embeddingsopenai embeddings createPython SDK: client.embeddings.create(...)
Image generationopenai images generateopenai api images.generate
Speech synthesis / transcriptionopenai audio:speech create / audio:transcriptions createopenai 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_KEY is set: echo $OPENAI_API_KEY
  • The API Key must be a Turing Platform key starting with sk-

404 Not Found

  • Confirm that OPENAI_BASE_URL ends 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

Reference Documentation