Quickstart
Copy-paste working code. Set a key, pick a base URL, and send a request — in curl, Python, or JavaScript.
Set your key#
shell
export RIVEN_API_KEY="rvn_..."
export RIVEN_BASE_URL="https://api.rivenai.io/v1"Need a key? Getting started walks through it, or mint one programmatically per Authentication & keys.
Chat completion#
curl
curl https://api.rivenai.io/v1/chat/completions \
-H "Authorization: Bearer $RIVEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "riven-best", "messages": [{"role": "user", "content": "Hello"}]}'python
from openai import OpenAI
client = OpenAI(base_url="https://api.rivenai.io/v1", api_key=os.environ["RIVEN_API_KEY"])
resp = client.chat.completions.create(
model="riven-best",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)javascript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.rivenai.io/v1",
apiKey: process.env.RIVEN_API_KEY,
});
const resp = await client.chat.completions.create({
model: "riven-best",
messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);Streaming#
python
stream = client.chat.completions.create(
model="riven-core",
messages=[{"role": "user", "content": "Count to five."}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta.content
if delta:
print(delta, end="", flush=True)Embeddings#
curl
curl https://api.rivenai.io/v1/embeddings \
-H "Authorization: Bearer $RIVEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "riven-embed", "input": ["first text", "second text"]}'Vectors are 768-dimensional. input accepts a string or an array of strings.
Check your quota#
curl
curl https://api.rivenai.io/billing/quota -H "Authorization: Bearer $RIVEN_API_KEY"Every response carries an x-riven-upstream header naming the pool that served it. An onprem- prefix means the request never left Riven infrastructure — see the on-prem fleet.