{
  "openapi": "3.1.0",
  "info": {
    "title": "TokLab GPT-6.2 Astra",
    "version": "1.0.0",
    "description": "The official OpenAI Responses and Chat Completions APIs under the TokLab base URL: change the base URL and API key. Failed requests are not charged."
  },
  "servers": [
    {
      "url": "https://api.toklab.ai"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/responses": {
      "post": {
        "summary": "Create a response (OpenAI Responses API)",
        "operationId": "createResponse",
        "parameters": [
          {
            "name": "OpenAI-Beta",
            "in": "header",
            "required": false,
            "description": "Required when supplying a non-null multi_agent object on Responses.",
            "schema": {
              "type": "string",
              "enum": ["responses_multi_agent=v1"]
            }
          },
          {
            "name": "X-SeedRouter-Group",
            "in": "header",
            "required": false,
            "description": "Optional LLM group. Sign in to https://toklab.ai/models/gpt-6-2-astra#playground to check the groups available to your account; Playground uses your login session and requires no API key. Send the exact group name, keeping your existing model ID and API key. Omit this header or use auto to keep the key's default behavior. Restricted keys may have fewer options; use GET /api/seedrouter/llm/groups?model=MODEL_ID to check a particular key. The selected group's pricing applies; requests do not switch to another group. HTTP/SSE only, not WebSocket, image or video calls.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "default": "auto"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A response object. Streaming uses typed response events. Multi-agent output may include multi_agent_call, multi_agent_call_output and agent_message items.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["id", "object", "model", "output"],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "object": {
                      "const": "response"
                    },
                    "status": {
                      "type": "string"
                    },
                    "output": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "usage": {
                      "type": ["object", "null"]
                    }
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "summary": "Create a chat completion (OpenAI Chat Completions API)",
        "operationId": "createChatCompletion",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["model", "messages"],
                "properties": {
                  "model": {
                    "type": "string",
                    "const": "gpt-6.2-astra"
                  },
                  "stream": {
                    "type": ["boolean", "null"]
                  },
                  "store": {
                    "type": ["boolean", "null"]
                  },
                  "metadata": {
                    "type": ["object", "null"],
                    "maxProperties": 16,
                    "propertyNames": {
                      "maxLength": 64
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 512
                    }
                  },
                  "prompt_cache_key": {
                    "type": ["string", "null"]
                  },
                  "moderation": {
                    "type": ["object", "null"]
                  },
                  "user": {
                    "type": ["string", "null"]
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": ["role"],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": ["developer", "system", "user", "assistant"]
                        },
                        "content": {
                          "oneOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": true
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    }
                  },
                  "max_completion_tokens": {
                    "type": ["integer", "null"],
                    "maximum": 128000,
                    "minimum": 1
                  },
                  "reasoning_effort": {
                    "type": ["string", "null"],
                    "enum": ["low", "medium", "high", "xhigh", "max", null]
                  },
                  "response_format": {
                    "oneOf": [
                      {
                        "type": "object",
                        "required": ["type"],
                        "properties": {
                          "type": {
                            "const": "text"
                          }
                        }
                      },
                      {
                        "type": "object",
                        "required": ["type"],
                        "properties": {
                          "type": {
                            "const": "json_object"
                          }
                        }
                      },
                      {
                        "type": "object",
                        "required": ["type", "json_schema"],
                        "properties": {
                          "type": {
                            "const": "json_schema"
                          },
                          "json_schema": {
                            "type": "object",
                            "required": ["name", "schema"],
                            "properties": {
                              "name": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_-]{1,64}$"
                              },
                              "schema": {
                                "type": "object",
                                "additionalProperties": true
                              },
                              "description": {
                                "type": "string"
                              },
                              "strict": {
                                "type": ["boolean", "null"]
                              }
                            }
                          }
                        }
                      }
                    ]
                  },
                  "verbosity": {
                    "type": ["string", "null"],
                    "enum": ["low", "medium", "high", null]
                  },
                  "stream_options": {
                    "type": ["object", "null"],
                    "properties": {
                      "include_usage": {
                        "type": "boolean"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A chat completion. Streaming uses chat.completion.chunk data records and a final [DONE] marker.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["id", "object", "model", "choices"],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "object": {
                      "const": "chat.completion"
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "usage": {
                      "type": ["object", "null"]
                    }
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "X-SeedRouter-Group",
            "in": "header",
            "required": false,
            "description": "Optional LLM group. Sign in to https://toklab.ai/models/gpt-6-2-astra#playground to check the groups available to your account; Playground uses your login session and requires no API key. Send the exact group name, keeping your existing model ID and API key. Omit this header or use auto to keep the key's default behavior. Restricted keys may have fewer options; use GET /api/seedrouter/llm/groups?model=MODEL_ID to check a particular key. The selected group's pricing applies; requests do not switch to another group. HTTP/SSE only, not WebSocket, image or video calls.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "default": "auto"
            }
          }
        ]
      }
    },
    "/api/seedrouter/llm/groups": {
      "get": {
        "summary": "List available LLM groups",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Read-only. Returns groups allowed by this API key and account with an enabled channel for the requested model. Availability is checked again at generation time. No model generation is performed.",
        "parameters": [
          {
            "name": "model",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Available groups; auto preserves the API key default.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["model", "data"],
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": ["id", "ratio"],
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Exact value for X-SeedRouter-Group."
                          },
                          "ratio": {
                            "type": ["number", "null"],
                            "minimum": 0,
                            "description": "Account-specific group price multiplier. For auto, a current default estimate; null if unavailable."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid LLM model."
          },
          "401": {
            "description": "Invalid API key."
          },
          "403": {
            "description": "API key or account permissions do not allow this request."
          },
          "503": {
            "description": "Group discovery is temporarily unavailable."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "ResponsesRequest": {
        "type": "object",
        "required": ["model", "input"],
        "description": "Send images as input_image parts inside user messages. This endpoint supports synchronous and streaming responses.",
        "not": {
          "anyOf": [
            {
              "required": ["image"]
            },
            {
              "required": ["background_options"]
            }
          ]
        },
        "if": {
          "required": ["multi_agent"],
          "properties": {
            "multi_agent": {
              "type": "object",
              "required": ["enabled"],
              "properties": {
                "enabled": {
                  "const": true
                }
              }
            }
          }
        },
        "then": {
          "properties": {
            "max_tool_calls": {
              "type": "null"
            },
            "reasoning": {
              "properties": {
                "summary": {
                  "type": "null"
                }
              }
            }
          }
        },
        "properties": {
          "model": {
            "type": "string",
            "const": "gpt-6.2-astra"
          },
          "stream": {
            "type": ["boolean", "null"]
          },
          "store": {
            "type": ["boolean", "null"]
          },
          "metadata": {
            "type": ["object", "null"],
            "maxProperties": 16,
            "propertyNames": {
              "maxLength": 64
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 512
            }
          },
          "prompt_cache_key": {
            "type": ["string", "null"]
          },
          "moderation": {
            "type": ["object", "null"]
          },
          "user": {
            "type": ["string", "null"]
          },
          "multi_agent": {
            "type": ["object", "null"],
            "description": "Server-hosted delegation on Responses. Each agent uses the request model and tools. Inspect root final_answer messages for the final text.",
            "additionalProperties": false,
            "required": ["enabled"],
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "max_concurrent_subagents": {
                "type": "integer",
                "minimum": 1,
                "default": 3
              }
            }
          },
          "input": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            ]
          },
          "instructions": {
            "type": ["string", "null"]
          },
          "background": {
            "type": ["boolean", "null"],
            "enum": [false, null],
            "default": false,
            "description": "This connection supports synchronous and streaming Responses. Background execution is unavailable."
          },
          "max_output_tokens": {
            "type": ["integer", "null"],
            "maximum": 128000,
            "minimum": 16
          },
          "reasoning": {
            "type": ["object", "null"],
            "properties": {
              "effort": {
                "type": ["string", "null"],
                "enum": ["low", "medium", "high", "xhigh", "max", null]
              },
              "summary": {
                "enum": ["auto", "concise", "detailed", null]
              },
              "mode": {
                "enum": ["standard", "pro"]
              },
              "context": {
                "enum": ["auto", "current_turn", "all_turns", null]
              }
            }
          },
          "text": {
            "type": "object",
            "properties": {
              "verbosity": {
                "type": ["string", "null"],
                "enum": ["low", "medium", "high", null]
              },
              "format": {
                "oneOf": [
                  {
                    "type": "object",
                    "required": ["type"],
                    "properties": {
                      "type": {
                        "const": "text"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": ["type"],
                    "properties": {
                      "type": {
                        "const": "json_object"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": ["type", "name", "schema"],
                    "properties": {
                      "type": {
                        "const": "json_schema"
                      },
                      "name": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$"
                      },
                      "schema": {
                        "type": "object",
                        "additionalProperties": true
                      },
                      "description": {
                        "type": "string"
                      },
                      "strict": {
                        "type": ["boolean", "null"]
                      }
                    }
                  }
                ]
              }
            }
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "tool_choice": {
            "oneOf": [
              {
                "enum": ["none", "auto", "required"]
              },
              {
                "type": "object",
                "additionalProperties": true
              }
            ]
          },
          "parallel_tool_calls": {
            "type": ["boolean", "null"]
          },
          "max_tool_calls": {
            "type": ["integer", "null"],
            "minimum": 0
          },
          "include": {
            "type": ["array", "null"],
            "items": {
              "type": "string",
              "not": {
                "const": "message.output_text.logprobs"
              }
            }
          },
          "previous_response_id": {
            "type": ["string", "null"]
          },
          "conversation": {
            "oneOf": [
              {
                "type": ["string", "null"]
              },
              {
                "type": "object",
                "additionalProperties": true,
                "required": ["id"],
                "properties": {
                  "id": {
                    "type": "string"
                  }
                }
              }
            ]
          },
          "context_management": {
            "type": ["array", "null"],
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "prompt": {
            "type": ["object", "null"],
            "required": ["id"],
            "properties": {
              "id": {
                "type": "string"
              }
            }
          },
          "prompt_cache_options": {
            "type": "object",
            "properties": {
              "ttl": {
                "enum": ["30m", "12h"]
              },
              "mode": {
                "enum": ["implicit", "explicit"]
              },
              "comparison_response_id": {
                "type": ["string", "null"]
              },
              "prewarm": {
                "type": ["boolean", "null"]
              }
            }
          },
          "truncation": {
            "enum": ["auto", "disabled", null]
          }
        }
      },
      "Error": {
        "type": "object",
        "required": ["code", "message"],
        "properties": {
          "code": {
            "type": "integer",
            "enum": [
              10001, 10002, 20001, 20002, 30001, 30002, 50001, 50002, 50003,
              60001, 60002, 60003, 60004, 90001
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
