Quickstart
This quickstart takes you from an invitation to your first embeddings response.
Before you begin
Section titled “Before you begin”You need a Fourier Platform account. Accounts are created by invitation, so if you don’t have one, ask your organization’s administrator or contact Fourier Health.
Create an API key
Section titled “Create an API key”-
Sign in to the Fourier Platform console.
The console sends you to the sign-in page and back. The sidebar then shows Overview, API keys, Usage, and Settings. If it shows No organization yet instead, ask your administrator to confirm that the email address you signed in with is in the Members list.
-
In the sidebar, click API keys, and then click Create key.
-
In the Name field, enter a name for the key.
-
For Expiration, select how long the key stays valid.
-
Click Create key.
-
Copy the key and store it in your secret manager or an environment variable, and then click Done.
The dialog shows the key once. The console never shows the secret again; the list shows only the key ID and the last four characters.
A key has the form fh_<key-id>_<secret> and is 48 characters long. For details about the key format, see Authentication.
Send a request
Section titled “Send a request”Set the FOURIER_API_KEY environment variable to the key you copied, and then send a request to POST /v1/embeddings on the gateway:
curl https://gateway.fourierhealth.com/v1/embeddings \ -H "Authorization: Bearer $FOURIER_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "ClinEmbed-1", "input": ["Patient reports intermittent chest pain on exertion."], "input_type": "document" }'import os
from openai import OpenAI
client = OpenAI( api_key=os.environ["FOURIER_API_KEY"], base_url="https://gateway.fourierhealth.com/v1",)
response = client.embeddings.create( model="ClinEmbed-1", input=["Patient reports intermittent chest pain on exertion."], extra_body={"input_type": "document"},)
print(len(response.data[0].embedding), response.usage.total_tokens)const response = await fetch("https://gateway.fourierhealth.com/v1/embeddings", { method: "POST", headers: { authorization: `Bearer ${process.env.FOURIER_API_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ model: "ClinEmbed-1", input: ["Patient reports intermittent chest pain on exertion."], input_type: "document", }),});
const result = await response.json();console.log(result.data[0].embedding.length, result.usage.total_tokens);The gateway serves the OpenAI embeddings API, so the openai Python client works when you point base_url at the gateway. input_type isn’t part of the OpenAI API, so pass it through extra_body. Use document for text you’re indexing and query for text you’re searching with.
The Content-Type header must contain json. Otherwise, the gateway doesn’t parse the body and returns status 400 with code invalid_body.
Read the response
Section titled “Read the response”The response looks like the following:
{ "object": "list", "data": [ { "object": "embedding", "index": 0, "embedding": [0.0132, -0.0417, 0.0089, ...] } ], "model": "ClinEmbed-1", "usage": { "prompt_tokens": 9, "total_tokens": 9 }}data has one entry per input string, in the same order. embedding is the vector as a list of floats, and usage.total_tokens is the number of tokens the model read.