{
    "openapi": "3.1.0",
    "info": {
        "title": "DeepFA API",
        "version": "1.0",
        "description": "OpenAI-compatible API: chat, embeddings, images, speech, transcription, video, music, 3D models, podcasts, agents and batches, paid from one credit balance. Reference: https://deepfa.ir/api#reference"
    },
    "servers": [
        {
            "url": "https://deepfa.ir/api/v1"
        }
    ],
    "security": [
        {
            "bearer": []
        }
    ],
    "tags": [
        {
            "name": "Text"
        },
        {
            "name": "Images"
        },
        {
            "name": "Audio"
        },
        {
            "name": "Jobs"
        },
        {
            "name": "Agents"
        },
        {
            "name": "Batches"
        },
        {
            "name": "Account"
        }
    ],
    "paths": {
        "/chat/completions": {
            "post": {
                "tags": [
                    "Text"
                ],
                "summary": "Chat completion (OpenAI shape)",
                "operationId": "createChatCompletion",
                "description": "Every text model. Streams server-sent events with \"stream\": true. The cost comes back in x-deepfa-credits.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "model",
                                    "messages"
                                ],
                                "properties": {
                                    "model": {
                                        "type": "string",
                                        "description": "A model id from GET /models."
                                    },
                                    "messages": {
                                        "type": "array",
                                        "minItems": 1,
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "role"
                                            ],
                                            "properties": {
                                                "role": {
                                                    "type": "string",
                                                    "description": "system, developer, user, assistant or tool",
                                                    "enum": [
                                                        "system",
                                                        "developer",
                                                        "user",
                                                        "assistant",
                                                        "tool"
                                                    ]
                                                },
                                                "content": {
                                                    "description": "Text, or an array of parts: {\"type\":\"text\"} and {\"type\":\"image_url\"}."
                                                }
                                            },
                                            "additionalProperties": true
                                        }
                                    },
                                    "stream": {
                                        "type": "boolean"
                                    },
                                    "stream_options": {
                                        "type": "object",
                                        "properties": {
                                            "include_usage": {
                                                "type": "boolean",
                                                "description": "Send a last chunk with the usage, the counts charged."
                                            }
                                        },
                                        "additionalProperties": true
                                    },
                                    "max_tokens": {
                                        "type": "integer"
                                    },
                                    "max_completion_tokens": {
                                        "type": "integer"
                                    },
                                    "tools": {
                                        "type": "array",
                                        "items": {
                                            "type": "object"
                                        }
                                    },
                                    "tool_choice": {
                                        "description": "auto, none, required, or a named function."
                                    },
                                    "response_format": {
                                        "type": "object",
                                        "description": "{\"type\":\"json_object\"} or {\"type\":\"json_schema\",\"json_schema\":{...}}"
                                    },
                                    "reasoning_effort": {
                                        "type": "string",
                                        "description": "low, medium or high, on reasoning models."
                                    },
                                    "temperature": {
                                        "type": "number",
                                        "description": "Dropped on the models that do not take it."
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The completion, or with \"stream\": true a text/event-stream of chunks ending with \"data: [DONE]\".",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/responses": {
            "post": {
                "tags": [
                    "Text"
                ],
                "summary": "Responses API (OpenAI shape), for OpenAI models",
                "operationId": "createResponse",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "model",
                                    "input"
                                ],
                                "properties": {
                                    "model": {
                                        "type": "string"
                                    },
                                    "input": {
                                        "description": "Text or input items."
                                    },
                                    "instructions": {
                                        "type": "string"
                                    },
                                    "stream": {
                                        "type": "boolean"
                                    },
                                    "previous_response_id": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The response object, or a stream of its events.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/messages": {
            "post": {
                "tags": [
                    "Text"
                ],
                "summary": "Messages API (Anthropic shape), for Claude models",
                "operationId": "createMessage",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "model",
                                    "max_tokens",
                                    "messages"
                                ],
                                "properties": {
                                    "model": {
                                        "type": "string"
                                    },
                                    "max_tokens": {
                                        "type": "integer"
                                    },
                                    "messages": {
                                        "type": "array",
                                        "items": {
                                            "type": "object"
                                        }
                                    },
                                    "system": {
                                        "description": "Text or blocks."
                                    },
                                    "stream": {
                                        "type": "boolean"
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The message, or a stream of its events. Errors are in Anthropic's shape.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/messages/count_tokens": {
            "post": {
                "tags": [
                    "Text"
                ],
                "summary": "Count a Messages request's tokens, free",
                "operationId": "countMessageTokens",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "{\"input_tokens\": n}",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "input_tokens": {
                                            "type": "integer"
                                        }
                                    },
                                    "additionalProperties": true
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/embeddings": {
            "post": {
                "tags": [
                    "Text"
                ],
                "summary": "Text to vectors",
                "operationId": "createEmbedding",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "model",
                                    "input"
                                ],
                                "properties": {
                                    "model": {
                                        "type": "string",
                                        "description": "text-embedding-3-small or text-embedding-3-large"
                                    },
                                    "input": {
                                        "description": "A string or an array of strings."
                                    },
                                    "dimensions": {
                                        "type": "integer"
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The vectors, in the OpenAI shape.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/images/generations": {
            "post": {
                "tags": [
                    "Images"
                ],
                "summary": "Make pictures",
                "operationId": "createImage",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "prompt"
                                ],
                                "properties": {
                                    "model": {
                                        "type": "string",
                                        "description": "Default gpt-image-2.5-sunburst."
                                    },
                                    "prompt": {
                                        "type": "string"
                                    },
                                    "n": {
                                        "type": "integer",
                                        "description": "1 to 10",
                                        "minimum": 1,
                                        "maximum": 10
                                    },
                                    "size": {
                                        "type": "string",
                                        "description": "Such as 1024x1024, 1536x1024, 1024x1536."
                                    },
                                    "quality": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "{\"created\": ..., \"data\": [{\"b64_json\": \"...\"}]}",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/images/edits": {
            "post": {
                "tags": [
                    "Images"
                ],
                "summary": "Picture to picture",
                "operationId": "editImage",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "image",
                                    "prompt"
                                ],
                                "properties": {
                                    "image": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "One to four pictures (image or image[])."
                                    },
                                    "prompt": {
                                        "type": "string"
                                    },
                                    "model": {
                                        "type": "string"
                                    },
                                    "n": {
                                        "type": "integer"
                                    },
                                    "size": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "{\"created\": ..., \"data\": [{\"b64_json\": \"...\"}]}",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/audio/speech": {
            "post": {
                "tags": [
                    "Audio"
                ],
                "summary": "Text to speech",
                "operationId": "createSpeech",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "input"
                                ],
                                "properties": {
                                    "model": {
                                        "type": "string",
                                        "description": "Default tts-1."
                                    },
                                    "input": {
                                        "type": "string",
                                        "description": "At most 4,096 characters."
                                    },
                                    "voice": {
                                        "type": "string"
                                    },
                                    "response_format": {
                                        "type": "string",
                                        "description": "mp3, opus, aac, flac, wav, pcm"
                                    },
                                    "speed": {
                                        "type": "number"
                                    },
                                    "instructions": {
                                        "type": "string"
                                    },
                                    "language": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The audio file.",
                        "content": {
                            "audio/mpeg": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/audio/transcriptions": {
            "post": {
                "tags": [
                    "Audio"
                ],
                "summary": "Speech to text",
                "operationId": "createTranscription",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "file"
                                ],
                                "properties": {
                                    "file": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "model": {
                                        "type": "string",
                                        "description": "Default gpt-transcribe."
                                    },
                                    "language": {
                                        "type": "string"
                                    },
                                    "prompt": {
                                        "type": "string"
                                    },
                                    "response_format": {
                                        "type": "string",
                                        "description": "json or text"
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "{\"text\": \"...\"} or plain text.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/videos": {
            "post": {
                "tags": [
                    "Jobs"
                ],
                "summary": "Start a video",
                "operationId": "createVideo",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "model"
                                ],
                                "properties": {
                                    "model": {
                                        "type": "string"
                                    },
                                    "prompt": {
                                        "type": "string"
                                    },
                                    "image_url": {
                                        "type": "string",
                                        "description": "A picture to animate."
                                    },
                                    "video_url": {
                                        "type": "string",
                                        "description": "A video to edit."
                                    },
                                    "seconds": {
                                        "type": "integer"
                                    },
                                    "resolution": {
                                        "type": "string"
                                    },
                                    "aspect_ratio": {
                                        "type": "string"
                                    },
                                    "audio": {
                                        "type": "boolean"
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The job, status \"queued\".",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "object": {
                                            "type": "string"
                                        },
                                        "model": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "queued, in_progress, completed or failed"
                                        },
                                        "created_at": {
                                            "type": "integer"
                                        },
                                        "completed_at": {
                                            "type": "integer"
                                        }
                                    },
                                    "additionalProperties": true
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/videos/{id}": {
            "get": {
                "tags": [
                    "Jobs"
                ],
                "summary": "Where a video has got to",
                "operationId": "getVideo",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "t_\u2026, i_\u2026 or v_\u2026",
                        "schema": {
                            "type": "string",
                            "pattern": "^[tiv]_[0-9]+$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The job.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "object": {
                                            "type": "string"
                                        },
                                        "model": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "queued, in_progress, completed or failed"
                                        },
                                        "created_at": {
                                            "type": "integer"
                                        },
                                        "completed_at": {
                                            "type": "integer"
                                        }
                                    },
                                    "additionalProperties": true
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/videos/{id}/content": {
            "get": {
                "tags": [
                    "Jobs"
                ],
                "summary": "The finished video (302 to the file)",
                "operationId": "getVideoContent",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The video's id",
                        "schema": {
                            "type": "string",
                            "pattern": "^[tiv]_[0-9]+$"
                        }
                    }
                ],
                "responses": {
                    "302": {
                        "description": "Redirect to the file."
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/music": {
            "post": {
                "tags": [
                    "Jobs"
                ],
                "summary": "Start a song",
                "operationId": "createMusic",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "model"
                                ],
                                "properties": {
                                    "model": {
                                        "type": "string"
                                    },
                                    "prompt": {
                                        "type": "string"
                                    },
                                    "lyrics": {
                                        "type": "string"
                                    },
                                    "style": {
                                        "type": "string"
                                    },
                                    "title": {
                                        "type": "string"
                                    },
                                    "instrumental": {
                                        "type": "boolean"
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The job, status \"queued\".",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "object": {
                                            "type": "string"
                                        },
                                        "model": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "queued, in_progress, completed or failed"
                                        },
                                        "created_at": {
                                            "type": "integer"
                                        },
                                        "completed_at": {
                                            "type": "integer"
                                        }
                                    },
                                    "additionalProperties": true
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/music/{id}": {
            "get": {
                "tags": [
                    "Jobs"
                ],
                "summary": "Where a song has got to",
                "operationId": "getMusic",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "m_\u2026",
                        "schema": {
                            "type": "string",
                            "pattern": "^m_[0-9]+$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The job, with its songs once completed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "object": {
                                            "type": "string"
                                        },
                                        "model": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "queued, in_progress, completed or failed"
                                        },
                                        "created_at": {
                                            "type": "integer"
                                        },
                                        "completed_at": {
                                            "type": "integer"
                                        }
                                    },
                                    "additionalProperties": true
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/music/{id}/content": {
            "get": {
                "tags": [
                    "Jobs"
                ],
                "summary": "A finished song (302 to the file)",
                "operationId": "getMusicContent",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "m_\u2026",
                        "schema": {
                            "type": "string",
                            "pattern": "^m_[0-9]+$"
                        }
                    },
                    {
                        "name": "song",
                        "in": "query",
                        "required": false,
                        "description": "Which of the songs a job made, from 1.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "default": 1
                        }
                    }
                ],
                "responses": {
                    "302": {
                        "description": "Redirect to the file."
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/3d": {
            "post": {
                "tags": [
                    "Jobs"
                ],
                "summary": "Start a 3D model from pictures or a description",
                "operationId": "create3dModel",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "model"
                                ],
                                "properties": {
                                    "model": {
                                        "type": "string",
                                        "description": "tripo-h3.1, hunyuan-3d-3.1-pro, rodin-gen-2.5, meshy-7.1 or trellis-2."
                                    },
                                    "image_url": {
                                        "type": "string",
                                        "description": "One picture: a public http(s) address or a data: URI."
                                    },
                                    "image_urls": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "Several pictures of the same thing from different sides (up to the model's max_images)."
                                    },
                                    "prompt": {
                                        "type": "string",
                                        "description": "A description, for a model made from words."
                                    },
                                    "character": {
                                        "type": "boolean",
                                        "description": "meshy-7.1: a rigged character."
                                    },
                                    "animation": {
                                        "type": "integer",
                                        "description": "meshy-7.1: a move for the character (implies character)."
                                    },
                                    "texture": {
                                        "description": "tripo-h3.1: none, standard or hd; meshy-7.1: true or false."
                                    },
                                    "geometry": {
                                        "type": "string",
                                        "description": "tripo-h3.1: standard or detailed."
                                    },
                                    "pbr": {
                                        "type": "boolean",
                                        "description": "hunyuan-3d-3.1-pro: PBR materials."
                                    },
                                    "tier": {
                                        "type": "string",
                                        "description": "rodin-gen-2.5: Gen-2.5-Medium, Gen-2.5-High or Gen-2.5-Extreme-High."
                                    },
                                    "hd": {
                                        "type": "boolean",
                                        "description": "rodin-gen-2.5: the HighPack add-on."
                                    },
                                    "lowpoly": {
                                        "type": "boolean",
                                        "description": "meshy-7.1: a low-poly model for games."
                                    },
                                    "resolution": {
                                        "type": "integer",
                                        "description": "trellis-2: 512, 1024 or 1536."
                                    },
                                    "title": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The job, status \"queued\".",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "object": {
                                            "type": "string"
                                        },
                                        "model": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "queued, in_progress, completed or failed"
                                        },
                                        "created_at": {
                                            "type": "integer"
                                        },
                                        "completed_at": {
                                            "type": "integer"
                                        }
                                    },
                                    "additionalProperties": true
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/3d/{id}": {
            "get": {
                "tags": [
                    "Jobs"
                ],
                "summary": "Where a 3D model has got to",
                "operationId": "get3dModel",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "3d_\u2026",
                        "schema": {
                            "type": "string",
                            "pattern": "^3d_[0-9]+$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The job, with its files once completed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "object": {
                                            "type": "string"
                                        },
                                        "model": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "queued, in_progress, completed or failed"
                                        },
                                        "created_at": {
                                            "type": "integer"
                                        },
                                        "completed_at": {
                                            "type": "integer"
                                        }
                                    },
                                    "additionalProperties": true
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/3d/{id}/content": {
            "get": {
                "tags": [
                    "Jobs"
                ],
                "summary": "The finished 3D model (302 to the file)",
                "operationId": "get3dModelContent",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "3d_\u2026",
                        "schema": {
                            "type": "string",
                            "pattern": "^3d_[0-9]+$"
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "required": false,
                        "description": "glb (default), or another format the job made: obj, fbx, usdz, stl, zip.",
                        "schema": {
                            "type": "string",
                            "default": "glb"
                        }
                    }
                ],
                "responses": {
                    "302": {
                        "description": "Redirect to the file."
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/podcasts": {
            "post": {
                "tags": [
                    "Jobs"
                ],
                "summary": "Start a podcast from a script",
                "operationId": "createPodcast",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "turns": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "speaker": {
                                                    "type": "integer",
                                                    "description": "1 to 4"
                                                },
                                                "text": {
                                                    "type": "string"
                                                },
                                                "style": {
                                                    "type": "string"
                                                }
                                            },
                                            "additionalProperties": true
                                        }
                                    },
                                    "script": {
                                        "type": "string"
                                    },
                                    "voices": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "names": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "language": {
                                        "type": "string"
                                    },
                                    "kind": {
                                        "type": "string",
                                        "description": "solo or dialogue"
                                    },
                                    "natural": {
                                        "type": "boolean"
                                    },
                                    "title": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The job, status \"queued\".",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "object": {
                                            "type": "string"
                                        },
                                        "model": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "queued, in_progress, completed or failed"
                                        },
                                        "created_at": {
                                            "type": "integer"
                                        },
                                        "completed_at": {
                                            "type": "integer"
                                        }
                                    },
                                    "additionalProperties": true
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/podcasts/{id}": {
            "get": {
                "tags": [
                    "Jobs"
                ],
                "summary": "Where a podcast has got to",
                "operationId": "getPodcast",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "p_\u2026",
                        "schema": {
                            "type": "string",
                            "pattern": "^p_[0-9]+$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The job.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "object": {
                                            "type": "string"
                                        },
                                        "model": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "queued, in_progress, completed or failed"
                                        },
                                        "created_at": {
                                            "type": "integer"
                                        },
                                        "completed_at": {
                                            "type": "integer"
                                        }
                                    },
                                    "additionalProperties": true
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/podcasts/{id}/content": {
            "get": {
                "tags": [
                    "Jobs"
                ],
                "summary": "The finished podcast (302 to the audio)",
                "operationId": "getPodcastContent",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "p_\u2026",
                        "schema": {
                            "type": "string",
                            "pattern": "^p_[0-9]+$"
                        }
                    }
                ],
                "responses": {
                    "302": {
                        "description": "Redirect to the file."
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/agents": {
            "get": {
                "tags": [
                    "Agents"
                ],
                "summary": "The agents, what each takes and costs",
                "operationId": "listAgents",
                "responses": {
                    "200": {
                        "description": "The agents.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/agents/runs": {
            "post": {
                "tags": [
                    "Agents"
                ],
                "summary": "Start an agent run",
                "operationId": "createAgentRun",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "agent",
                                    "input"
                                ],
                                "properties": {
                                    "agent": {
                                        "type": "string",
                                        "description": "research, analyst or site"
                                    },
                                    "input": {
                                        "type": "object"
                                    },
                                    "model": {
                                        "type": "string"
                                    },
                                    "parent_id": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The run, status \"processing\".",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            },
            "get": {
                "tags": [
                    "Agents"
                ],
                "summary": "List runs",
                "operationId": "listAgentRuns",
                "responses": {
                    "200": {
                        "description": "The runs.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/agents/runs/{id}": {
            "get": {
                "tags": [
                    "Agents"
                ],
                "summary": "Where a run has got to, and its answer",
                "operationId": "getAgentRun",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The run's id",
                        "schema": {
                            "type": "string",
                            "pattern": "^[0-9a-zA-Z_-]+$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The run.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/agents/runs/{id}/files/{file}": {
            "get": {
                "tags": [
                    "Agents"
                ],
                "summary": "Download a file the run made (a report, a sheet, a site's ZIP)",
                "operationId": "getAgentRunFile",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The run's id",
                        "schema": {
                            "type": "string",
                            "pattern": "^[0-9a-zA-Z_-]+$"
                        }
                    },
                    {
                        "name": "file",
                        "in": "path",
                        "required": true,
                        "description": "The file's id, from the run's files.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The file.",
                        "content": {
                            "application/octet-stream": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/agents/runs/{id}/cancel": {
            "post": {
                "tags": [
                    "Agents"
                ],
                "summary": "Cancel a run",
                "operationId": "cancelAgentRun",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "The run's id",
                        "schema": {
                            "type": "string",
                            "pattern": "^[0-9a-zA-Z_-]+$"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The run.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/files": {
            "post": {
                "tags": [
                    "Batches"
                ],
                "summary": "Upload a JSONL file of requests for a batch",
                "operationId": "createFile",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "file",
                                    "purpose"
                                ],
                                "properties": {
                                    "file": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "purpose": {
                                        "type": "string",
                                        "description": "batch",
                                        "enum": [
                                            "batch"
                                        ]
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The file.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/File"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            },
            "get": {
                "tags": [
                    "Batches"
                ],
                "summary": "List files",
                "operationId": "listFiles",
                "parameters": [
                    {
                        "name": "purpose",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The files.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/files/{id}": {
            "get": {
                "tags": [
                    "Batches"
                ],
                "summary": "A file",
                "operationId": "getFile",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "file-\u2026",
                        "schema": {
                            "type": "string",
                            "pattern": "^file-[A-Za-z0-9]+$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The file.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/File"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Batches"
                ],
                "summary": "Delete a file",
                "operationId": "deleteFile",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "file-\u2026",
                        "schema": {
                            "type": "string",
                            "pattern": "^file-[A-Za-z0-9]+$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "{\"id\": ..., \"deleted\": true}",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/files/{id}/content": {
            "get": {
                "tags": [
                    "Batches"
                ],
                "summary": "Download a file",
                "operationId": "getFileContent",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "file-\u2026",
                        "schema": {
                            "type": "string",
                            "pattern": "^file-[A-Za-z0-9]+$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The JSONL.",
                        "content": {
                            "application/jsonl": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/batches": {
            "post": {
                "tags": [
                    "Batches"
                ],
                "summary": "Run a file's requests in the background, within 24 hours",
                "operationId": "createBatch",
                "description": "Each line of the file: {\"custom_id\": \"...\", \"method\": \"POST\", \"url\": \"/v1/chat/completions\", \"body\": {...}}. Each request is charged as the same live call would be.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "input_file_id",
                                    "endpoint"
                                ],
                                "properties": {
                                    "input_file_id": {
                                        "type": "string"
                                    },
                                    "endpoint": {
                                        "type": "string",
                                        "enum": [
                                            "/v1/chat/completions",
                                            "/v1/embeddings"
                                        ]
                                    },
                                    "completion_window": {
                                        "type": "string",
                                        "enum": [
                                            "24h"
                                        ]
                                    },
                                    "metadata": {
                                        "type": "object"
                                    }
                                },
                                "additionalProperties": true
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The batch.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Batch"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            },
            "get": {
                "tags": [
                    "Batches"
                ],
                "summary": "List batches",
                "operationId": "listBatches",
                "parameters": [
                    {
                        "name": "after",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The batches.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/batches/{id}": {
            "get": {
                "tags": [
                    "Batches"
                ],
                "summary": "Where a batch has got to",
                "operationId": "getBatch",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "batch_\u2026",
                        "schema": {
                            "type": "string",
                            "pattern": "^batch_[A-Za-z0-9]+$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The batch.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Batch"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/batches/{id}/cancel": {
            "post": {
                "tags": [
                    "Batches"
                ],
                "summary": "Cancel a batch",
                "operationId": "cancelBatch",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "batch_\u2026",
                        "schema": {
                            "type": "string",
                            "pattern": "^batch_[A-Za-z0-9]+$"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The batch.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Batch"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/models": {
            "get": {
                "tags": [
                    "Account"
                ],
                "summary": "The models this key may call, with their prices",
                "operationId": "listModels",
                "responses": {
                    "200": {
                        "description": "{\"object\":\"list\",\"data\":[...]}",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/models/{model}": {
            "get": {
                "tags": [
                    "Account"
                ],
                "summary": "One model",
                "operationId": "getModel",
                "parameters": [
                    {
                        "name": "model",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The model.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/balance": {
            "get": {
                "tags": [
                    "Account"
                ],
                "summary": "What this key can spend",
                "operationId": "getBalance",
                "responses": {
                    "200": {
                        "description": "The balance.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearer": {
                "type": "http",
                "scheme": "bearer",
                "description": "An API key, sk-dfa-\u2026"
            }
        },
        "parameters": {
            "Tag": {
                "name": "X-DeepFA-Tag",
                "in": "header",
                "required": false,
                "description": "A label for the call (a project, a department, a customer), up to 64 characters; percent-encode a non-Latin one. The usage page breaks the spending down by it.",
                "schema": {
                    "type": "string",
                    "maxLength": 64
                }
            },
            "IdempotencyKey": {
                "name": "Idempotency-Key",
                "in": "header",
                "required": false,
                "description": "Sent again with the same request within a day, the first answer comes back (Idempotent-Replayed: true) instead of the call being run and charged twice.",
                "schema": {
                    "type": "string",
                    "maxLength": 255
                }
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "required": [
                    "error"
                ],
                "properties": {
                    "error": {
                        "type": "object",
                        "required": [
                            "message",
                            "type"
                        ],
                        "properties": {
                            "message": {
                                "type": "string"
                            },
                            "type": {
                                "type": "string"
                            },
                            "param": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "code": {
                                "type": "string"
                            }
                        },
                        "additionalProperties": true
                    }
                },
                "additionalProperties": true
            },
            "File": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "object": {
                        "type": "string"
                    },
                    "bytes": {
                        "type": "integer"
                    },
                    "created_at": {
                        "type": "integer"
                    },
                    "expires_at": {
                        "type": "integer"
                    },
                    "filename": {
                        "type": "string"
                    },
                    "purpose": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    }
                },
                "additionalProperties": true
            },
            "Batch": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "object": {
                        "type": "string"
                    },
                    "endpoint": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string",
                        "description": "validating, failed, in_progress, finalizing, completed, expired, cancelling or cancelled"
                    },
                    "input_file_id": {
                        "type": "string"
                    },
                    "output_file_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "error_file_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "request_counts": {
                        "type": "object",
                        "properties": {
                            "total": {
                                "type": "integer"
                            },
                            "completed": {
                                "type": "integer"
                            },
                            "failed": {
                                "type": "integer"
                            }
                        },
                        "additionalProperties": true
                    },
                    "usage": {
                        "type": "object"
                    },
                    "credits": {
                        "type": "number"
                    },
                    "errors": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "metadata": {
                        "type": [
                            "object",
                            "null"
                        ]
                    }
                },
                "additionalProperties": true
            }
        },
        "responses": {
            "Error": {
                "description": "An error, in the OpenAI shape (Anthropic's on /messages).",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            }
        }
    }
}