1. Create a scoped key
Create a Model.sale account, open Dashboard → API keys and generate a key. The complete secret is shown once, so save it in your secret manager immediately.
Use one key per application or environment. Set allowed models, RPM, TPM, concurrency and spend caps before adding the key to a coding agent; this makes rotation and incident response much easier.
2. Set the base URL
Use https://api.model.sale/v1 as the base URL. Keep the key in an environment variable such as OPENAI_API_KEY; never put it in a URL, browser bundle or source repository.
An OpenAI-compatible base URL changes where the client sends requests; it does not guarantee that every provider-specific feature is supported. Check the model page for its validated endpoint and streaming status.
3. Send a Responses request
Start with POST /v1/responses, a live model ID and a short input. Confirm HTTP status, the x-model-sale-request-id response header, terminal usage and the matching dashboard record before increasing output limits.
For streaming, consume events until the documented terminal event. A connection that closes before terminal usage should be treated as incomplete and retried only after checking whether the request was charged.
Chat Completions compatibility
Some clients still require POST /v1/chat/completions. Use it only when the selected model lists Chat Completions as a supported endpoint. Do not assume a model listed for Responses has identical tool, reasoning or event semantics on Chat Completions.
What billing looks like
Model.sale uses prepaid balance. A request is reserved before dispatch and settled from terminal token usage. Your dashboard shows charged tokens, status and the resulting ledger entry.
The initial reservation is not a fixed request fee. Unused reservation is released after settlement; cached, reasoning and output usage remain separate metadata when the protocol reports them.
Troubleshooting checklist
A 401 usually means the key or Authorization header is wrong. A 429 can be a key limit, wallet protection or temporary capacity response. For 5xx or a broken SSE stream, keep the request ID, avoid sending prompts or secrets to support and retry with a small idempotent test first.