OpenAI-compatible chat completions (drop-in)
Use when: caller is migrating an existing OpenAI SDK integration to Layer with zero code changes — only the baseURL swaps to https://api.uselayer.ai/v1/ and model becomes a Layer gate id
Drop-in replacement for POST https://api.openai.com/v1/chat/completions. Accepts the upstream OpenAI request body verbatim and returns the upstream OpenAI response body verbatim — including streaming SSE chunks when stream: true. Route the request through a Layer gate by passing model as a Layer gate id or name. Existing OpenAI SDK clients work unmodified by changing only the baseURL to https://api.uselayer.ai/v1/. Errors are returned in the OpenAI nested shape ({ error: { message, type, code, param? } }) so the OpenAI SDK’s error parser handles them transparently.
Documentation Index
Fetch the complete documentation index at: https://docs.verlon.ai/llms.txt
Use this file to discover all available pages before exploring further.
Authorizations
Layer API key (prefixed sk-). Generated from the dashboard under Settings → API Keys, or via layer key create in the CLI.
Response
OpenAI-format chat completion response. Shape matches the underlying provider format selected by the gate. For streaming requests, returns SSE chunks instead of a single JSON body.