OpenAI and Anthropic formats, one endpoint

Whichever SDK your code already speaks, Foglare answers it. Same base URL, same models, two wire formats.

Published by the Foglare team, a four minute read about wire-format compatibility.

The two doors

  • POST /v1/chat/completions
  • OpenAI chat completions format.
  • POST /v1/messages
  • Anthropic messages format.

Base URL

https://api.foglare.com/v1

Both respond with SSE streams.

Two doors, one gateway

Most inference code is written against one of two SDKs: OpenAI's or Anthropic's. Foglare accepts both shapes on the same base URL, so switching a project over is a change of base_url, not a rewrite. The gateway routes either format to the same provider pool and streams the answer back in the format you sent.

The model catalog is shared too: every routing tier and public model id works on both endpoints. You do not pick a format by model, or a model by format.

The OpenAI shape

POST /v1/chat/completions takes model, messages, and optionally stream, temperature, max_tokens, reasoning_effort, provider and previous_response_id.

A request is a model name and a list of messages, sent with your sk-fog- key as a bearer token; in a signed-in browser the session cookie rides along instead. Swap auto:fast for any tier or public model id from the models page. The docs have the call ready to copy.

The response is a stream of chat.completion.chunk objects. Append choices[0].delta.content from each data: line; the stream ends with data: [DONE].

The Anthropic shape

POST /v1/messages takes the same fields plus a required max_tokens and an optional system prompt. The tiers and model ids are identical.

The stream emits message_start, then content_block_delta events carrying text_delta, and ends with message_stop.

What both accept

Beyond the wire shape, the gateway behaves the same on both doors: routing tiers resolve per request, provider pins and previous_response_id affinity work identically, and a mid-stream upstream failure produces a terminal error event rather than a silent truncation. The mechanics are in How routing tiers work.

model
Any routing tier or public model id, on both endpoints.
provider
Optional per-request pin by codename; wins over a saved pin.
previous_response_id
Echo the last response id to stay on the same provider.
reasoning_effort
A level the model accepts — low, medium, high, xhigh, max or minimal; the exact set is reasoning_levels on each model in GET /api/models.
stream
Both endpoints answer with SSE; read the events as they arrive.
max_tokens
Optional on chat completions, required on messages.

Switching a client over

Point your SDK's base URL at https://api.foglare.com/v1 and pass your sk-fog- API key from the dashboard as the api_key argument. Browser requests can instead rely on the session cookie from sign-in. Inference requires one of the two — anonymous calls are rejected.

The docs have complete Python and JavaScript examples for both formats, including stream reading and error handling. The models page lists what you can send in the model field right now.

Read the docs