Python 88.3%
TypeScript 7.6%
Shell 4.1%
1#!/usr/bin/env python32"""LEGACY Text Completions (POST /v1/complete) via raw HTTP.34STATUS: LEGACY + DEPRECATED + FAILED_VERIFICATION 2026-09-18 — the API returns 400 invalid_request_error5"The /v1/complete endpoint has been deprecated. Please use the /v1/messages endpoint instead."6anthropic 1.7.0 no longer has `client.completions` (removed in v1), so this uses scripts/live.py.7Run: .venv/bin/python examples/anthropic/messages/legacy_complete.py8"""9import json10import sys11from pathlib import Path1213sys.path.insert(0, str(Path(__file__).resolve().parents[3]))14from scripts.live import anthropic_request, mask # noqa: E4021516st, body, _ = anthropic_request("POST", "/v1/complete", {"model": "claude-2.1", "max_tokens_to_sample": 8,17 "prompt": "\n\nHuman: Reply with OK.\n\nAssistant:"}, note="example legacy_complete.py")18print("HTTP", st, mask(json.dumps(body)))19