Chat Completions
POST /v1/chat/completions, the OpenAI wire format across every text and code model, with streaming and exact usage.
Endpoint
Standard OpenAI request and response shapes, messages in, choices out. Existing OpenAI SDK code works unchanged after swapping the base URL and key.
POST https://api.companyfabric.com/v1/chat/completionsStreaming
Set stream: true for server-sent events. Delta chunks arrive in the OpenAI format; the final chunk before [DONE] carries the usage object including cost_usd, read it to reconcile spend without a second request.
const completion = await client.chat.completions.create({
model: "anthropic/claude-sonnet-4-5",
messages: [{ role: "user", content: "Stream me." }],
stream: true,
})
for await (const chunk of completion) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "")
if (chunk.usage) console.error("cost:", chunk.usage.cost_usd)
}Request tracing
Every response carries an x-fabric-request-id header. Include it when reporting an issue, it links your request to the exact ledger row and upstream trace.