aisplice

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-sol$0.20 in · $1.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.

POSThttps://www.aisplice.store/v1/chat/completionsBearer API keyReturns directly
API_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 Sol",
  "messages": [
    {
      "role": "user",
      "content": "Say hello."
    }
  ],
  "stream": false
}'

All parameters

Every field this model accepts, with the allowed values.

model
stringrequired

Exact model identifier for this request.

messages
arrayoptional

Required on /v1/chat/completions.

input
string|arrayoptional

Required on /v1/responses.

Response lifecycle

Successful response example for this endpoint.

Response
{
  "id": "chatcmpl_xxx",
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "Hello!"
      }
    }
  ]
}

Every field: /v1/chat/completions in the API reference →

#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.

Look up any other error →

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

terminal — live
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."
      }
    ]
  }'
streaming.py
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

If a client disconnects mid-stream the gateway writes the partial usage that actually reached the wire — you are only billed for what was delivered.
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.

tools.sh
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.

response.json
{
  "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.

round-trip.sh
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.

vision.sh
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.

base64.py
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.