aisplice

API reference

Chat Completions

POST/v1/chat/completions

The workhorse endpoint: multi-turn chat, streaming, tool calling, vision and JSON mode for every chat-capable model in the catalogue.

#Request parameters

  • modelstringrequired

    Model ID from /v1/models. The gateway resolves the upstream vendor from this value.

  • messagesarrayrequired

    Conversation turns: {role: system|user|assistant|tool, content}. Content may be a string or a multimodal part array.

  • streambooleanoptional

    true streams SSE deltas, closed by data: [DONE].

  • temperaturenumberoptional

    0 to 2. Leave empty for the model default.

  • max_tokensintegeroptional

    Upper bound on generated tokens; also caps the pre-reserved quota estimate.

  • toolsarrayoptional

    Function declarations the model may call — see the tool-calling guide.

  • tool_choicestring | objectoptional

    "auto", "none", or pin a specific function.

  • response_formatobjectoptional

    {"type":"json_object"} or a json_schema wrapper for structured output on supporting models.

  • top_pnumberoptional

    Nucleus sampling; use temperature or top_p, not both.

  • stopstring | arrayoptional

    Up to 4 stop sequences that cut generation.

#Related errors

  • 400 invalid_request_errorMalformed body or unsupported parameter for this model.
  • 401Invalid or missing bearer token. No error.code on this path — match the status.
  • 402 insufficient_user_quotaWallet balance cannot cover the pre-reserved estimate.
  • 429Per-key throttle. Empty body; wait for Retry-After. A 429 that does carry insufficient_user_quota is a daily spend cap instead.
  • 503 model_not_foundUnknown model, or no healthy channel serves it right now.

Full error-code table →

#Request example

curl https://www.aisplice.store/v1/chat/completions \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-luna",
    "messages": [{"role": "user", "content": "Say hello."}]
  }'

#Response

response.json
{
  "id": "chatcmpl-…",
  "object": "chat.completion",
  "model": "gpt-5.6-luna",
  "choices": [{
    "index": 0,
    "message": {"role": "assistant", "content": "Hello!"},
    "finish_reason": "stop"
  }],
  "usage": {"prompt_tokens": 9, "completion_tokens": 3, "total_tokens": 12}
}

Still stuck?

Send us the request ID or the error message and we will look into it.