API Documentation
sellapi exposes an OpenAI-compatible API for chat, embeddings, and image generation. Drop-in replacement: change baseURL, keep your code.
Authentication
Authenticate with a bearer token in the Authorization header:
Authorization: Bearer sk-sellapi-...
Create keys at /dashboard/keys. Keys are shown only once on creation.
Tiers
Every user starts on the Free tier with 10,000 credits ($0.10). Free-tier users can call cheap models only (marked FREE on the models page).
Buy any credit pack to auto-upgrade to Pro: unlimited model access, higher rate limits.
| Tier | Models | Rate limit |
|---|---|---|
| Free | Cheap models only | 20 req/min per key |
| Pro | All models | 600 req/min per key |
Chat completions
POST /v1/chat/completions
OpenAI-compatible. Supports streaming, system messages, multimodal input, and tool calling.
Basic call
curl https://sellapi.dev/v1/chat/completions \
-H "Authorization: Bearer sk-sellapi-..." \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4.6",
"messages": [{ "role": "user", "content": "Hello!" }]
}'Streaming
Set stream: true for SSE token streaming:
const stream = await client.chat.completions.create({
model: 'openai/gpt-5.4',
messages: [{ role: 'user', content: 'Write a haiku' }],
stream: true,
})
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? '')
}Function calling / Tools
Define tools in the OpenAI format. sellapi passes them through to the underlying model — works with all chat models that support function calling (Claude 4.x, GPT-5.x, Gemini 3.x, etc).
Step 1: First call with tools
const result = await client.chat.completions.create({
model: 'anthropic/claude-sonnet-4.6',
messages: [
{ role: 'user', content: "What's the weather in Berlin?" },
],
tools: [{
type: 'function',
function: {
name: 'get_weather',
description: 'Get current weather for a city',
parameters: {
type: 'object',
properties: {
city: { type: 'string', description: 'City name' },
},
required: ['city'],
},
},
}],
tool_choice: 'auto', // or 'required', 'none', or specific function
})
const toolCall = result.choices[0].message.tool_calls?.[0]
// { id, function: { name: 'get_weather', arguments: '{"city":"Berlin"}' } }Step 2: Execute the tool and return result
const args = JSON.parse(toolCall.function.arguments)
const weather = await getWeatherFromYourAPI(args.city)
const followUp = await client.chat.completions.create({
model: 'anthropic/claude-sonnet-4.6',
messages: [
{ role: 'user', content: "What's the weather in Berlin?" },
result.choices[0].message, // assistant's tool_call
{
role: 'tool',
tool_call_id: toolCall.id,
content: JSON.stringify(weather),
},
],
})
console.log(followUp.choices[0].message.content)Each round-trip is a separate billed request. The credits charged appear in the x-sellapi-credits-charged response header.
Embeddings
POST /v1/embeddings
const res = await client.embeddings.create({
model: 'openai/text-embedding-3-small',
input: ['Hello world', 'Another text'],
})
console.log(res.data[0].embedding) // [0.123, -0.456, ...]Accepts string or string[]. Returns 1 embedding per input.
Image generation
POST /v1/images/generations
curl https://sellapi.dev/v1/images/generations \
-H "Authorization: Bearer sk-sellapi-..." \
-H "Content-Type: application/json" \
-d '{
"model": "google/imagen-4.0-generate-001",
"prompt": "A sunset over the ocean",
"n": 1
}'Returns { data: [{ b64_json: '...' }] }. Decode base64 to PNG/JPEG bytes.
Listing models
GET /v1/models
Returns all available models with pricing and tier eligibility. Use this to dynamically populate model dropdowns in your app.
Response headers
Every successful response includes:
x-sellapi-credits-charged— credits deducted for this requestx-sellapi-credits-balance— your remaining balancex-ratelimit-limit,x-ratelimit-remaining— rate limit info
Error codes
| Status | Type | Meaning |
|---|---|---|
| 401 | invalid_api_key | Missing or invalid API key |
| 402 | insufficient_credits | Not enough credits — top up |
| 403 | tier_restricted | Model requires Pro tier |
| 404 | model_not_found | Unknown model slug |
| 429 | rate_limit_exceeded | Slow down; see Retry-After |
| 502 | upstream_error | Upstream provider failure |