First API call
Make an API key and call a model from your own code.
TaraSpace serves models over an OpenAI-compatible API, so most OpenAI clients work by changing the base address and the key.
Make a key
Open Settings → API keys, name the key and create it. Copy it at once: it is not shown again. The page also shows
your base address, which ends in /v1.
export TARA_BASE_URL="https://<your TaraSpace address>/v1"
export TARA_API_KEY="<the key you copied>"Pick a model
curl "$TARA_BASE_URL/models" -H "Authorization: Bearer $TARA_API_KEY"Each model has an id, a kind (chat, embedding, rerank, image, speech or search) and its pricing.
Send a chat message
curl "$TARA_BASE_URL/chat/completions" \
-H "Authorization: Bearer $TARA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "<a chat model id>", "messages": [{"role": "user", "content": "Hello"}]}'The same call with the OpenAI SDK:
import OpenAI from "openai";
const client = new OpenAI({ baseURL: process.env.TARA_BASE_URL, apiKey: process.env.TARA_API_KEY });
const reply = await client.chat.completions.create({
model: "<a chat model id>",
messages: [{ role: "user", content: "Hello" }],
});Calls are paid from your credit. API keys spend added credit only; see Credit.
Next
- Models API: embeddings, rerank, images, speech and search.
- Apps API: run Orbit app actions from code.