Text & Extraction API

POST /chat/completions — an OpenAI-compatible text endpoint, built as the side channel for voice agents: everything that reasons about a conversation instead of speaking in it. Structured extraction, outcome classification, post-call QA scoring, voicemail detection, idle re-prompts, chat-mode testing — one endpoint powers them all, with native Hindi, Hinglish and code-switched comprehension.

Point any OpenAI SDK at base URL https://platform.oogam.ai/v1 with your existing sk-setu-… key and send "model": "sutra-conversation". It is the one text model we serve, it needs the Sutra product enabled on the key, and its billing is on the Models page.

naad-text-v1 is a legacy id for the same model and still works, so existing integrations need no change. New code should send sutra-conversation.

Structured extraction

Set response_format to {"type": "json_object"} and the reply's content is requested as a JSON object. The platform validates the model response and may return json_generation_failed if it cannot produce valid JSON. Check the HTTP status, catch parsing errors, and validate the fields your application needs. A temperature of 0 reduces variation; it does not guarantee identical output.

curl https://platform.oogam.ai/v1/chat/completions \
  -H "Authorization: Bearer $OOGAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sutra-conversation",
    "temperature": 0,
    "response_format": {"type": "json_object"},
    "messages": [
      {"role": "system",
       "content": "Return JSON with keys date (YYYY-MM-DD) and time (HH:MM, 24h)."},
      {"role": "user",
       "content": "25 अगस्त 2026 को शाम 5 बजे का appointment book कर दो"}
    ]
  }'

Tip: state dates explicitly (or pass today's date in your system prompt and post-process relative words like कल/परसों yourself). Explicit dates reduce ambiguity; validate the extracted value before using it.

Response — standard shape, with real token usage for cost attribution:

json
{
  "id": "chatcmpl-1e97a0ee22d04527b805315c",
  "object": "chat.completion",
  "created": 1755763200,
  "model": "sutra-conversation",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "{\"date\": \"2026-08-25\", \"time\": \"17:00\"}"
    },
    "finish_reason": "stop"
  }],
  "usage": {"prompt_tokens": 81, "completion_tokens": 29, "total_tokens": 110}
}

Request parameters

FieldTypeRequiredNotes
modelstringyesSend sutra-conversation. It is the only text model that answers; see Models.
messagesarrayyesStandard role/content messages. String content only; 1–200 messages, ≤100,000 characters total. Request body ≤256 KB.
temperaturenumbernoBetween 0 and 2. Forwarded verbatim — 0 reduces sampling variation without guaranteeing identical results. Out of range → 400 invalid_temperature.
max_tokensintegernoPositive integer (≥1) capping the completion length. Invalid → 400 invalid_max_tokens.
response_formatobjectno{"type":"json_object"} for enforced JSON (an object, never a scalar or array), or {"type":"text"} (default).
streambooleannotrue streams Server-Sent Events — see below.
tools / tool_choice—noNot supported yet — rejected with a clear 400 tools_not_supported, never silently ignored.

Response (non-streaming): the object shown above — id, choices[0].message.content, and a usage block with real token counts. With json_object, content is a JSON object string; parse it with error handling and validate its fields.

Streaming

With stream: true the response is text/event-stream: a first chunk carrying delta.role, then content chunks, a final chunk with finish_reason: "stop", and the literal data: [DONE] sentinel. Each event is a chat.completion.chunk. Note the stream does not include a usage block — read token usage from a non-streaming call, or from your dashboard. Most voice-agent tasks (extraction, classification) are batch, so streaming is optional.

The model emits its own internal reasoning before the answer. This endpoint strips it, on streaming and non-streaming calls alike, so delta.content carries the reply only — you will not see <think> blocks or planning text. Calling the model anywhere other than through this endpoint, you would.

SSE
data: {"id":"chatcmpl-…","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}

data: {"id":"chatcmpl-…","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"नम"},"finish_reason":null}]}

data: {"id":"chatcmpl-…","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"स्ते"},"finish_reason":null}]}

data: {"id":"chatcmpl-…","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: [DONE]

Endpoint errors

StatusCodeMeaning
400tools_not_supportedRemove tools/tool_choice; express the task as instructions + json_object.
400invalid_response_formatOnly text and json_object are supported.
400invalid_temperature / invalid_max_tokensOut-of-range sampling parameters.
404model_not_foundUnknown model id, or an id that belongs to another modality (a TTS id here, for instance).
400missing_messages / too_many_messages / invalid_messageEmpty, over 200, or non-string content.
413payload_too_large / prompt_too_largeBody over 256 KB, or messages over 100k characters.
502json_generation_failedThe model could not produce valid JSON even after a retry. Retryable.
503model_not_configuredThe text model is not activated on this deployment. Retryable after Retry-After.

Everything else (auth, rate limits, wallet) uses the shared error contract.

Embeddings — not available yet

POST /embeddings exists and is OpenAI-compatible, but no embeddings provider is enabled on this deployment: every call answers 503 model_not_configured with a Retry-After header. It never returns a mock vector, which would silently corrupt an index. Nothing is billed. We will document the request shape and the vector dimension here when it goes live — until then, do not plan a retrieval pipeline around it.

Latency & determinism

  • Measure latency with your transcript lengths and expected traffic; request duration can vary.
  • temperature: 0 reduces sampling variation. Model changes and runtime behavior can still affect results.
  • usage reports the model's own token counts — bill and attribute per call.