Lingara Lingara 文档 学习指南 API 库 应用 构建 网页版
语言: 中文简体

获取本文档

API 版本 2026-10-affable-towhee

get https://api.getlingara.com/v1/openapi.json

以 JSON 形式返回此 API 描述,对应回应该请求所用的 API 版本:Lingara-Version 中指定的版本,否则为当前版本。无需令牌。

权限范围 无需身份验证

参数

Lingara-Versionheaderstring可选
回应此请求所用的 API 版本。不提供时,访问令牌使用其客户端绑定的版本,不带令牌的请求使用当前版本。仍在开发中的版本只能通过在此指定来访问。未知版本会以 400 回应,代码为 api_version_unknown。GET /v1/versions 会列出所有版本。

响应

200 OpenAPI 文档

错误

410application/json
回应此请求所用的 API 版本已停用。请在 Lingara-Version 中发送一个受支持的版本,或将客户端绑定到其他版本。
4XXapplication/json
请求被拒绝。code 说明原因,error 用文字描述原因。
503application/json · text/plain
服务暂时不可用;请在 Retry-After 所示的秒数之后重试。维护期间,响应体为纯文本,而不是错误信封。
codestring必填

请求被拒绝的原因,以稳定的代码表示,可据此进行分支处理:例如 insufficient_scope(403)、rate_limited(429),以及按用量计费的客户端的 spend_cap_reached(402)和 metered_billing_inactive(402)。

errorstring必填

示例

代码示例语言

curl

curl "https://api.getlingara.com/v1/openapi.json"

TypeScript

const document = await client.getOpenApiDocument();
console.log(document.servedVersion, Object.keys(document));

Rust

let document = client.get_open_api_document().await?;
let keys: Vec<&String> = document.as_object().map(|o| o.keys().collect()).unwrap_or_default();
println!("{:?} {keys:?}", document.served_version());

Go

doc, err := client.GetOpenAPIDocument(ctx)
if err != nil {
	return err
}
fmt.Println(doc.Value["openapi"], doc.ServedVersion)

Java

import com.fasterxml.jackson.databind.JsonNode;
import com.getlingara.client.LingaraClient;

JsonNode document = client.getOpenApiDocument().body();
System.out.println(document.path("info").path("version").asText());

Kotlin

import com.getlingara.kotlin.LingaraClient
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive

val document = client.getOpenApiDocument().body
println(
    document
        .getValue("info")
        .jsonObject
        .getValue("version")
        .jsonPrimitive.content,
)

Ruby

document = client.get_open_api_document
puts "#{document.value["openapi"]} #{document.served_version}"

PHP

// Needs no token: a client built without credentials can call it.
$document = $client->getOpenApiDocument()->value;
echo $document->info->title, ' ', $document->info->version, "\n";

更喜欢用库?请参阅“库”部分。

如译文与英文参考文档不一致,以英文参考文档为准。