SalpX API Reference
SalpX is fully OpenAI-compatible — point your base_url at SalpX and one key unlocks 50+ models across chat, images, and video. This page consolidates every AI model endpoint and management endpoint; everything is hosted on SalpX itself, with no third-party redirects.
01Quick start
① Create an API key in the console; ② set the base URL to https://www.salpx.com/v1; ③ fire a request:
curl https://www.salpx.com/v1/chat/completions \ -H "Authorization: Bearer $SALPX_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.6-sol", "messages": [{"role": "user", "content": "Hello, introduce yourself"}] }'
OpenAI SDK compatible: just set base_url to https://www.salpx.com/v1 — the rest of your code stays the same.
02Authentication
Every request carries the API key in an HTTP header:
Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxx
- Create, view, and disable keys under Console → Token management.
- Keys support quota caps, expiry dates, and allowed groups.
- Keep your keys safe — never ship them in front-end code or public repos.
03Base URL & compatibility
| Capability | Method / path | Compatible with |
|---|---|---|
| Chat / text | POST /v1/chat/completions | OpenAI Chat |
| Image generation | POST /v1/images/generations | OpenAI Images |
| Video generation | POST /v1/videos | Async task |
| Model list | GET /v1/models | OpenAI Models |
Only models that are priced and enabled appear in /v1/models and the model square; calls to disabled models are rejected (see error codes).
04AI model endpoints
A unified model-call layer in OpenAI format, covering chat, completions, embeddings, images, video, and realtime audio. 11 endpoint families:
/suno/submit/{MUSIC,LYRICS} and /suno/fetch paths — outside the /v1 namespace. See Section 07 · Music (Suno).05Chat / image / video examples
Chat
{
"model": "claude-opus-4-8",
"messages": [{"role":"user","content":"Write quicksort in Python"}],
"stream": false
}gemini-4-argon and gemini-3.8-flash: use the POST /v1/chat/completions endpoint above (OpenAI chat format, supports stream), billed per token — gemini-4-argon: ¥1 / 1M input tokens, ¥5 / 1M output tokens; gemini-3.8-flash: ¥0.75 / 1M input, ¥3.75 / 1M output. gemini-3.8-flash thinks before answering and the thinking counts as output tokens — a tiny max_tokens (e.g. a few dozen) can leave room for thinking only and an empty reply, so leave it unset or generous.Images
curl https://www.salpx.com/v1/images/generations -H "Authorization: Bearer $KEY" \ -d '{"model":"XY-nano-banana-pro-2k","prompt":"A luminous jellyfish drifting through a neon city, cinematic","n":1}'
Video
curl https://www.salpx.com/v1/videos -H "Authorization: Bearer $KEY" \ -d '{"model":"seedance-2","duration":10,"resolution":"720p","prompt":"A swarm of jellyfish slowly rising from the seabed, soft light"}'
seedance-2 (480p / 720p / 1080p / 4K), seedance-2-fast, seedance-2-mini (480p / 720p). Supports text-to-video, first-frame, first-and-last-frame, and all-round references (image / video / audio); billed by actual tokens, video references bill at the with-video rate, 4–15 seconds. For the rest of the Seedance / Wan / image lineups see Section 06 · Video / Images.Model ID
seedance-2-fast-特价版 (seedance-2-mini-特价版 is offline for maintenance since Nov 13): 4 s or any whole-second duration from 6–14 s (5 s and 15 s discontinued), billed per second at ¥0.13/s, aspect_ratio sets the frame (since 2026-11-11 duration and aspect are unrestricted, seconds required). Same POST /v1/videos endpoint.Seedance 2.5 · per-second billing · multimodal (native async)
Volcano's official Seedance 2.5, called via the native async endpoint POST /v1/video/generations, billed per second. Supports text-to-video, image-to-video (first frame / first+last frame), and multimodal reference generation (≤30 reference images, ≤10 reference videos, ≤10 reference audios), single continuous takes up to 30 seconds, audio on by default (can be disabled). Resolution is locked to 720p and frame rate to 24fps.
Prices updated 2026-08-10 (CNY, per second); the model square always has the live price.
| Model | Condition | Price |
|---|---|---|
seedance-2-5 | Without reference video (text / image to video) | ¥2/s |
| With reference video (multimodal reference) | ¥7/s |
curl https://www.salpx.com/v1/video/generations -H "Authorization: Bearer $KEY" \ -d '{"model":"seedance-2-5","prompt":"A swarm of jellyfish slowly rising from the seabed, soft light, vertical","duration":5}'
curl https://www.salpx.com/v1/video/generations -H "Authorization: Bearer $KEY" \ -d '{ "model": "seedance-2-5", "prompt": "Follow the subject of @image1 and the camera motion of @video1 to make an ad", "duration": 10, "metadata": { "generate_audio": true, "content": [ {"type":"image_url","image_url":{"url":"https://reference-image.png"},"role":"reference_image"}, {"type":"video_url","video_url":{"url":"https://reference-video.mp4"},"role":"reference_video"} ] } }'
Required: model / prompt / duration (whole seconds, max 30). Optional: images (top-level array: one image = first frame for image-to-video; two images = first/last frame), metadata.generate_audio (default true; false for silent output), metadata.content (multimodal references, each with a role: reference_image / reference_video / reference_audio; limits ≤30 images / ≤10 videos / ≤10 audios). Resolution is locked to 720p, frame rate to 24fps — no need to send them (they are ignored if you do). Billing: any request containing a reference video bills at ¥7/s, otherwise ¥2/s; charge = unit price × duration.
task_id; poll GET /v1/video/generations/{task_id} until status=succeeded, then grab the video URL. Set client / HTTP timeouts to ≥ 600 seconds. Failed generations or moderation rejections are treated as failures and fully refunded automatically — no charge.06Video / Images
This section rounds up the Seedance, Wan 3.0, and MiniMax H3 video families plus the GPT Image / XY / LK banana image families on SalpX. Video uses the /v1/videos or /v1/video/generations async tasks; images use /v1/images/generations. Each route has its pricing table below and a dedicated guide.
How to call
- Endpoints split by route: video via POST /v1/videos or /v1/video/generations (async: create task → poll → fetch); images via POST /v1/images/generations. Put the model ID from the corresponding guide in
model. - Video duration goes in
seconds/durationas whole seconds (supported ranges per route below); images usesizeor the resolution tier embedded in the model name. - Any video / image task that fails, times out, or returns no result is treated as failed and auto-refunded.
(4–30 s) billed per second: without reference video
seedance-2.5-720p-hmt ¥0.88 / s (incl. first-frame / first+last-frame), with reference video seedance-2.5-ref-720p-hmt ¥0.98 / s — reference images / reference audio / generated audio cost nothing extra.Seedance 2.5 flash (same guide):
seedance-2.5-flash-720p-hmt ¥0.79 / s, seedance-2.5-flash-480p-hmt ¥0.36 / s, with reference video seedance-2.5-flash-ref-720p-hmt ¥0.97 / s.Section 08 of the same guide: Seedance 2.0 / fast / mini 720p / 1080p per-second — without references e.g.
seedance-2.0-mini-720p-hmt, with references e.g. seedance-2.0-mini-ref-720p-hmt (12 in total), 4–15 s, ¥0.37–¥1.61 / s, same price with or without references.(15–30 s) billed per second: 480p
seedance-2.5-480p-yy ¥0.45 / s, 720p seedance-2.5-720p-yy ¥0.63 / s. Supports text-to-video, reference images, and reference audio (no surcharge); reference video is not supported.Billed per second; the model name sets the edition and resolution: standard
seedance-2.0-480p / 720p / 1080p / 4k, Fast seedance-2.0-fast-480p / 720p, Mini seedance-2.0-mini-480p / 720p. Pick the kd / hm line with line (standard 720P ¥0.6930 / ¥0.7920 per second, Mini 480P from ¥0.0805 per second); failed jobs switch lines automatically by default (turn off with auto_switch: false) and are billed at the line actually used. 4–15 seconds, text-to-video, first frame, first-last frame, reference image / video / audio, videos with sound.Billed per second; the model name sets the resolution:
wan3.0-480p, wan3.0-720p, wan3.0-1080p. Use line to pick a route: kd / hm / rh / rhp (high-speed) — at 720p respectively ¥0.36 / ¥0.56 / ¥0.63 / ¥1.29 per second. On failure it auto-switches routes (disable with auto_switch: false) and bills by the route actually used. 2–30 s; text-to-video, first/last frame, reference image / video / audio, document / webpage-to-video; audio on by default.Images · XY series (per call · OpenAI image endpoint)
Base models GPT Image 2, GPT Image 2.5 Flare / Sunburst, GPT Image 2.6 Flare / Sunburst and Nano Banana Pro, for 14 SKUs in total in the XY series; the GPT Image 2.5 / 2.6 4K SKUs always render at the highest quality at ¥0.30 per call. Another set of 5 base models + 4 4K SKUs is driven by size (see “GPT Image 2.5 / 2.6 and the 4K tiers” below). All use the standard OpenAI image endpoint POST /v1/images/generations; for image-to-image, pass an images array to the same endpoint, or upload files directly via POST /v1/images/edits as multipart.
Prices updated 2026-11-24 (CNY).
| Model | Base model | Resolution | Price |
|---|---|---|---|
XY-gpt-image-2-1k | GPT Image 2 | 1K | ¥0.14/call |
XY-gpt-image-2-2k | GPT Image 2 | 2K | ¥0.30/call |
XY-gpt-image-2-4k | GPT Image 2 | 4K | ¥0.31/call |
XY-gpt-image-2.5-flare-1k | GPT Image 2.5 Flare | 1K | ¥0.23/call |
XY-gpt-image-2.5-flare-2k | GPT Image 2.5 Flare | 2K | ¥0.28/call |
XY-gpt-image-2.5-flare-4k | GPT Image 2.5 Flare | 4K · max quality | ¥0.30/call |
XY-gpt-image-2.5-sunburst-4k | GPT Image 2.5 Sunburst | 4K · max quality | ¥0.30/call |
XY-gpt-image-2.6-flare-4k | GPT Image 2.6 Flare | 4K · max quality | ¥0.30/call |
XY-gpt-image-2.6-sunburst-4k | GPT Image 2.6 Sunburst | 4K · max quality | ¥0.30/call |
XY-nano-banana-pro-2k | Nano Banana Pro | 2K | ¥0.15/call |
XY-nano-banana-pro-4k | Nano Banana Pro | 4K | ¥0.19/call |
XY-nano-banana-pro-cl-2k | Nano Banana Pro CL · high-quality route | 2K | ¥0.36/call |
XY-nano-banana-pro-cl-4k | Nano Banana Pro CL · high-quality route | 4K | ¥0.46/call |
XY-nano-banana-2-lite-1k | Nano Banana 2 Lite · low latency | 1K | ¥0.12/call |
resolution / quality in the request body are ignored — the model name always wins; to change tiers, change the model name. The size-driven set above is the opposite: both size and quality take effect. Also: Nano Banana Pro has no 1K tier, only 2K / 4K.curl --max-time 300 https://www.salpx.com/v1/images/generations \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{ "model": "XY-nano-banana-pro-2k", "prompt": "Neon cyberpunk cityscape at night, wet streets reflecting the lights", "size": "16:9" }'
curl --max-time 300 https://www.salpx.com/v1/images/generations \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{ "model": "XY-gpt-image-2-2k", "prompt": "Keep the subject, replace the background with a dusk beach", "images": [ "https://your-cdn.com/ref.png", "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQ..." ], "size": "3:2" }'
GPT Image 2.5 / 2.6 and the 4K tiers (size-driven)
Since 2026-11-24 this set renders by size: the tier is encoded in the model name — no suffix means 2K (long edge 2048), a -4k suffix means 4K (long edge 3840). Same endpoint, returns data[0].b64_json.
| Model | Tier | Positioning | Price |
|---|---|---|---|
gpt-image-2.6-sunburst | 2K | Best generation & refinement | ¥0.12/call |
gpt-image-2.6-flare | 2K | Everyday / fast, high volume | ¥0.12/call |
gpt-image-2.6-sunburst-4k | 4K | Best generation & refinement | ¥0.30/call |
gpt-image-2.6-flare-4k | 4K | Everyday / fast, high volume | ¥0.30/call |
gpt-image-2.5-sunburst | 2K | Best generation & refinement | ¥0.08/call |
gpt-image-2.5-flare | 2K | Everyday / fast, high volume | ¥0.08/call |
gpt-image-2.5-sunburst-4k | 4K | Best generation & refinement | ¥0.25/call |
gpt-image-2.5-flare-4k | 4K | Everyday / fast, high volume | ¥0.25/call |
gpt-image-2 | Tier follows size | Previous-generation base model | ¥0.07/call |
Prices updated 2026-11-24 (CNY). The 1K tier is not sold separately yet; for smaller images pass 1k:ratio in size and you are billed at the model's normal rate.
How to write size (tier + aspect)
| Value | Tier | Output |
|---|---|---|
4k:16:9 | 4K | 3840×2160 |
4k:1:1 | 4K | 3840×3840 |
4k:9:16 | 4K | 2160×3840 |
2k:4:3 | 2K | 2048×1536 |
16:9 (ratio only) | 2K | 2048×1152 |
1k:16:9 | 1K | 1024×576 |
3840x2160 (exact pixels) | From the long edge | Honoured up to the model's tier (use a *-4k model for a true 3840) |
auto / omitted | No resampling | Base models return their native size (≈1.6MP, PNG); *-4k models render at their default 4K aspect |
Tiers are keyed on the long edge (1K=1024, 2K=2048, 4K=3840); the short edge follows the ratio and is rounded to an even number. Any N:M ratio works. If the requested ratio differs from the model's native one, the platform does a cover centre crop with no letterboxing — keep important elements near the centre.
4k:16:9 is clamped back to 2K (response header X-Imgratio-Clamped: 1) because it is billed as 2K; switch to a *-4k model for 4K. A *-4k model always renders at 4K regardless of the requested tier.| Parameter | Required | Notes |
|---|---|---|
model | Yes | A model from the table above; the -4k suffix sets the tier |
prompt | Yes | The prompt; Chinese or English both work |
size | No | Tier + aspect, syntax above. Always pass it explicitly; omitting it or passing auto returns the model's native size (≈1.6MP PNG) |
quality | No | low / medium / high (default) / max; affects only detail and file size, not resolution or price |
images | No | Reference images (image-to-image): a publicly downloadable https URL or data:image/...;base64,; up to 16 |
n | No | Must be 1 |
curl --max-time 300 https://www.salpx.com/v1/images/generations \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2.6-sunburst-4k", "prompt": "Old town street after rain, brick walls and wrought-iron windows, wet reflections", "size": "4k:16:9", "quality": "max" }'
curl --max-time 300 https://www.salpx.com/v1/images/generations \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2.6-flare", "prompt": "Keep the subject, replace the background with a beach at dusk", "images": ["https://your-cdn.com/ref.png"], "size": "2k:3:4" }'
You can also use POST /v1/images/edits to upload files as multipart (fields image[], prompt, model, size) at the same price; when size is omitted a *-4k model renders at its default 4K aspect, while base models return their native size. Failed generations are not billed.
With size the response reports output_format: "jpeg"; with auto / no size it is png. data[0].size holds the real pixels — worth checking before you store the file. A 4K image usually takes 15–60 s.
Response format
A success returns 200 with the image embedded as base64 in data[0].b64_json — not a URL: write it straight to disk, no link expiry to worry about.
{
"created": 1789045231,
"data": [{ "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..." }]
}① Set client timeouts to ≥ 300 s — a single image takes 20–120 s; default 30 / 60 s will always break.
② Budget response bodies for 10 MB — 2K / 4K originals run 2–5 MB and base64 adds another third; the default 1 MB will explode.
③ Reference-image URLs must be downloadable by any third party — pre-signed object-storage links or addresses requiring login / Referer cannot be fetched by us and fail before generation; if unsure, send base64.
Also:
n must be 1 — anything above 1 returns 400; failed generations are not billed.07Music (Suno)
SalpX offers AI song generation and lyric generation through its Suno channel. Music is an async task: submit to get a task_id, then poll /suno/fetch for results. The endpoints live outside the /v1 namespace, under their own /suno/* paths.
| Model | Capability | Submit endpoint | Output per call | Price (per call) |
|---|---|---|---|---|
suno_music | Song generation (vocals / instrumental) | POST /suno/submit/MUSIC | 2 songs | ¥0.09 |
suno_lyrics | Lyric generation | POST /suno/submit/LYRICS | 2 lyrics | ¥0.01 |
You do not send model: the action in the path (MUSIC / LYRICS) decides the model, routing, and billing. model is only used for display in the model square and usage stats. The model square has live prices; groups settle at their own ratios.
Submitting a music task
curl https://www.salpx.com/suno/submit/MUSIC \ -H "Authorization: Bearer $KEY" \ -H "Content-Type: application/json" \ -d '{ "gpt_description_prompt": "An upbeat summer folk song, acoustic guitar led, male vocal", "mv": "V6" }'
curl https://www.salpx.com/suno/submit/MUSIC \ -H "Authorization: Bearer $KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "[Verse]\nBefore the dawn breaks\nYou stand at the door\n[Chorus]\nThe neon is still on\nThe city slowly wakes", "tags": "chinese folk, acoustic guitar, warm male vocal", "title": "Corner Store at 3 AM", "mv": "V6" }'
| Field | Type | Notes |
|---|---|---|
gpt_description_prompt | string | Simple mode: describe the song you want in one line; the model writes lyrics and arranges. Pick this or prompt. |
prompt | string | Custom mode: your own lyrics, with structure markers like [Verse] / [Chorus]. |
tags | string | Style tags (comma-separated). Non-empty switches to custom mode. |
title | string | Song title. Non-empty switches to custom mode. |
make_instrumental | bool | true = instrumental (no vocals). |
mv | string | Version: V6 (default, best quality) / V6_MINI (faster) / V6_WILD (more adventurous). |
continue_clip_id / continue_at / task_id | string / number | Used when continuing an existing clip; omit for normal generation. |
A successful submit returns a task ID (not the song URL):
{"code":"success","message":"","data":"task_lP31nQboYikgfI8pjlJ5g07HZaDTtGWH"}Fetching results
Batch query: POST /suno/fetch with body {"ids":["task_xxx", ...]}; single query: GET /suno/fetch/{task_id}. Generation usually finishes in 20–60 seconds — poll every 5 s or so and set timeouts ≥ 300 s.
curl https://www.salpx.com/suno/fetch \ -H "Authorization: Bearer $KEY" \ -H "Content-Type: application/json" \ -d '{"ids":["task_lP31nQboYikgfI8pjlJ5g07HZaDTtGWH"]}'
{
"code": "success",
"data": [
{
"task_id": "task_lP31nQboYikgfI8pjlJ5g07HZaDTtGWH",
"action": "MUSIC",
"status": "SUCCESS",
"progress": "100%",
"fail_reason": "",
"submit_time": 1793878705,
"finish_time": 1793878726,
"quota": 45000,
"data": {
"clips": {
"61c7bd26-9d49-4295-9e39-504b96ce5b40": {
"id": "61c7bd26-9d49-4295-9e39-504b96ce5b40",
"title": "Midnight Piano",
"status": "complete",
"audio_url": "https://tempfile.aiquickdraw.com/r/61c7bd26-....mp3",
"stream_audio_url": "https://audiostream.kie.ai/stream/61c7bd26-....mp3",
"image_url": "https://cdn2.suno.ai/image_61c7bd26-....jpeg",
"text": "[Instrumental]",
"metadata": {
"tags": "Solo piano instrumental, slow and contemplative",
"duration": 128.4
}
},
"second-clip-id": { "…": "same structure as above" }
}
}
}
]
}Status: SUBMITTED → IN_PROGRESS (watch progress) → SUCCESS / FAILURE (fail_reason explains). data.clips is an object keyed by clip_id; one music task yields 2 songs, each with audio_url (direct MP3 link, downloadable or streamable), cover image_url, title, text (lyrics; [Instrumental] for instrumentals), and metadata.tags.
Submitting a lyrics task
curl https://www.salpx.com/suno/submit/LYRICS \ -H "Authorization: Bearer $KEY" \ -H "Content-Type: application/json" \ -d '{"prompt":"A Chinese song about an old lighthouse by the sea"}'
Lyrics tasks also return a task_id first, polled via /suno/fetch; when done, data.clips holds 2 lyric drafts — body in text, title in title (an empty audio_url is expected).
Billing
- Per-call billing:
suno_music¥0.09/call (yields 2 songs, no surcharge),suno_lyrics¥0.01/call (yields 2 drafts). - Pre-deducted on submit; failed tasks are fully auto-refunded; the fetch endpoint is free.
- Effective price = base price × the token's group ratio — groups differ; the model square is authoritative.
default, vip, 大额优惠, 内部使用, and 天津专用 groups; other groups get "no available channel". Not yet available: extend, cover, advanced stem split, MIDI, WAV export, music video, vocal removal, and other derivatives — they require audio upload, which the current endpoints do not accept.audio_url / image_url to your own object storage in time; links die after that and SalpX cannot re-issue them.08Apps & Skills
SalpX speaks the OpenAI API spec, so mainstream AI apps and clients can use it as their model backend directly. Most apps take three steps: enter the API base URL https://www.salpx.com/v1, enter your API key, pick a model name.
Apps that plug in directly (examples)
Any client that supports a "custom OpenAI endpoint" works: point the service URL at SalpX and use a SalpX key.
Codex setup (CLI, recommended)
Wiring OpenAI Codex to SalpX takes two files, both under ~/.codex/ (Windows: C:\Users\<username>\.codex\). Easiest: copy the one-line setup command for your system from "Console → Token management" — it fills in everything below; manual setup follows.
npm install -g @openai/codex.① ~/.codex/config.toml
model_provider = "salpx" model = "gpt-5.6-luna" model_reasoning_effort = "high" preferred_auth_method = "apikey" approval_policy = "never" sandbox_mode = "danger-full-access" [model_providers.salpx] name = "SalpX" base_url = "https://www.salpx.com/v1" wire_api = "responses" requires_openai_auth = true
Top-level keys (model_provider etc.) must come before every [ ] table, or they get absorbed into the following table and go unread; wire_api must be "responses" (chat is no longer supported); sandbox_mode bypasses the sandbox-init error.
② ~/.codex/auth.json
{ "OPENAI_API_KEY": "sk-your-salpx-token" }③ Apply & verify: fully quit and reopen the terminal / Codex (not just minimize) so the config reloads. Run codex, ask anything, and a normal reply means success; or verify connectivity with curl first:
curl -s https://www.salpx.com/v1/chat/completions \ -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"gpt-5.6-luna","messages":[{"role":"user","content":"Reply OK"}],"max_tokens":10}'
Available models: change model to whatever you need, e.g. gpt-5.6-sol (strongest); the full list lives in /v1/models and the model square. Common issues: 401 — check the key is correct and not disabled; no model permission — switch to a model present in /v1/models; no effect — confirm the path, a full restart, and model_provider at the top of the file; Windows — files must be UTF-8 without BOM (use VS Code, not Notepad), and if npm blocks scripts run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned.
Claude Code setup
Install with npm install -g @anthropic-ai/claude-code, set three environment variables, then open a new terminal and run claude: ANTHROPIC_BASE_URL=https://www.salpx.com (no /v1 — the client appends /v1/messages itself; adding it yields /v1/v1 and a 404), ANTHROPIC_AUTH_TOKEN=your-token, ANTHROPIC_MODEL=claude-…. Or just use the one-line command from Token management.
Skills (managed inside AI editors)
SalpX builds on New API and supports its Skills capability: inside AI coding agents like Claude Code, Codex, and OpenClaw you can list models, manage tokens, and check groups and balances without opening the admin console.
09Management endpoints
For platform configuration, users, channels, models, tokens, redemption codes, payments, and logs (mostly the site's own admin backend). 17 endpoint families:
10Models & billing
- Pay-as-you-go: text models bill per token (input + output).
- Per-call: images, video, etc. bill a fixed price per call (video by fixed duration, e.g. 10s / 15s).
- Each group maps to different channels/prices; see the model square for available models and live prices.
11Error codes
| HTTP | code | Meaning | What to do |
|---|---|---|---|
| 400 | invalid_request | Bad request parameters (e.g. image-to-image missing image_url, unsupported fields) | Fix the request per the returned message |
| 401 | invalid_api_key / APIKEY_USER_NOT_FOUND | Key invalid, disabled, or upstream relay key mismatch | Check the key in the console; if calling via your own relay, check its base_url / auth header |
| 403 | insufficient_quota | Token quota exhausted or token capped | Top up in the console or raise the token quota |
| 404 | model_not_found / model_price_error | Model missing, unavailable in your group, or unpriced | Check the model name / token group; model_price_error is caught before billing — no charge |
| 429 | rate_limit_exceeded | Concurrency or rate limit hit | Lower concurrency or retry with exponential backoff |
| 500 | do_request_failed | Upstream connection failure (DNS / TLS / refused); SalpX retries internally | Failures are auto-refunded; switch models or retry later |
| 502 | upstream_error / no_result | Upstream error / async generation finished without a URL | Failures are auto-refunded; retry or switch models |
| 504 | gateway_timeout | Async task exceeded the max wait (video cap ~20 minutes) | Failures are auto-refunded; retry off-peak |
model_price_error is caught before billing, so it never charges either.12Rate limits & groups
- Tokens bind to a group, which decides available models and pricing; the
autogroup picks the best option by priority. - Concurrency and rate limits are visible in the console; hitting a limit returns
rate_limit_exceeded. - Reuse one key per capability and handle retries and timeouts server-side.
13SDK examples & batch calls
SalpX is fully OpenAI-SDK compatible — point base_url at https://www.salpx.com/v1, put a SalpX token in api_key, and every model family is callable (chat, images, video; video uses the async task endpoints, see Section 06).
Python (official openai SDK)
from openai import OpenAI client = OpenAI( api_key="sk-…", base_url="https://www.salpx.com/v1", ) resp = client.chat.completions.create( model="gpt-5.6-sol", messages=[{"role": "user", "content": "Write quicksort in Python"}], timeout=120, ) print(resp.choices[0].message.content)
Images / video work the same way: swap client.chat.completions for client.images.generate (images, see the XY series in Section 06) or create + poll tasks on /v1/videos (video, see Section 05); base_url and the token stay unchanged.
Node.js (openai SDK)
import OpenAI from "openai"; const client = new OpenAI({ apiKey: "sk-…", baseURL: "https://www.salpx.com/v1", timeout: 120000, }); const resp = await client.chat.completions.create({ model: "gpt-5.6-sol", messages: [{ role: "user", content: "Write quicksort in Python" }], } as any); console.log(resp.choices[0].message.content);
Go (raw net/http)
package main import ( "bytes"; "fmt"; "io"; "net/http"; "time" ) func main() { body := []byte(`{"model":"gpt-5.6-sol","messages":[{"role":"user","content":"Write quicksort in Python"}]}`) req, _ := http.NewRequest("POST", "https://www.salpx.com/v1/chat/completions", bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer sk-…") req.Header.Set("Content-Type", "application/json") cli := &http.Client{Timeout: 120 * time.Second} resp, _ := cli.Do(req) defer resp.Body.Close() data, _ := io.ReadAll(resp.Body) fmt.Println(string(data)) }
Batch calling
Video tasks often take tens of seconds to minutes — serial calls crush your throughput. Go concurrent (per-token concurrency cap 5–10; contact SalpX to raise it):
import asyncio from openai import AsyncOpenAI client = AsyncOpenAI( api_key="sk-…", base_url="https://www.salpx.com/v1", timeout=120, ) async def gen(prompt): r = await client.chat.completions.create( model="gpt-5.6-sol", messages=[{"role": "user", "content": prompt}], ) return r.choices[0].message.content async def main(): prompts = ["Write quicksort in Python", "Explain the TCP three-way handshake", "Write a regex that matches emails"] results = await asyncio.gather( *[gen(p) for p in prompts], return_exceptions=True, # one failure doesn't sink the batch ) for r in results: print(r) asyncio.run(main())
Implementation notes
- Failure handling: upstream errors (5xx) are auto-refunded by SalpX. Your client only needs to catch exceptions — no "billed but no result" compensation logic required.
- Timeouts: client
timeout ≥ 120s(images) or≥ 600s(video); SalpX polls upstream for up to 20 minutes, then returns 504 with a refund. - Concurrency cap: ≤ 10 concurrent per token by default; exceeding it returns
429 rate_limit_exceeded— back off or request a raise. - Reconciliation: the response
usagecarries the task ID for your billing reconciliation. - Extracting results: images — take
data[0].b64_json(ordata[0].url) straight from/v1/images/generations; video — poll/v1/videos/<id>, take the video URL from the final response, then download the bytes via/v1/videos/<id>/content.
14CLI tools
Rule of thumb: HTTP / SDK / most clients use https://www.salpx.com/v1; Claude Code, Gemini CLI, and Codex CLI use the root https://www.salpx.com (no /v1). Restart the terminal / process after changing config.
Claude Code
Point the environment variables at the root (no /v1), then restart the terminal.
export ANTHROPIC_BASE_URL="https://www.salpx.com" export ANTHROPIC_AUTH_TOKEN="YOUR_KEY" export ANTHROPIC_MODEL="claude-opus-4-8" export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
Apps launched from the macOS Dock do not inherit shell variables — put the three lines above into the env field of ~/.claude/settings.json.
Gemini CLI
Point Gemini CLI at the root address.
export GOOGLE_GEMINI_BASE_URL="https://www.salpx.com" export GEMINI_API_KEY="YOUR_KEY" export GEMINI_MODEL="gemini-3.5-flash"
Codex CLI
Define a custom provider in ~/.codex/config.toml and put the key in ~/.codex/auth.json.
model_provider = "salpx" model = "gpt-5.6-luna" disable_response_storage = true network_access = "enabled" [model_providers.salpx] name = "SalpX" base_url = "https://www.salpx.com" wire_api = "responses" requires_openai_auth = true
{ "OPENAI_API_KEY": "YOUR_KEY" }Codex one-line install
One script installs the Codex CLI and wires it to SalpX — works for both the ChatGPT Codex desktop app and the CLI.
testkey in the script with your own SalpX key (from the console) before running.#!/usr/bin/env bash
set -euo pipefail
# ⚠️ Replace testkey with your own SalpX key
SALPX_KEY='testkey'
CODEX_DIR="$HOME/.codex"
mkdir -p "$CODEX_DIR"
if command -v npm >/dev/null 2>&1; then
npm install -g @openai/codex || echo "Codex CLI install failed; run manually: npm install -g @openai/codex"
else
echo "npm not found. The CLI needs Node.js LTS first (nodejs.org); ignore if you only use the desktop app."
fi
[ -f "$CODEX_DIR/config.toml" ] && cp "$CODEX_DIR/config.toml" "$CODEX_DIR/config.toml.bak.$(date +%Y%m%d%H%M%S)"
[ -f "$CODEX_DIR/auth.json" ] && cp "$CODEX_DIR/auth.json" "$CODEX_DIR/auth.json.bak.$(date +%Y%m%d%H%M%S)"
cat > "$CODEX_DIR/config.toml" <<'EOF'
model_provider = "salpx"
model = "gpt-5.6-luna"
model_reasoning_effort = "high"
preferred_auth_method = "apikey"
[model_providers.salpx]
name = "SalpX"
base_url = "https://www.salpx.com/v1"
wire_api = "responses"
EOF
chmod 600 "$CODEX_DIR/config.toml"
printf '{\n "auth_mode": "apikey",\n "OPENAI_API_KEY": "%s"\n}\n' "$SALPX_KEY" > "$CODEX_DIR/auth.json"
chmod 600 "$CODEX_DIR/auth.json"
echo "SalpX Codex config done ($CODEX_DIR). Fully quit and restart Codex / the terminal."
[ "$SALPX_KEY" = "testkey" ] && echo "Warning: still the placeholder testkey — edit ~/.codex/auth.json with your own key."Save as install-codex.sh and run bash install-codex.sh, or paste it straight into a terminal.
15Desktop & clients
CC-Switch
A Claude Code endpoint switcher. Map each provider group to its client and URL as below:
OpenAI → Codex → https://www.salpx.com Anthropic/Claude → Claude Code → https://www.salpx.com Gemini → Gemini CLI → https://www.salpx.com
OpenCode
Add a custom provider in opencode.json.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"openai": {
"options": {
"baseURL": "https://www.salpx.com/v1",
"apiKey": "YOUR_KEY"
}
}
}
}OpenClaw
Define a custom provider in ~/.openclaw/openclaw.json; put the key in the env block.
{
"env": { "SALPX_API_KEY": "YOUR_KEY" },
"agents": {
"defaults": { "model": { "primary": "salpx/gpt-5.6-luna" } }
},
"models": {
"mode": "merge",
"providers": {
"salpx": {
"baseUrl": "https://www.salpx.com/v1",
"apiKey": "${SALPX_API_KEY}",
"api": "openai-responses",
"models": [{ "id": "gpt-5.6-luna", "name": "GPT-5.6 Luna" }]
}
}
}
}Hermes
Configure via ~/.hermes/config.yaml, or interactively with hermes model.
model: default: gpt-5.6-luna provider: custom base_url: https://www.salpx.com/v1 api_key: YOUR_KEY
Cherry Studio
A desktop LLM client — add a custom OpenAI provider:
- Settings → Model services → Add custom provider
- API key:
YOUR_KEY - API address:
https://www.salpx.com/v1(stop at /v1; the rest is auto-completed) - Add the model ID manually (e.g.
gpt-5.6-luna), then hit "Check connection"
WorkBuddy
Add models in ~/.codebuddy/models.json using the full endpoint path, saved as UTF-8 without BOM.
{
"models": [
{
"id": "gpt-5.6-luna",
"name": "GPT-5.6 Luna (SalpX)",
"vendor": "OpenAI",
"url": "https://www.salpx.com/v1/chat/completions",
"apiKey": "YOUR_KEY",
"maxInputTokens": 128000,
"maxOutputTokens": 8192,
"supportsToolCall": true
}
],
"availableModels": ["gpt-5.6-luna"]
}DeskClaw
DeskClaw is a desktop wrapper around OpenClaw with built-in models and no obvious "custom endpoint" entry in its UI. If your version reads the standard OpenClaw config, the OpenClaw method above (~/.openclaw/openclaw.json) works.
Unofficial item — verify with your DeskClaw version whether it reads ~/.openclaw/openclaw.json.
Trae
ByteDance's AI IDE. Note: Trae currently does not support custom base URLs (only its built-in provider list), so you cannot enter the SalpX address directly like in other clients. Two options:
- Local proxy (works today): use the open-source Trae-Proxy (search GitHub for
arch3rPro/Trae-Proxy) to intercept Trae's OpenAI-bound requests and forward them to SalpX. Steps: ① start Trae-Proxy with the backend set tohttps://www.salpx.com/v1and your SalpX key; ② install its self-signed certificate; ③ edit your hosts file per its instructions to point the OpenAI domain at the local proxy; ④ back in Trae → add model → provider OpenAI → custom model ID (e.g.gpt-5.6-luna). - Native (version-dependent): if your Trae version exposes "custom endpoint / base URL", just enter
https://www.salpx.com/v1+ your SalpX key + a model name.
Stream error: Transport error: request or response body error (origin:downstream) is usually not a model or SalpX fault (tokens are still generating) — it is the local proxy layer. Check in order: ① is Trae-Proxy buffering SSE — a local proxy that does not stream through in real time gets long answers / thinking models killed by idle timeouts (prime suspect); ② raise Trae-Proxy and Trae request / stream timeouts: idle (read) timeout ≥ 120 s, whole request ≥ 600 s (if there is only one timeout setting, use 300–600 s); ③ if another reverse proxy (nginx etc.) sits in the path, add proxy_buffering off so streams pass through live. The SalpX gateway has built-in SSE idle keep-alive heartbeats (admin-enabled) that absorb some idle timeouts.16Advanced · Enabling the Codex plugin (Codex++)
- Install the official Codex app, then install Codex++ from its releases.
- Create / copy an API key in the console.
- Open the Codex++ tool → Relay configuration.
- Add a config: Base URL
https://www.salpx.com/v1, API key, modelgpt-5.6-luna. - Save, launch Codex via Codex++, and confirm Provider =
CodexPlusPlus.
17Help
FAQ
| Symptom | Fix |
|---|---|
401 / invalid_api_key | Copy the full key from the console — no stray spaces or newlines. |
403 | Insufficient balance, a disabled key, or the model is not in your group. |
404 | Wrong address / path. HTTP/SDK use /v1; Claude Code & Gemini CLI use the root. |
| CC-Switch import does nothing | Confirm CC-Switch is installed and the ccswitch:// protocol is registered. |
| CLI changes have no effect | Restart the process; environment variables only apply to new sessions. |
Get access
Create an API key under Console → Token management, top up, and every model is callable. One key works across all endpoints and clients.