Skip to main content
Six steps from a project key to a streamed reply that answers from your data. Run the steps in order, and every block runs as written once the two environment variables are set.
1

Get your project id and key

In the Moss portal, copy the project id, then open API Keys and create a key. Inference bills from credits with no included allowance, so add credits on the Billing page first (see Pricing). Export the id and key:
2

Install a client

curl needs no install until step 5, which creates the index with the Python or JavaScript SDK.
3

Get a response

The model is moss/fastlane-1 unless you name another. The reply is an OpenAI Response object, and the SDKs expose its text as output_text. On a new project nothing is grounded yet, so the answer is generic. Step 5 fixes that.
4

Stream it

Add stream: true and read response.output_text.delta events as they arrive.
Streaming lists every event and shows the Chat Completions form.
5

Ground it in your data

Create an index named faq with four documents, then name it in the call. Pick another name if faq is taken.
The reply should now mention delivery in 5 to 7 business days. With curl or an OpenAI client, send the header X-Moss-Indexes: faq instead of indexes. Without the header, Moss does not search. Ground answers in your indexes covers the options and the cost.
6

Pick a model

Name any model from the Models page in model. The search of your indexes works the same on all of them.

Next steps

Models

Prompt limits, prices and notes for every model.

Streaming

Every event, stopping early, errors mid-stream.

Tool calling

Function tools, the loop, structured output.

SDKs

Python, JavaScript, Swift, Android, Elixir, browser and C.

Pricing

Credits, tokens, caching and retrievals.

Errors and limits

Every status and code, limits, retries.

Ground answers in your indexes

Choose indexes, turn retrieval off, what it costs.