Quickstart
Create a key, set the base URL, send your first request — in curl, Python and Node.
Quickstart
1. Create an API key
Sign in to the Dashboard, open API Keys, and click "Create key". The full key is shown exactly once at creation time and always starts with sk-inf-.
At creation time you can also set:
- Monthly spend limit — once exceeded, requests return
spend_limit_reached. - Model allowlist — models outside the list return
model_not_allowed.
Store the key in an environment variable rather than hard-coding it:
export INFERENCE_API_KEY="sk-inf-xxxxxxxxxxxxxxxxxxxxxxxx"
2. Add credits
Inference is prepaid. Top up your credit balance under Billing in the Dashboard. When the balance runs out the API returns HTTP 402 insufficient_credit. See Pricing for details.
3. Send your first request
curl
curl https://api.alphacurve.io/v1/chat/completions \
-H "Authorization: Bearer $INFERENCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [
{ "role": "system", "content": "You are concise." },
{ "role": "user", "content": "Why use an API gateway?" }
],
"temperature": 0.7
}'
Python (openai SDK)
pip install openai
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.alphacurve.io/v1",
api_key=os.environ["INFERENCE_API_KEY"], # sk-inf-...
)
resp = client.chat.completions.create(
model="anthropic/claude-sonnet-4-5",
messages=[
{"role": "system", "content": "You are concise."},
{"role": "user", "content": "Why use an API gateway?"},
],
)
print(resp.choices[0].message.content)
print(resp.usage)
Node / TypeScript (openai SDK)
npm install openai
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.alphacurve.io/v1",
apiKey: process.env.INFERENCE_API_KEY, // sk-inf-...
});
const resp = await client.chat.completions.create({
model: "google/gemini-2.5-flash",
messages: [
{ role: "system", content: "You are concise." },
{ role: "user", content: "Why use an API gateway?" },
],
});
console.log(resp.choices[0].message.content);
4. Switch models
Changing provider means changing one string. Nothing else moves:
resp = client.chat.completions.create(
model="google/gemini-2.5-pro", # was openai/gpt-4o
messages=[{"role": "user", "content": "Hello"}],
)
To discover what is available to your key, call GET /v1/models:
curl https://api.alphacurve.io/v1/models \
-H "Authorization: Bearer $INFERENCE_API_KEY"
5. Turn on streaming
stream = client.chat.completions.create(
model="openai/gpt-4o-mini",
messages=[{"role": "user", "content": "Write a haiku about routing."}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="", flush=True)
See Streaming for the full story.