OpenAI Compatibility

Chat completion (OpenAI-compatible)

Drop-in for OpenAI's chat completions. Set your OpenAI SDK's base_url to https://api.johnsessentials.com/v1 and the rest of your code is unchanged.

  • Auth: Authorization: Bearer je_live_sk_… (same header OpenAI uses).
  • Models: johns-agent (default — runs our orchestrator with the full tool catalogue). johns-fast/johns-smart are accepted aliases; today all values (including free-form ones) route through the same provider pool, so model is a forward-compatible hint rather than a hard selector.
  • Streaming: set stream: true → response is text/event-stream with OpenAI's data: {…}\n\n … data: [DONE]\n\n shape.
  • Tools: when tools=[…] is present, BYPASSES our orchestrator and calls the LLM provider directly with your tool definitions. ~40× cheaper per request.
  • Cost cap: if your key's monthly USD cap is reached, returns 402 in OpenAI's error envelope shape, NOT 429.

⚠ "Try it" caveat — streaming: Scalar's in-page request runner renders one-shot JSON responses cleanly but is not built for SSE. If you send stream: true from the Try it button you will see raw event-stream bytes accumulating rather than a parsed chunk-by-chunk view. For interactive streaming evaluation, use the OpenAI Python or TypeScript SDK with base_url swapped to ours — copy the snippet from this page's code-sample switcher.

post/v1/chat/completions

Request

  • Base URL: https://api.johnsessentials.com
  • URL: https://api.johnsessentials.com/v1/chat/completions
  • Auth: HTTP bearer

Request body

max_tokensinteger
modelstring required

johns-agent (default — runs our orchestrator with the full tool catalogue). johns-fast and johns-smart are accepted aliases reserved for low-latency / high-quality routes; today they and any other value (e.g. gpt-4o) route through the same health-ordered provider pool. Treat model as a forward-compatible hint — your code keeps working unchanged.

stopunknown
streamboolean
temperaturenumber
tool_choiceunknown
userstring

End-user identifier for abuse tracking.

Example request

{
  "model": "johns-agent"
}

Response

Completion result (non-stream) OR opening SSE chunk (stream).

createdinteger required

Unix seconds.

idstring required
modelstring required
object'chat.completion' | 'chat.completion.chunk' required
system_fingerprintstring

Example response

{
  "id": "chatcmpl-9k0F5..."
}

Changes

No recorded changes to this operation across all 1 revision of this API.