Quickstart
1. Get an API key
Sign up at app.fabrence.com, add credits, and create a key on the API keys page. Store it in an environment variable:
export FABRENCE_API_KEY="your-key"
2. Send a request
cURL
curl https://api.fabrence.com/v1/chat/completions \
-H "Authorization: Bearer $FABRENCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "moonshotai/kimi-k3.1-pro",
"messages": [{"role": "user", "content": "Write a haiku about GPUs."}]
}'
Python
Install the OpenAI SDK with pip install openai, then point it at Fabrence:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.fabrence.com/v1",
api_key=os.environ["FABRENCE_API_KEY"],
)
response = client.chat.completions.create(
model="moonshotai/kimi-k3.1-pro",
messages=[{"role": "user", "content": "Write a haiku about GPUs."}],
)
print(response.choices[0].message.content)
TypeScript
Install the SDK with npm install openai:
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.fabrence.com/v1",
apiKey: process.env.FABRENCE_API_KEY,
});
const response = await client.chat.completions.create({
model: "moonshotai/kimi-k3.1-pro",
messages: [{ role: "user", content: "Write a haiku about GPUs." }],
});
console.log(response.choices[0].message.content);
3. Next steps
- Stream tokens as they are generated: Streaming.
- Let the model call your functions: Tool calling.
- Pay less for repeated prompt prefixes: Prompt caching.