aisplice

API reference

Responses

POST/v1/responses

OpenAI’s Responses API shape — single input field, structured output items, and reasoning summaries for models that expose them.

#Request parameters

  • modelstringrequired

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

  • inputstring | arrayrequired

    The prompt: a plain string or an array of input items.

  • instructionsstringoptional

    System-level guidance, equivalent to a system message.

  • streambooleanoptional

    Streams response.* SSE events instead of one JSON body.

  • max_output_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.

  • previous_response_idstringoptional

    Chain a follow-up turn onto a prior response without resending history.

#Compacting a long conversation

POST/v1/responses/compact

Compaction condenses a conversation that has outgrown what you want to keep resending, and returns the shortened form to carry forward. It is the call coding agents make when a session approaches the context limit.

  • modelstringrequired

    A model that supports compaction. Others reject this path with unsupported_endpoint.

  • inputarray | stringoptional

    The conversation to compact, in Responses input form.

  • instructionsstring | arrayoptional

    What to preserve while compacting — for example "keep every file path and decision".

  • previous_response_idstringoptional

    Continue from a stored response instead of resending the whole history.

compacted.json
{
  "id": "resp_…",
  "object": "response",
  "created_at": 1789000000,
  "output": [ /* the compacted conversation */ ],
  "usage": {"input_tokens": 8120, "output_tokens": 240, "total_tokens": 8360}
}

Never streams, always billed by tokens

Compaction has no streaming form — stream:true is not part of this request. It is priced like any other Responses call on the tokens it reads and writes, so compact deliberately rather than on every turn.

#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/responses \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-luna",
    "input": "Say hello."
  }'

#Response

response.json
{
  "id": "resp_…",
  "object": "response",
  "model": "gpt-5.6-luna",
  "output": [{
    "type": "message",
    "role": "assistant",
    "content": [{"type": "output_text", "text": "Hello!"}]
  }],
  "usage": {"input_tokens": 9, "output_tokens": 3, "total_tokens": 12}
}

Still stuck?

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