Set the base URL and key
Point an OpenAI client at Moss
Change the base URL and the key. TheX-Moss-Indexes header is optional and names the indexes to search. Install OpenAI’s client with pip install openai or npm install openai. The Vercel AI SDK needs npm install @ai-sdk/openai ai.
.chat(). For the Moss SDKs, see SDKs.
Responses or Chat Completions
Both endpoints search the indexes a call names and take the same models, headers and limits.
The same call on Chat Completions:
Moss headers
Both endpoints read these request headers. The last column names the matching Moss SDK option.
The rules for
X-Moss-Indexes and X-Moss-Retrieve are in Ground answers in your indexes. Your own key is covered in Bring your own key.
Every reply carries these headers:
The
* is requests, and on moss/fastlane-1 also tokens. The limits themselves are in Errors and limits.
What is different from OpenAI
On Responses, Moss differs from OpenAI in these ways:- Moss stores no responses.
storeis ignored, andprevious_response_idandconversationare refused. Send the whole conversation ininputon every call. See Conversations. - Tools are
functionandmcponly. OpenAI’s built-in tools, such asweb_search,file_search,code_interpreter,image_generation, computer use and shell, are refused. So are custom tools, and atool_choicethat names one. - Content parts are
input_text,output_text, andinput_imagewith animage_url. Files (input_file), audio (input_audio) and images byfile_idare refused. Themoss/fastlane-1model reads text only. - Input items other than those listed, such as
item_reference, are refused. background: true, a non-emptyinclude,prompt, andtruncation: "auto"are refused.reasoningtakeseffortonly.text.verbositytakesmediumonly.- Any field missing from the Responses request table is refused, such as
max_tool_callsortop_logprobs.
400 with type invalid_request_error and code unsupported_parameter. The message names the field:
400 - Bad Request
- A reply without
streamhas one choice and nologprobs. - Chat Completions ends a stream with
data: [DONE]. Responses sends none. - The last chunk before
data: [DONE]has emptychoicesand the whole reply’susage. See Streaming.
temperature on an Anthropic model, with the same 400. The list per vendor is in Models.