The short answer
Use the Responses endpoint for Codex clients and GPT models that publish Responses support. Use Chat Completions for GLM, DeepSeek and GPT models whose catalog row lists that protocol. A Model.sale key works for both, but the exact model ID and endpoint must match the live catalog.
Do not treat the word ChatGPT as a guarantee that every ChatGPT product feature is available. This is a developer API compatibility path, not a consumer ChatGPT subscription, and tools such as files, web search or plugins require their own validated contract.
ChatGPT-compatible API for applications
Most OpenAI SDKs let you change only the base URL and key. Set the base URL to https://api.model.sale/v1, keep the Model.sale key in an environment variable and choose a live model from GET /v1/models.
For a Responses request, send an input string and a small max_output_tokens value first. Check the HTTP status, x-model-sale-request-id header and terminal usage before increasing context or output. For Chat Completions, send messages and consume the documented JSON or SSE response for that model.
Codex uses the Responses protocol
Codex CLI, Codex App and the VS Code Codex extension are coding clients, not separate model providers. Configure a custom provider with the Model.sale base URL, env_key and wire_api = "responses". Keep the secret outside config.toml and select a model whose row includes /v1/responses.
A Codex client may send long context, reasoning effort and streaming events. Start with a constrained API key, a low daily spend limit and a small model. If the Responses route returns 503 or the model is temporarily unavailable, choose another model explicitly; the gateway never silently substitutes one.
GLM and other open models
GLM and DeepSeek rows commonly expose /v1/chat/completions with SSE. Their model IDs, usage fields and reasoning controls can differ from GPT, so copy the exact ID and capabilities shown in the catalog instead of adding a provider alias.
A minimal GLM request looks like this: curl https://api.model.sale/v1/chat/completions \ -H "Authorization: Bearer $MODEL_SALE_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"glm-5.2","messages":[{"role":"user","content":"Reply exactly OK"}]}'
Streaming and cancellation
Interactive coding tools care about time to first byte and stream completion. Set stream=true only after a JSON call works, read events incrementally and wait for the terminal event. A client disconnect should cancel the upstream request and release the unused reservation when terminal usage is known.
If a stream closes early, do not immediately replay a long prompt. Check Usage with the request ID first. Missing terminal usage is retained for reconciliation, so a retry can create a second billable request if the first one actually completed upstream.
How prepaid billing differs
Model.sale reserves a safety amount before dispatch, then settles the exact charge from terminal usage and releases the remainder. The public rate is a blended USD charge per million charged tokens; it is not a direct copy of an official input or output column.
For a fair comparison, record the same input/output mix, cached-token treatment, reasoning level, minimum charge, retries and payment fees. A cheaper-looking GLM or GPT number is not automatically cheaper for a coding-agent workload with large cached context.
A five-minute verification checklist
1. Create a dedicated key with a low spend cap. 2. Call /v1/models. 3. Send one JSON request. 4. Send one short SSE request. 5. Confirm terminal usage, request ID and ledger charge. 6. Only then connect Codex, an SDK or an IDE.
Keep prompts, source code, responses and Authorization headers out of screenshots, analytics and support tickets. If a key is exposed, revoke it and create a replacement before continuing the test.