Quickstart
This quickstart uses curl so you can verify your API key before adding SDK
code. In an application, use the same base URL with the OpenAI SDK.
1. Get your API key
Sign up at console.subq.ai and create an API key from the dashboard. Store it in an environment variable:
export SUBQ_API_KEY="sk-your-api-key"2. Check account access
Make sure your account has credits before sending requests. A request without
available credits returns 402.
3. Send a chat completion
curl https://api.subq.ai/v1/chat/completions \
-H "Authorization: Bearer $SUBQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "subq-preview",
"messages": [
{
"role": "user",
"content": "Explain when a developer should use long-context prompting instead of retrieval-augmented generation, in three concise bullets."
}
]
}'The assistant text is in choices[0].message.content. For SDK examples,
supported fields, streaming, and response shapes, continue to the
Chat Completions API.
4. Try the Responses API
The Responses API stores conversation history server-side. Send a single turn
with input instead of messages:
curl https://api.subq.ai/v1/responses \
-H "Authorization: Bearer $SUBQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "subq-preview",
"input": "Explain when a developer should use long-context prompting instead of retrieval-augmented generation, in three concise bullets."
}'The assistant text is in output[0].content[0].text. Save the response id —
pass it as previous_response_id on the next turn to continue the conversation.
See Responses API for system instructions, web search,
multi-turn, streaming, and structured output.
Next steps
- Chat Completions API — stateless, drop-in OpenAI replacement.
- Responses API — stateful turns with
instructionsand web search. - Authentication — API keys and security practices.