BaseURL docs

BaseURL is an OpenAI-compatible API for open-source AI models. One API key reaches every model, and you pay in naira through Paystack. If your code already uses an OpenAI SDK, you change two things: the base URL and the key.

Base URLhttps://api.baseurl.dev/v1
AuthenticationAuthorization: Bearer YOUR_BASEURL_KEY
EndpointsPOST /v1/chat/completions, GET /v1/models
BillingPrepaid balance, topped up in naira; usage priced in USD per million tokens

Quickstart

  1. Create an account at app.baseurl.dev. New accounts are reviewed, usually within 5 minutes, and get a welcome credit when approved.
  2. Create an API key on the API keys page. The full key is shown once: store it somewhere safe, such as an environment variable.
  3. Make your first request. Install the SDK with pip install openai or npm install openai; the openai library works with any compatible API.

Python

from openai import OpenAI

client = OpenAI(
    base_url="https://api.baseurl.dev/v1",
    api_key="YOUR_BASEURL_KEY",
)

reply = client.chat.completions.create(
    model="gateway-fast",
    messages=[{"role": "user", "content": "Explain recursion in one sentence."}],
    max_tokens=200,
)
print(reply.choices[0].message.content)

Node.js

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.baseurl.dev/v1",
  apiKey: process.env.BASEURL_KEY,
});

const reply = await client.chat.completions.create({
  model: "gateway-fast",
  messages: [{ role: "user", content: "Explain recursion in one sentence." }],
  max_tokens: 200,
});
console.log(reply.choices[0].message.content);

cURL

curl https://api.baseurl.dev/v1/chat/completions \
  -H "Authorization: Bearer $BASEURL_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gateway-fast",
    "messages": [{"role": "user", "content": "Explain recursion in one sentence."}],
    "max_tokens": 200
  }'

Want to try a model before writing code? Use the Playground in your dashboard.

Next

Questions? Email [email protected] with your X-Request-Id.