OpenAI endpoint stage 09 — compatibility harness
Stage 9 of the OpenAI-compatible endpoint branch.
Implemented:
- Added compatibility coverage for OpenAI SDK-style payloads, LangChain-style stop payloads, LiteLLM/vLLM-style sampling fields, llama.cpp-style tokenize/detokenize helpers, embeddings, and negative OpenAI-shaped errors.
- Added
POST /v1/responsesas a minimal text Responses API surface. - Added
POST /v1/chat/completions/input_tokensfor chat token counting. - Added
GET /metricswith Prometheus-style text output. - Added an optional real OpenAI Python SDK smoke test that starts a local uvicorn server and exercises models, chat, streaming chat, completions, and embeddings.
- Added
scripts/openai_compat_smoke.pyfor smoke-testing a runningdrift serveserver with only Python stdlib HTTP calls. - Added
docs/openai-compatibility.mddocumenting supported endpoints, supported parameters, explicit unsupported areas, SDK smoke commands, and DRIFT preservation gates. - Explicitly scoped unsupported tool calling, JSON schema/JSON mode, multimodal/audio, and thin-mode sampling/embeddings with clear OpenAI-shaped errors.
Verification:
- System Python:
python3 -m pytest tests/test_openai_api.py tests/test_openai_compat_payloads.py tests/test_openai_sdk_smoke.py tests/test_sampling_controls.py -q(32 passed, 2 skipped because system Python lacks openai and torch) - SDK venv:
PYTHONPATH=$PWD /tmp/drift-openai-sdk-venv/bin/python -m pytest tests/test_openai_api.py tests/test_openai_compat_payloads.py tests/test_openai_sdk_smoke.py tests/test_sampling_controls.py -q(33 passed, 1 skipped because venv lacks torch) python3 -m compileall drift tests scripts/openai_compat_smoke.py