amazonq2api / openapi_spec.json
liuzhao521
Update app.py and add model discovery tools
f12ea8b
{
"openapi": "3.1.0",
"info": {
"title": "v2 OpenAI-compatible Server (Amazon Q Backend)",
"version": "0.1.0"
},
"paths": {
"/v1/chat/completions": {
"post": {
"summary": "Chat Completions",
"description": "OpenAI-compatible chat endpoint.\n - stream default False\n - messages will be converted into \"{role}:\n{content}\" and injected into template\n - account is chosen randomly among enabled accounts (API key is for authorization only)",
"operationId": "chat_completions_v1_chat_completions_post",
"parameters": [
{
"name": "authorization",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Authorization"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ChatCompletionRequest"
}
}
}
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/v2/auth/start": {
"post": {
"summary": "Auth Start",
"description": "Start device authorization and return verification URL for user login.\nSession lifetime capped at 5 minutes on claim.",
"operationId": "auth_start_v2_auth_start_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AuthStartBody"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/v2/auth/status/{auth_id}": {
"get": {
"summary": "Auth Status",
"operationId": "auth_status_v2_auth_status__auth_id__get",
"parameters": [
{
"name": "auth_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Auth Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/v2/auth/claim/{auth_id}": {
"post": {
"summary": "Auth Claim",
"description": "Block up to 5 minutes to exchange the device code for tokens after user completed login.\nOn success, creates an enabled account and returns it.",
"operationId": "auth_claim_v2_auth_claim__auth_id__post",
"parameters": [
{
"name": "auth_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Auth Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/v2/accounts": {
"get": {
"summary": "List Accounts",
"operationId": "list_accounts_v2_accounts_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
},
"post": {
"summary": "Create Account",
"operationId": "create_account_v2_accounts_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccountCreate"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/v2/accounts/{account_id}": {
"get": {
"summary": "Get Account Detail",
"operationId": "get_account_detail_v2_accounts__account_id__get",
"parameters": [
{
"name": "account_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Account Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
},
"delete": {
"summary": "Delete Account",
"operationId": "delete_account_v2_accounts__account_id__delete",
"parameters": [
{
"name": "account_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Account Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
},
"patch": {
"summary": "Update Account",
"operationId": "update_account_v2_accounts__account_id__patch",
"parameters": [
{
"name": "account_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Account Id"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccountUpdate"
}
}
}
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/v2/accounts/{account_id}/refresh": {
"post": {
"summary": "Manual Refresh",
"operationId": "manual_refresh_v2_accounts__account_id__refresh_post",
"parameters": [
{
"name": "account_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Account Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/": {
"get": {
"summary": "Index",
"operationId": "index__get",
"responses": {
"200": {
"description": "Successful Response"
}
}
}
},
"/healthz": {
"get": {
"summary": "Health",
"operationId": "health_healthz_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
}
},
"components": {
"schemas": {
"AccountCreate": {
"properties": {
"label": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Label"
},
"clientId": {
"type": "string",
"title": "Clientid"
},
"clientSecret": {
"type": "string",
"title": "Clientsecret"
},
"refreshToken": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Refreshtoken"
},
"accessToken": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Accesstoken"
},
"other": {
"anyOf": [
{
"type": "object"
},
{
"type": "null"
}
],
"title": "Other"
},
"enabled": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Enabled",
"default": true
}
},
"type": "object",
"required": [
"clientId",
"clientSecret"
],
"title": "AccountCreate"
},
"AccountUpdate": {
"properties": {
"label": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Label"
},
"clientId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Clientid"
},
"clientSecret": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Clientsecret"
},
"refreshToken": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Refreshtoken"
},
"accessToken": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Accesstoken"
},
"other": {
"anyOf": [
{
"type": "object"
},
{
"type": "null"
}
],
"title": "Other"
},
"enabled": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Enabled"
}
},
"type": "object",
"title": "AccountUpdate"
},
"AuthStartBody": {
"properties": {
"label": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Label"
},
"enabled": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Enabled",
"default": true
}
},
"type": "object",
"title": "AuthStartBody"
},
"ChatCompletionRequest": {
"properties": {
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Model"
},
"messages": {
"items": {
"$ref": "#/components/schemas/ChatMessage"
},
"type": "array",
"title": "Messages"
},
"stream": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Stream",
"default": false
}
},
"type": "object",
"required": [
"messages"
],
"title": "ChatCompletionRequest"
},
"ChatMessage": {
"properties": {
"role": {
"type": "string",
"title": "Role"
},
"content": {
"title": "Content"
}
},
"type": "object",
"required": [
"role",
"content"
],
"title": "ChatMessage"
},
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
},
"ValidationError": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
}
}
}
}