OpenAI o3 Serverless API
Frontier reasoning model for complex coding, math, and science.
API Format: OpenAI GPT (Standard Format)
This model uses OpenAI-compatible request/response format.
POST /v2/o3 · submit + poll 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3import segmind
4
5payload = {
6 "messages": [
7 {
8 "role": "user",
9 "content": [
10 {
11 "type": "text",
12 "text": "What's in this image?"
13 },
14 {
15 "type": "image_url",
16 "image_url": {
17 "url": "https://example.com/image.jpg"
18 }
19 }
20 ]
21 }
22 ],
23 "effort": "high",
24 "response_format": {
25 "type": "json_schema",
26 "json_schema": {
27 "name": "answer",
28 "strict": True,
29 "schema": {
30 "type": "object",
31 "properties": {"answer": {"type": "string"}},
32 "required": ["answer"],
33 "additionalProperties": False
34 }
35 }
36 }
37}
38
39# Async chat (v2): submit to the queue, block until COMPLETED.
40reply = segmind.chat("o3", **payload)
41print(reply.text)
42
43# --- Or get a handle (track request_id, control the poll cadence) ---
44job = segmind.submit_chat("o3", **payload)
45print(job.request_id) # available immediately
46reply = job.wait(timeout=600)
47print(reply.text) 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3import segmind
4
5payload = {
6 "messages": [
7 {
8 "role": "user",
9 "content": [
10 {
11 "type": "text",
12 "text": "What's in this image?"
13 },
14 {
15 "type": "image_url",
16 "image_url": {
17 "url": "https://example.com/image.jpg"
18 }
19 }
20 ]
21 }
22 ],
23 "effort": "high",
24 "response_format": {
25 "type": "json_schema",
26 "json_schema": {
27 "name": "answer",
28 "strict": True,
29 "schema": {
30 "type": "object",
31 "properties": {"answer": {"type": "string"}},
32 "required": ["answer"],
33 "additionalProperties": False
34 }
35 }
36 }
37}
38
39# Async chat (v2): submit to the queue, block until COMPLETED.
40reply = segmind.chat("o3", **payload)
41print(reply.text)
42
43# --- Or get a handle (track request_id, control the poll cadence) ---
44job = segmind.submit_chat("o3", **payload)
45print(job.request_id) # available immediately
46reply = job.wait(timeout=600)
47print(reply.text)API Endpoint
POST https://api.segmind.com/v1/o3Parameters
messagesrequiredobject[]Array of message objects with role and content. Content can be text or multimodal (text + images).
rolerequiredstringRole of the message sender
"user""assistant"contentrequiredarrayString or array of content blocks
effortoptionalstringHow hard the model reasons before answering. Thinking is billed as output tokens, so higher levels cost more and take longer.
"low""medium""high""xhigh"response_formatoptionalobjectStructured output. {"type": "json_object"} returns any valid JSON; {"type": "json_schema", "json_schema": {"name", "strict", "schema"}} enforces the given JSON Schema. Omit for plain text. For json_object the prompt must mention JSON.
Response Format
{
"id": "chat_abc123",
"object": "chat.completion",
"created": 1677652288,
"model": "o3",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "I can see a beautiful sunset over the ocean with vibrant orange and pink hues in the sky."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 56,
"completion_tokens": 31,
"total_tokens": 87
}
}With response_format
The envelope is unchanged: your JSON arrives as a string in the same field, which you parse yourself. Structured outputs guide
{
"id": "chat_abc123",
"object": "chat.completion",
"created": 1677652288,
"model": "o3",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "{\"answer\":\"Paris\"}"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 56,
"completion_tokens": 31,
"total_tokens": 87
}
}Image Input Format
Important: OpenAI GPT (Standard Format) Format
Images can be provided as URLs or base64 data URIs (data:image/jpeg;base64,...)
This model supports vision capabilities. You can include images in your requests.
Asynchronous requests (v2)
Use Async for video, long-running (>~60s), or high-concurrency workloads; Sync is simplest for fast image & LLM calls. Async submits a request and you poll it to completion.
- 1
POST /v2/o3Submit — returns request_id, status_url, response_url
- 2
GET /v2/requests/{id}/statusPoll — until COMPLETED or FAILED
- 3
GET /v2/requests/{id}Result — final response body
Status states
- A FAILED request is served as HTTP 422 — the body still carries the error detail.
- An unknown or expired request_id returns HTTP 404.
- Results are retained for 1 hour, then expire.
- Content / RAI blocks surface as FAILED, not a separate state.
- Track completion by polling the status endpoint.
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid message format or parameters — including a response_format this model does not accept, or a json_schema sent without a schema object
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out