By capability
Chat
Pick a model, copy the request, read the reply. All chat models take the same OpenAI-style request.
#1. Pick a model
gpt-6-astra$1.00 in · $5.00 out / 1MLimits and status
5 models online for this. Switching changes the code below.
#2. Copy the request
Replace YOUR_API_KEY with your key, then run it. Options shown are the ones this model accepts.
https://www.aisplice.store/v1/chat/completionsBearer API keyReturns directlyAPI_KEY="${API_KEY:-YOUR_API_KEY}"
curl --fail-with-body -sS https://www.aisplice.store/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "GPT-6 Astra",
"messages": [
{
"role": "user",
"content": "Say hello."
}
],
"stream": false
}'All parameters
Every field this model accepts, with the allowed values.
All parameters
Every field this model accepts, with the allowed values.
modelExact model identifier for this request.
messagesRequired on /v1/chat/completions.
inputRequired on /v1/responses.
Response lifecycle
Successful response example for this endpoint.
Response lifecycle
Successful response example for this endpoint.
{
"id": "chatcmpl_xxx",
"choices": [
{
"message": {
"role": "assistant",
"content": "Hello!"
}
}
]
}#3. Get the result
A 200 answer carries the reply in choices[0].message.content. Add "stream": true to receive it while it is being written.
#When it goes wrong
- 400 with a field name: that option is not accepted by this model; use the values listed in step 2.
- 402: the balance cannot cover this request; top up in Wallet, then retry.
- 429: slow down and retry after the Retry-After seconds.
- 503 model_not_found: the model name is wrong or the model is offline; pick one from step 1.
StreamingShow the reply while it is being written.
#How it works
Set stream:true and the gateway relays Server-Sent Events exactly as OpenAI emits them: one data: frame per delta, closed by data: [DONE]. Any SSE client or the official SDKs consume it unchanged.
#Run it
curl -N https://www.aisplice.store/v1/chat/completions \
-H "Authorization: Bearer sk-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-luna",
"stream": true,
"messages": [
{
"role": "user",
"content": "Write a haiku about the sea."
}
]
}'from openai import OpenAI
client = OpenAI(base_url="https://www.aisplice.store/v1", api_key="sk-YOUR_KEY")
stream = client.chat.completions.create(
model="gpt-5.6-luna",
stream=True,
messages=[{"role": "user", "content": "Write a haiku about the sea."}],
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")#Partial billing
Only pay for what streamed
Tool callingLet the model call your own functions.
#Declare tools
Send the standard OpenAI tools array. The gateway forwards it to every tool-capable model — OpenAI, Claude, Gemini, DeepSeek — and normalizes the reply back into tool_calls. Streaming tool-call deltas are supported.
curl https://www.aisplice.store/v1/chat/completions \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-luna",
"messages": [{"role":"user","content":"Weather in Tokyo?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}
}]
}'#Handle tool_calls
When the model decides to call a tool, the choice arrives with finish_reason:"tool_calls" and an arguments string your code parses and executes.
{
"choices": [{
"finish_reason": "tool_calls",
"message": {
"role": "assistant",
"tool_calls": [{
"id": "call_abc123",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"city\": \"Tokyo\"}"
}
}]
}
}]
}#Send results back
Append the assistant turn and one role:"tool" message per call (matched by tool_call_id), then request again — the model folds the result into its final answer.
curl https://www.aisplice.store/v1/chat/completions \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-luna",
"messages": [
{"role":"user","content":"Weather in Tokyo?"},
{"role":"assistant","tool_calls":[{"id":"call_abc123","type":"function",
"function":{"name":"get_weather","arguments":"{\"city\":\"Tokyo\"}"}}]},
{"role":"tool","tool_call_id":"call_abc123","content":"{\"temp_c\": 22, \"sky\": \"clear\"}"}
]
}'Image inputSend pictures along with the text.
#Send an image
Vision-capable chat models take a content array mixing text parts and image_url parts. Use a public URL or an inline base64 data URL — same field either way.
curl https://www.aisplice.store/v1/chat/completions \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-luna",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "What is in this image?"},
{"type": "image_url", "image_url": {"url": "https://example.com/cat.png"}}
]
}]
}'#Base64 images
For local files, inline a data URL: "url": "data:image/png;base64,<bytes>". Image tokens are billed as input tokens; maximum image size and count per request are vendor-dependent — downscale before sending to save cost.
import base64
from openai import OpenAI
client = OpenAI(base_url="https://www.aisplice.store/v1", api_key="sk-YOUR_KEY")
b64 = base64.b64encode(open("photo.png", "rb").read()).decode()
resp = client.chat.completions.create(
model="gpt-5.6-luna",
messages=[{"role": "user", "content": [
{"type": "text", "text": "Describe this photo."},
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{b64}"}},
]}],
)
print(resp.choices[0].message.content)Still stuck?
Send us the request ID or the error message and we will look into it.