Chat and Responses
curl --request POST \
--url https://api.compose.market/v1/chat/completions \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"messages": [
{}
],
"stream": true,
"tools": [
{}
],
"tool_choice": {},
"response_format": {},
"input": {},
"previous_response_id": "<string>",
"modalities": [
{}
]
}
'import requests
url = "https://api.compose.market/v1/chat/completions"
payload = {
"model": "<string>",
"messages": [{}],
"stream": True,
"tools": [{}],
"tool_choice": {},
"response_format": {},
"input": {},
"previous_response_id": "<string>",
"modalities": [{}]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{}],
stream: true,
tools: [{}],
tool_choice: {},
response_format: {},
input: {},
previous_response_id: '<string>',
modalities: [{}]
})
};
fetch('https://api.compose.market/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.compose.market/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'messages' => [
[
]
],
'stream' => true,
'tools' => [
[
]
],
'tool_choice' => [
],
'response_format' => [
],
'input' => [
],
'previous_response_id' => '<string>',
'modalities' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.compose.market/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"tools\": [\n {}\n ],\n \"tool_choice\": {},\n \"response_format\": {},\n \"input\": {},\n \"previous_response_id\": \"<string>\",\n \"modalities\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.compose.market/v1/chat/completions")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"tools\": [\n {}\n ],\n \"tool_choice\": {},\n \"response_format\": {},\n \"input\": {},\n \"previous_response_id\": \"<string>\",\n \"modalities\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compose.market/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"tools\": [\n {}\n ],\n \"tool_choice\": {},\n \"response_format\": {},\n \"input\": {},\n \"previous_response_id\": \"<string>\",\n \"modalities\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_bodyInference
Chat and Responses
Generate text, tool calls, and Responses-style outputs through native paid inference.
POST
/
v1
/
chat
/
completions
Chat and Responses
curl --request POST \
--url https://api.compose.market/v1/chat/completions \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"messages": [
{}
],
"stream": true,
"tools": [
{}
],
"tool_choice": {},
"response_format": {},
"input": {},
"previous_response_id": "<string>",
"modalities": [
{}
]
}
'import requests
url = "https://api.compose.market/v1/chat/completions"
payload = {
"model": "<string>",
"messages": [{}],
"stream": True,
"tools": [{}],
"tool_choice": {},
"response_format": {},
"input": {},
"previous_response_id": "<string>",
"modalities": [{}]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{}],
stream: true,
tools: [{}],
tool_choice: {},
response_format: {},
input: {},
previous_response_id: '<string>',
modalities: [{}]
})
};
fetch('https://api.compose.market/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.compose.market/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'messages' => [
[
]
],
'stream' => true,
'tools' => [
[
]
],
'tool_choice' => [
],
'response_format' => [
],
'input' => [
],
'previous_response_id' => '<string>',
'modalities' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.compose.market/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"tools\": [\n {}\n ],\n \"tool_choice\": {},\n \"response_format\": {},\n \"input\": {},\n \"previous_response_id\": \"<string>\",\n \"modalities\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.compose.market/v1/chat/completions")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"tools\": [\n {}\n ],\n \"tool_choice\": {},\n \"response_format\": {},\n \"input\": {},\n \"previous_response_id\": \"<string>\",\n \"modalities\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compose.market/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"tools\": [\n {}\n ],\n \"tool_choice\": {},\n \"response_format\": {},\n \"input\": {},\n \"previous_response_id\": \"<string>\",\n \"modalities\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_bodyUse these routes when you want native Compose receipts, raw x402 support, or Compose Key billing.
Routes
| Method | Path | Streaming | Description |
|---|---|---|---|
POST | /v1/chat/completions | Yes | OpenAI Chat Completions-shaped request and response. |
POST | /v1/responses | Yes | Responses-shaped input, tools, multimodal content, and stored response IDs. |
GET | /v1/responses/{id} | No | Retrieve a stored response record. |
GET | /v1/responses/{id}/input_items | No | Return stored input items for a response. |
POST | /v1/responses/{id}/cancel | No | Cancel a stored response or async media job. |
POST | /api/inference | Yes | Legacy alias for /v1/chat/completions. |
Headers
string
Bearer compose-... for Compose Key billing.string
Raw x402 payment signature for x402-aware clients.
string
Maximum USDC atomic amount for raw x402
upto payments.Chat body
string
required
Public catalog model ID.
array
required
Non-empty OpenAI-style chat message array.
boolean
Enables SSE streaming. Non-boolean values return
400 invalid_stream.array
OpenAI function tool definitions for models that support tool calling.
string | object
none, auto, required, or a named function choice.object
Text, JSON object, or JSON schema response format when the provider supports it.
Responses body
string
required
Public catalog model ID.
string | array
required
Responses-style input. Required unless
previous_response_id supplies history.string
Response ID to hydrate prior messages.
array
Requested output modalities.
Streaming events
Native streams send OpenAI-compatible data frames plus Compose events:| Event | Description |
|---|---|
data: {...} | Chat or Responses chunk. |
event: compose.receipt | In-band settlement receipt before stream close. |
event: compose.error | Structured Compose error frame. |
data: [DONE] | Stream terminator. |
⌘I