Responses API
Call models that support the Responses API with the OpenAI Responses format (POST /v1/responses).
Responses is OpenAI's newer API format: it uses input instead of messages and returns results in output. AI Nexus offers POST /v1/responses, so the OpenAI SDK's client.responses.create() works directly. Codex CLI also connects through this endpoint.
Pick a model that supports this endpoint
/v1/responses works with models that support the Responses API. Pick a model on the model square that supports /v1/responses and use its model ID.
For models that don't support the Responses API, use OpenAI SDK / Chat Completions or Anthropic Messages instead.
Basic call
Replace your-model-id in the samples with a model ID from the model square (or call GET /v1/models).
# Responses format: path /v1/responses, input instead of messages
curl -sS https://ai.myaiexp.com/v1/responses \
-H "Authorization: Bearer $MYAIEXP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model-id",
"input": "Introduce yourself in one sentence.",
"max_output_tokens": 600
}'Key points:
- The base URL is also
https://ai.myaiexp.com/v1, withAuthorization: Bearer <Key>. max_output_tokenscorresponds tomax_tokensin Chat Completions. Reasoning models count their thinking as output, so leave enough room.inputcan be a string or an array of messages similar tomessages; pass a system prompt withinstructions.
Response structure
The answer is in output[].content[].text (with the SDK, read resp.output_text), and usage is in usage.input_tokens / usage.output_tokens. Structure:
{
"id": "resp_...",
"object": "response",
"model": "your-model-id",
"status": "completed",
"output": [
{
"type": "message",
"role": "assistant",
"status": "completed",
"content": [
{ "type": "output_text", "text": "..." }
]
}
],
"usage": { "input_tokens": 0, "output_tokens": 0, "total_tokens": 0 }
}For reasoning models, output may contain a type: "reasoning" item before the message. Filter by type, or just use output_text.
Streaming
Add "stream": true and the server returns SSE events. Incremental text is in the delta field of response.output_text.delta events, and the stream ends with a response.completed event:
event: response.output_text.delta
data: {"type":"response.output_text.delta","delta":"Hi", ...}
event: response.completed
data: {"type":"response.completed","response":{"status":"completed", ...}}With an SDK, pass stream=True / stream: true and iterate over the events.
See the API Reference for all fields.
Prompt caching (improve cache hit rate)
When calling the Claude-native /v1/messages endpoint, add cache_control to content blocks to enable prompt caching and cut the cost and latency of repeated input.
Multimodal (image input)
Attach images to a request so the model can understand them. Supports image_url in Chat Completions and image content blocks in Anthropic Messages.
This service is provided for learning and research purposes only. Please follow each model provider's usage policies.