> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.singularityapi.dev/get-started/quickstart/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.singularityapi.dev/_mcp/server. # Quickstart Four steps: create a key, send a request, check the receipt, then go deeper. ## 1. Get an API key Open the dashboard at `https://app.singularityapi.dev`, go to **API keys**, and click **Create**. > **Warning** > > Your key (`sapi_...`) is shown once, at creation. Copy it somewhere safe — you cannot view it again. New accounts start with a \$0.00 balance — add credit in the dashboard to make your first request. ## 2. Make your first request Set `SINGULARITY_API_KEY` in your environment and send a chat completion. The example model here is `deepseek-v4-flash`; see [Models & Pricing](/get-started/models-pricing) for the full catalog. **`cURL`** ```bash title="cURL" curl https://api.singularityapi.dev/v1/chat/completions \ -H "Authorization: Bearer $SINGULARITY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek-v4-flash", "messages": [{"role": "user", "content": "Say hello."}] }' ``` **`Python`** ```python title="Python" from openai import OpenAI client = OpenAI( base_url="https://api.singularityapi.dev/v1", api_key="YOUR_API_KEY", ) response = client.chat.completions.create( model="deepseek-v4-flash", messages=[{"role": "user", "content": "Say hello."}], ) print(response.choices[0].message.content) ``` **`JavaScript`** ```javascript title="JavaScript" import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.singularityapi.dev/v1", apiKey: "YOUR_API_KEY", }); const response = await client.chat.completions.create({ model: "deepseek-v4-flash", messages: [{ role: "user", content: "Say hello." }], }); console.log(response.choices[0].message.content); ``` ## 3. Check the receipt Every response carries an `x-singularity-request-id` and an `x-singularity-receipt-id` header. Pull the receipt for the exact tokens, cost, and latency of that request: **`cURL`** ```bash title="cURL" curl https://api.singularityapi.dev/v1/receipts/RECEIPT_ID \ -H "Authorization: Bearer $SINGULARITY_API_KEY" ``` **`Python`** ```python title="Python" import httpx api_key = "YOUR_API_KEY" receipt = httpx.get( "https://api.singularityapi.dev/v1/receipts/RECEIPT_ID", headers={"Authorization": f"Bearer {api_key}"}, ).json() print(receipt["total_cost_usd"], receipt["usage"], receipt["latency_ms"]) ``` **`JavaScript`** ```javascript title="JavaScript" const apiKey = "YOUR_API_KEY"; const receipt = await fetch( "https://api.singularityapi.dev/v1/receipts/RECEIPT_ID", { headers: { Authorization: `Bearer ${apiKey}` } }, ).then((r) => r.json()); console.log(receipt.total_cost_usd, receipt.usage, receipt.latency_ms); ``` Every answer, on the record. ## 4. Next steps #### [Models & Pricing](/get-started/models-pricing) See every model, its limits, and its exact price. #### [Contracts](/platform/contracts) Give your calls a permanent, dashboard-controlled model name. #### [Streaming](/platform/streaming) Stream responses over standard OpenAI-compatible SSE. #### [Errors & Rate Limits](/api/errors-rate-limits) Handle the error envelope and the rate limit. > Your first request in under a minute