OpenAI Compatibility

Point your existing OpenAI client at SingularityAPI

The contract

/v1/chat/completions and /v1/responses speak the same request and response wire format as the OpenAI API. If your code already uses the official openai SDK, it keeps working — change the base_url and the API key, nothing else.

1client = OpenAI(
2 base_url="https://api.singularityapi.dev/v1",
3 api_key="YOUR_API_KEY",
4)

What differs from OpenAI

  • Unsupported parameters fail loudly. Unknown or reserved fields are rejected with a 400 invalid_request error, never silently dropped. What you send is exactly what runs.
  • The output-limit field is per-model. DeepSeek and Kimi models accept max_tokens. gpt-5.6 models accept max_completion_tokens on chat completions and max_output_tokens on responses. Sending the wrong field for the model is a 400. Omit the field and the per-model default applies — see the table on Models & Pricing.
  • model must be a catalog slug or contract/{slug}. See Contracts for how contract slugs resolve to a served model.
  • Duplicate JSON keys and NaN/Infinity literals are rejected with a 400.
  • Context overflow is rejected before any tokens are spent. If your estimated input plus the requested output limit exceeds the model’s context window, the request fails with a 400.
  • Three extra response headers appear on every response: x-singularity-request-id, x-singularity-receipt-id, and — on contract calls — x-singularity-contract-revision.

Everything else in the OpenAI request schema passes through unmodified to the model.