SeleAI
SeleAI quickstart
SeleAI quickstart · MCP setup for Claude and Codex
One HTTPS API and one key in front of several hosted models. You never see or manage a model provider account.
Plans and spend
| Plan | SeleAI |
|---|---|
| Free | Not included |
| Starter | 1,000,000 small-model tokens and 100,000 medium-model tokens each month |
| Pro | 5,000,000 small, 500,000 medium and 50,000 large-model tokens each month |
- Tokens, not dollars. Your plan includes tokens (input plus output) for each model size: small, medium and large. Each model belongs to one size, listed by
GET /v1/ai/models. - Hard stop. Use can never pass the included tokens for a size or the lower limit you set. When it is reached the API answers
402 spend_cap_reached; nothing is charged beyond it. Extra use at a per-token price comes later, and only if you opt in. - Prices. Per model, per million input and output tokens, also listed by
GET /v1/ai/models. They are provisional while we measure real costs. - Retries are counted. Every attempt to the model provider is metered, and a failed attempt counts its input tokens. A request is tried at most twice.
- Catalog models only. Custom, fine-tuned or bring-your-own models are not supported.
Call the API
Request
curl https://ai.seleid.dev/v1/ai/chat \
-H "Authorization: Bearer $SELEAI_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"MODEL_ID","messages":[{"role":"user","content":"Say hello"}],"max_tokens":64}'
Response
{
"id": "…",
"model": "MODEL_ID",
"message": { "role": "assistant", "content": "Hello!" },
"usage": { "input_tokens": 12, "output_tokens": 3, "attempts": 1, "total_tokens": 15 }
}
Prices ending in micro_usd are millionths of a US dollar (1,000,000 = US$1) per million tokens.
JavaScript
const res = await fetch('https://ai.seleid.dev/v1/ai/chat', {
method: 'POST',
headers: { Authorization: 'Bearer ' + process.env.SELEAI_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({ model: 'MODEL_ID', messages: [{ role: 'user', content: 'Say hello' }], max_tokens: 64 }),
});
if (res.status === 402) console.error('AI token limit reached');
const { message, usage } = await res.json();
Endpoints
| Route | Purpose |
|---|---|
POST /v1/ai/chat | model, messages (1 to 50), max_tokens (1 to the model limit, default 256) |
GET /v1/ai/models | Models your plan can call, with prices |
GET /v1/ai/usage | Tokens used, limit and remaining for each model size, plus requests, attempts and tokens in and out |
Errors
| Status | error.code | Meaning |
|---|---|---|
| 401 | unauthenticated | Missing or revoked key |
| 402 | spend_cap_reached | Included tokens for that model size used up, or your own limit reached |
| 403 | plan_has_no_ai, model_not_in_plan | Plan does not include this |
| 400 | unknown_model, invalid_request, context_too_long | Fix the request |
| 502 | upstream_error | Model provider failed; attempts are metered |
Keep your key on your server. Never put it in a mobile app or web page.