Getting Started
Introduction
The Gravix Layer Inference API provides programmatic access to open-source large language models (Llama, Qwen, Deepseek, Mistral, and more) for chat completions, vision, completions, and embeddings. All endpoints are compatible with OpenAI SDKs and libraries.
Welcome to the Gravix Layer AI Developer Platform docs! Gravix Layer AI makes it easy to run or fine-tune leading open source models with only a few lines of code. We offer a variety of generative AI services:
- Serverless Endpoints - Use our API or try serverless endpoints in playground.
- Dedicated endpoints - Deploy models dedicated to only you.
- Fine-Tuning - Fine-tune models on your own data in minutes, then run the model for inference.
- GPU Clusters - Deidicated GPU Clusters, H100, B200 etc.
Make Your First API Call
Get up and running with the Gravix Layer API in minutes. This section covers everything you need to know to make your first API call.
Authentication
All requests require an API key in the Authorization header.
Authorization: Bearer GRAVIXLAYER_API_KEY
You can generate and manage API keys in your Gravix Layer Console. Never share your API key publicly.
Base URL
Authorization: Bearer GRAVIXLAYER_API_KEY
Request Headers
Content-Type: "application/json"
Authorization: Bearer YOUR_API_KEY
Quickstart
Get started with our API in minutes.
- cURL
- Python
- Javascript
curl -X POST https://api.gravixlayer.com/v1/inference/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $GRAVIXLAYER_API_KEY" \
-d '{
"model": "llama3.1:8b-instruct-fp16",
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}'
import os
from openai import OpenAI
client = OpenAI(
api_key = os.environ.get("GRAVIXLAYER_API_KEY"),
base_url = "https://api.gravixlayer.com/v1/inference"
)
completion = client.chat.completions.create(
model="llama3.1:8b-instruct-fp16",
messages=[
{"role": "user", "content": "Hello!"}
]
)
print(completion.choices[0].message)
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: process.env.GRAVIXLAYER_API_KEY,
baseURL: "https://api.gravixlayer.com/v1/inference"
});
async function ChatCompletion() {
const completion = await openai.chat.completions.create({
messages: [{ role: "user", content: "Hello" }],
model: "llama3.1:8b-instruct-fp16",
});
console.log(completion.choices[0]);
}
ChatCompletion();