管理员

GET /core/v1/admin/requests/{id}

按请求快照查询渠道、凭据版本和原价格

身份要求

管理员. 会话/管理写操作不在公共 Playground 执行。

接口

curl --request GET 'https://api.oneaster.ai/core/v1/admin/requests/00000000-0000-4000-8000-000000000001' \
  --header 'Authorization: Bearer '"$ONEASTER_SESSION_TOKEN"

参数

- id (path, 必填): {"type":"string","format":"uuid"}

响应

200

按请求快照查询渠道、凭据版本和原价格

{
  "application/json": {
    "schema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string",
              "format": "uuid"
            },
            "model": {
              "type": "string"
            },
            "state": {
              "enum": [
                "reserved",
                "forwarding",
                "completed",
                "unknown",
                "rejected"
              ]
            },
            "billing_state": {
              "enum": [
                "reserved",
                "settled",
                "released"
              ]
            },
            "reservation_micro": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "description": "整数账务单位;1 积分 = 10000 单位,1 USD = 100 积分。前端用 BigInt。"
            },
            "charge_micro": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^[0-9]+$",
                  "description": "整数账务单位;1 积分 = 10000 单位,1 USD = 100 积分。前端用 BigInt。"
                },
                {
                  "type": "null"
                }
              ]
            },
            "prompt_tokens": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^[0-9]+$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "completion_tokens": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^[0-9]+$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "cache_read_tokens": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^[0-9]+$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "cache_creation_tokens": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^[0-9]+$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "price_version": {
              "type": "integer",
              "minimum": 0
            },
            "metering": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "mode": {
                  "enum": [
                    "model_limit",
                    "utf8_bytes",
                    "cl100k_base",
                    "o200k_base"
                  ]
                },
                "margin_bps": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 10000
                },
                "extra_tokens": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 65536
                }
              },
              "required": [
                "mode",
                "margin_bps",
                "extra_tokens"
              ]
            },
            "estimated_input_tokens": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0
                },
                {
                  "type": "null"
                }
              ]
            },
            "reserved_input_tokens": {
              "type": "integer",
              "minimum": 0
            },
            "byte_fallback": {
              "type": "boolean"
            },
            "input_price_per_million": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "description": "整数账务单位;1 积分 = 10000 单位,1 USD = 100 积分。前端用 BigInt。"
            },
            "output_price_per_million": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "description": "整数账务单位;1 积分 = 10000 单位,1 USD = 100 积分。前端用 BigInt。"
            },
            "first_token_ms": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0
                },
                {
                  "type": "null"
                }
              ]
            },
            "duration_ms": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0
                },
                {
                  "type": "null"
                }
              ]
            },
            "error_code": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "stream": {
              "type": "boolean"
            },
            "created_at": {
              "type": "string",
              "format": "date-time"
            },
            "updated_at": {
              "type": "string",
              "format": "date-time"
            },
            "user_id": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "username": {
              "type": "string"
            },
            "key_id": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "key_name": {
              "type": "string"
            },
            "key_prefix": {
              "type": "string"
            },
            "model_id": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^[0-9]+$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "provider_id": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "provider_name": {
              "type": "string"
            },
            "upstream_model": {
              "type": "string"
            },
            "provider_base_url": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "provider_credential_version": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0
                },
                {
                  "type": "null"
                }
              ]
            },
            "channel_version": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0
                },
                {
                  "type": "null"
                }
              ]
            },
            "channel_type": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "channel_config": {
              "anyOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "base_url": {
                      "type": "string"
                    },
                    "models": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "model": {
                            "type": "string"
                          },
                          "upstream_model": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "model",
                          "upstream_model"
                        ]
                      }
                    },
                    "groups": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "priority": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "weight": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "tag": {
                      "type": "string"
                    },
                    "notes": {
                      "type": "string"
                    },
                    "auto_disable": {
                      "type": "boolean"
                    },
                    "options": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "headers": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "parameters": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      }
                    }
                  },
                  "required": [
                    "name",
                    "type",
                    "base_url",
                    "models",
                    "groups",
                    "priority",
                    "weight",
                    "tag",
                    "notes",
                    "auto_disable",
                    "options",
                    "headers",
                    "parameters"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "configuration_snapshot_complete": {
              "type": "boolean"
            },
            "input_limit": {
              "type": "integer",
              "minimum": 0
            },
            "output_limit": {
              "type": "integer",
              "minimum": 0
            },
            "reconciliation_ref": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "observed_usage": {
              "anyOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "prompt_tokens": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "completion_tokens": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "total_tokens": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "cache_read_tokens": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "cache_creation_tokens": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "required": [
                    "prompt_tokens",
                    "completion_tokens",
                    "total_tokens"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "upstream_http_status": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 100,
                  "maximum": 599
                },
                {
                  "type": "null"
                }
              ]
            },
            "upstream_request_id": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 200
                },
                {
                  "type": "null"
                }
              ]
            },
            "purpose": {
              "enum": [
                "generation",
                "channel_test"
              ]
            },
            "test_actor_id": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^[0-9]+$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "test_auth_version": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0
                },
                {
                  "type": "null"
                }
              ]
            },
            "test_maximum_charge_micro": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^[0-9]+$",
                  "description": "整数账务单位;1 积分 = 10000 单位,1 USD = 100 积分。前端用 BigInt。"
                },
                {
                  "type": "null"
                }
              ]
            },
            "test_reference": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "forwarded_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ]
            },
            "upstream_headers_ms": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0
                },
                {
                  "type": "null"
                }
              ]
            },
            "diagnostic": {
              "anyOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "phase": {
                      "enum": [
                        "connecting",
                        "waiting_headers",
                        "upstream_response",
                        "reading_response",
                        "streaming",
                        "settlement"
                      ]
                    },
                    "category": {
                      "enum": [
                        "authentication",
                        "rate_limit",
                        "provider_internal",
                        "model_unavailable",
                        "invalid_request",
                        "provider_unavailable",
                        "http_error",
                        "timeout",
                        "transport_error",
                        "client_cancelled",
                        "invalid_response",
                        "invalid_usage",
                        "stream_interrupted",
                        "settlement_failed",
                        "process_interrupted"
                      ]
                    },
                    "message": {
                      "type": "string",
                      "maxLength": 200
                    },
                    "provider_error_type": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 64
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "retry_after_seconds": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 86400
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "phase",
                    "category",
                    "message",
                    "provider_error_type",
                    "retry_after_seconds"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "id",
            "model",
            "state",
            "billing_state",
            "reservation_micro",
            "charge_micro",
            "prompt_tokens",
            "completion_tokens",
            "cache_read_tokens",
            "cache_creation_tokens",
            "price_version",
            "metering",
            "estimated_input_tokens",
            "reserved_input_tokens",
            "byte_fallback",
            "input_price_per_million",
            "output_price_per_million",
            "first_token_ms",
            "duration_ms",
            "error_code",
            "stream",
            "created_at",
            "updated_at",
            "user_id",
            "username",
            "key_id",
            "key_name",
            "key_prefix",
            "model_id",
            "provider_id",
            "provider_name",
            "upstream_model",
            "provider_base_url",
            "provider_credential_version",
            "channel_version",
            "channel_type",
            "channel_config",
            "configuration_snapshot_complete",
            "input_limit",
            "output_limit",
            "reconciliation_ref",
            "observed_usage",
            "upstream_http_status",
            "upstream_request_id",
            "purpose",
            "test_actor_id",
            "test_auth_version",
            "test_maximum_charge_micro",
            "test_reference",
            "forwarded_at",
            "upstream_headers_ms",
            "diagnostic"
          ]
        }
      },
      "required": [
        "success",
        "data"
      ]
    }
  }
}

default

错误代码见 core-api.md;供应商/数据库错误已隐藏。

{
  "application/json": {
    "schema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "success": {
          "const": false
        },
        "error": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "type": {
              "const": "oneaster_error"
            }
          },
          "required": [
            "code",
            "message",
            "type"
          ]
        },
        "data": {
          "type": "null"
        }
      },
      "required": [
        "success",
        "error",
        "data"
      ]
    }
  }
}