DocsAPI referenceResponses API
Responses API
The OpenAI-compatible Responses endpoint — request fields, response shape, streaming.
POST
/v1/responsesA chat endpoint compatible with the OpenAI Responses API request body — the same interface coding tools like Codex use. Authenticate with Authorization: Bearer.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model id — see Models. |
input | string | array | Yes | User input: plain text, or an array of messages for multi-turn / multimodal input. |
instructions | string | No | System prompt. |
max_output_tokens | integer | No | Output token cap (minimum 16). |
stream | boolean | No | When true, the response streams over SSE — see Streaming. |
temperature / tools / … | — | No | Other official fields are forwarded as-is; support depends on the target model. |
curl https://soleapi.com/v1/responses \
-H "Authorization: Bearer $SOLEAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-fable-5",
"input": "Write a haiku about the sea",
"max_output_tokens": 200
}'Response
{
"id": "resp_abc123",
"object": "response",
"model": "claude-fable-5",
"status": "completed",
"output": [
{
"type": "message",
"role": "assistant",
"content": [
{ "type": "output_text", "text": "Waves fold into foam..." }
]
}
],
"usage": {
"input_tokens": 14,
"output_tokens": 23,
"total_tokens": 37
}
}The token counts in usage are what billing is based on; official SDKs expose the plain text via resp.output_text.
Other OpenAI-compatible endpoints
The same auth header also covers the endpoints below; request and response shapes match the OpenAI originals:
| Endpoint | Purpose | Billing |
|---|---|---|
POST /v1/embeddings | Text embeddings (text-embedding-3-small / -large) | Per input token |
POST /v1/images/generations · /v1/images/edits | Image generation and editing, see Images & video | Per image |
POST /v1/videos/generations · /v1/videos/edits · GET /v1/videos/{request_id} | Asynchronous video generation (Grok Imagine), see Images & video | Per second, settled once the video is ready |
POST /v1/responses/compact · /v1/responses/input_tokens · /v1/alpha/search | Context compaction, input-token estimation and web search used by the Codex client | Compaction per token; estimation free; search per call |
GET /v1/usage | Account balance and total spend, see Billing & balance | Free, counts toward RPM |
curl https://soleapi.com/v1/embeddings \
-H "Authorization: Bearer $SOLEAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": "The quick brown fox"
}'POST /v1/chat/completions is kept for legacy compatibility only. All new integrations should use the Responses API.