Quickstart
Make your first request in 60 seconds. Drop-in for the OpenAI, Anthropic, and Gemini SDKs: change one line and keep your existing code.
Get a key#
Sign in to the console and create an API key. Each key belongs to a workspace, so its usage and budget are that workspace's. You can revoke a key at any time. See API keys.
When you first sign in, you land in your personal space, which has a default workspace. Requests are paid from the wallet of the space the key belongs to, so add credits before your first call (Credits).
Swap base_url#
Where you create the OpenAI client, set base_url to https://api.lune.io/v1. The SDK version, request shape, and response shape stay the same.
from openai import OpenAI
client = OpenAI(
api_key=os.environ["OPENAI_API_KEY"],
- base_url="https://api.openai.com/v1",
+ base_url="https://api.lune.io/v1",
)The Anthropic and Gemini SDKs work the same way. Point each SDK at its base URL below. Each SDK's native auth header works (Authorization: Bearer, x-api-key, or x-goog-api-key), and all three take the same sk- key.
| SDK | base_url | Endpoint |
|---|---|---|
| OpenAI | https://api.lune.io/v1 | /chat/completions · /embeddings · /images/generations · /responses |
| Anthropic | https://api.lune.io/v1 | /messages |
| Gemini | https://api.lune.io/v1beta | /models/{model}:generateContent |
First request#
Set API_KEY in your environment and send a request. The response has the same shape as OpenAI's.
curl https://api.lune.io/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek/deepseek-v4-pro",
"messages": [
{"role": "user", "content": "Say hello in five words."}
]
}'from openai import OpenAI
import os
client = OpenAI(
api_key=os.environ["API_KEY"],
base_url="https://api.lune.io/v1",
)
resp = client.chat.completions.create(
model="deepseek/deepseek-v4-pro",
messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(resp.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.API_KEY,
baseURL: "https://api.lune.io/v1",
});
const resp = await client.chat.completions.create({
model: "deepseek/deepseek-v4-pro",
messages: [{ role: "user", content: "Say hello in five words." }],
});
console.log(resp.choices[0].message.content);package main
import (
"context"
"fmt"
"os"
"github.com/sashabaranov/go-openai"
)
func main() {
cfg := openai.DefaultConfig(os.Getenv("API_KEY"))
cfg.BaseURL = "https://api.lune.io/v1"
client := openai.NewClientWithConfig(cfg)
resp, err := client.CreateChatCompletion(
context.Background(),
openai.ChatCompletionRequest{
Model: "deepseek/deepseek-v4-pro",
Messages: []openai.ChatCompletionMessage{
{Role: "user", Content: "Say hello in five words."},
},
},
)
if err != nil {
panic(err)
}
fmt.Println(resp.Choices[0].Message.Content)
}Models use a vendor/slug id, for example deepseek/deepseek-v4-pro. Every id is listed on Models. For tags, see Endpoints & models.
Where to go next#
- Calling more than chat: Endpoints & models, Streaming.
- Something failed: Errors & rate limits.
- Control where requests go and what upstream providers may keep: Provider routing, Data policy.
- Working with a team: Organizations, Workspaces, Budgets.