From 7641f273621c842c87fa46b13a23389204bb4e1c Mon Sep 17 00:00:00 2001 From: Madeline Murray Date: Fri, 28 Nov 2025 17:50:11 +1000 Subject: [PATCH 1/6] Adding swagger for EigenAI API --- package-lock.json | 19 ++++- package.json | 3 +- src/pages/api.jsx | 19 +++++ static/openapi.yaml | 171 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 210 insertions(+), 2 deletions(-) create mode 100644 src/pages/api.jsx create mode 100644 static/openapi.yaml diff --git a/package-lock.json b/package-lock.json index be2ec0d8..5b26a6af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,8 @@ "rehype-katex": "^7.0.0", "remark-gfm": "^4.0.0", "remark-math": "^6.0.0", - "repomix": "^0.3.6" + "repomix": "^0.3.6", + "swagger-ui-dist": "^5.30.3" }, "devDependencies": { "@docusaurus/eslint-plugin": "^3.8.1", @@ -4770,6 +4771,13 @@ "integrity": "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==", "license": "MIT" }, + "node_modules/@scarf/scarf": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scarf/scarf/-/scarf-1.4.0.tgz", + "integrity": "sha512-xxeapPiUXdZAE3che6f3xogoJPeZgig6omHEy1rIY5WVsB3H2BHNnZH+gHG6x91SCWyQCzWGsuL2Hh3ClO5/qQ==", + "hasInstallScript": true, + "license": "Apache-2.0" + }, "node_modules/@secretlint/core": { "version": "9.3.4", "resolved": "https://registry.npmjs.org/@secretlint/core/-/core-9.3.4.tgz", @@ -18815,6 +18823,15 @@ "url": "https://opencollective.com/svgo" } }, + "node_modules/swagger-ui-dist": { + "version": "5.30.3", + "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-5.30.3.tgz", + "integrity": "sha512-giQl7/ToPxCqnUAx2wpnSnDNGZtGzw1LyUw6ZitIpTmdrvpxKFY/94v1hihm0zYNpgp1/VY0jTDk//R0BBgnRQ==", + "license": "Apache-2.0", + "dependencies": { + "@scarf/scarf": "=1.4.0" + } + }, "node_modules/system-architecture": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/system-architecture/-/system-architecture-0.1.0.tgz", diff --git a/package.json b/package.json index b771c137..06be2033 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,8 @@ "rehype-katex": "^7.0.0", "remark-gfm": "^4.0.0", "remark-math": "^6.0.0", - "repomix": "^0.3.6" + "repomix": "^0.3.6", + "swagger-ui-dist": "^5.30.3" }, "devDependencies": { "@docusaurus/eslint-plugin": "^3.8.1", diff --git a/src/pages/api.jsx b/src/pages/api.jsx new file mode 100644 index 00000000..d9ff43a1 --- /dev/null +++ b/src/pages/api.jsx @@ -0,0 +1,19 @@ +import React, { useEffect } from "react"; +import SwaggerUI from "swagger-ui-dist/swagger-ui-es-bundle"; +import "swagger-ui-dist/swagger-ui.css"; + +export default function ApiDocs() { + useEffect(() => { + SwaggerUI({ + dom_id: "#swagger-container", + url: "/openapi.yaml", + deepLinking: true, + }); + }, []); + + return ( +
+
+
+ ); +} diff --git a/static/openapi.yaml b/static/openapi.yaml new file mode 100644 index 00000000..33782edd --- /dev/null +++ b/static/openapi.yaml @@ -0,0 +1,171 @@ +openapi: 3.1.0 +info: + title: EigenAI Chat API + version: 1.0.0 + description: Chat completion API for EigenAI. + +servers: + - url: https://api.eigencloud.xyz + +paths: + /chat: + post: + summary: Create a chat completion + operationId: createChatCompletion + description: Generates a model response for a given chat conversation. + + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + + model: + type: string + description: > + Model ID used to generate the response, e.g. `gpt-oss-120b-f16`. + + messages: + type: array + description: A list of messages representing the conversation so far. + items: + type: object + properties: + role: + type: string + enum: [system, user, assistant, tool] + content: + type: string + + max_tokens: + type: integer + nullable: true + description: > + Optional. Maximum number of tokens to generate. + + seed: + type: integer + nullable: true + description: > + Optional. If provided, inference becomes deterministic for repeated (seed + params). + + stream: + type: boolean + nullable: true + description: > + Optional. If true, response is streamed using Server-Sent Events (SSE). + + temperature: + type: number + format: float + nullable: true + description: > + Optional. Sampling temperature between 0 and 2. + + top_p: + type: number + format: float + nullable: true + description: > + Optional. Nucleus sampling threshold (top-p). + + logprobs: + type: boolean + nullable: true + description: > + Optional. If true, includes token-level log probabilities in the response. + + frequency_penalty: + type: number + format: float + nullable: true + description: > + Optional. Number between -2.0 and 2.0 penalizing token repetition frequency. + + presence_penalty: + type: number + format: float + nullable: true + description: > + Optional. Number between -2.0 and 2.0 penalizing previously seen tokens. + + tools: + type: array + description: A list of tools the model may call. + items: + type: object + properties: + type: + type: string + enum: [function] + function: + type: object + properties: + name: + type: string + description: Name of the function. + description: + type: string + parameters: + type: object + description: JSON schema of function parameters. + + tool_choice: + description: > + Optional. Controls how the model uses tools. + - `none`: never call tools + - `auto`: model decides (default if tools exist) + - `required`: must call tools + - or specify a particular function + oneOf: + - type: string + enum: [none, auto, required] + - type: object + properties: + type: + type: string + enum: [function] + function: + type: object + properties: + name: + type: string + + required: + - model + - messages + + responses: + "200": + description: Successful completion response. + content: + application/json: + schema: + type: object + properties: + id: + type: string + object: + type: string + created: + type: integer + model: + type: string + choices: + type: array + items: + type: object + properties: + index: + type: integer + message: + type: object + properties: + role: + type: string + content: + type: string + finish_reason: + type: string \ No newline at end of file From 139b49d37fb40a851a06b7b5a4fd5d6b5da8d5ce Mon Sep 17 00:00:00 2001 From: Madeline Murray Date: Tue, 9 Dec 2025 19:33:32 +1000 Subject: [PATCH 2/6] wip --- docs/eigenai/reference/eigenai-api.md | 6 ++++++ static/openapi.yaml | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 docs/eigenai/reference/eigenai-api.md diff --git a/docs/eigenai/reference/eigenai-api.md b/docs/eigenai/reference/eigenai-api.md new file mode 100644 index 00000000..362e2c3c --- /dev/null +++ b/docs/eigenai/reference/eigenai-api.md @@ -0,0 +1,6 @@ +--- +title: EigenAI API +sidebar_position: 1 +--- + +Refer to the [swagger documentation for the EigenAI API](https://docs.eigencloud.xyz/api). diff --git a/static/openapi.yaml b/static/openapi.yaml index 33782edd..4e3c6edf 100644 --- a/static/openapi.yaml +++ b/static/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.1.0 info: title: EigenAI Chat API - version: 1.0.0 + version: 0.0.1 description: Chat completion API for EigenAI. servers: @@ -139,7 +139,7 @@ paths: responses: "200": - description: Successful completion response. + description: Successful completion response. The response includes a cryptographic signature field that proves the response was generated by the EigenAI Operator (see [Verify Signature](https://docs.eigencloud.xyz/eigenai/howto/verify-signature) for more information). content: application/json: schema: @@ -168,4 +168,6 @@ paths: content: type: string finish_reason: - type: string \ No newline at end of file + type: string + signature: + type: string \ No newline at end of file From 94b164a98a25c19e84ba4344f101eafd4008e08a Mon Sep 17 00:00:00 2001 From: Madeline Murray Date: Tue, 9 Dec 2025 20:55:46 +1000 Subject: [PATCH 3/6] Add swagger docs for EigenAI API --- docs/eigenai/howto/use-eigenai.mdx | 36 +++++------------------------- docusaurus.config.js | 4 ---- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/docs/eigenai/howto/use-eigenai.mdx b/docs/eigenai/howto/use-eigenai.mdx index 5384e328..2332cbbc 100644 --- a/docs/eigenai/howto/use-eigenai.mdx +++ b/docs/eigenai/howto/use-eigenai.mdx @@ -12,7 +12,11 @@ See [Try EigenAI](../try-eigenai.md#get-started-for-free) for information on obt We're starting off with supporting the `gpt-oss-120b-f16` and `qwen3-32b-128k-bf16` models based on initial demand and expanding from there. To get started or request another model, visit our [onboarding page](https://onboarding.eigencloud.xyz/). -## Chat Completions API +## Chat Completions API Reference + +Refer to the [swagger documentation for the EigenAI API](https://docs.eigencloud.xyz/api). + +## Chat Completions API Examples @@ -233,33 +237,3 @@ We're starting off with supporting the `gpt-oss-120b-f16` and `qwen3-32b-128k-bf -## Supported parameters - -This list will be expanding to cover the full parameter set of the Chat Completions API. - -- `messages: array` - - A list of messages comprising the conversation so far -- `model: string` - - Model ID used to generate the response, like `gpt-oss-120b-f16` -- `max_tokens: (optional) integer` - - The maximum number of [tokens](https://platform.openai.com/tokenizer) that can be generated in the chat completion. This value can be used to control [costs](https://openai.com/api/pricing/) for text generated via API. -- `seed: (optional) integer` - - If specified, our system will run the inference deterministically, such that repeated requests with the same `seed` and parameters should return the same result. -- `stream: (optional) bool` - - If set to true, the model response data will be streamed to the client as it is generated using Server-Side Events (SSE). -- `temperature: (optional) number` - - What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. -- `top_p: (optional) number` - - An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. -- `logprobs: (optional) bool` - - Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message` -- `frequency_penalty: (optional) number` - - Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. -- `presence_penalty: (optional) number` - - Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. -- `tools: array` - - A list of tools ([function tools](https://platform.openai.com/docs/guides/function-calling)) the model may call. -- `tool_choice: (optional) string` - - “auto”, “required”, “none” - - Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. - - `none` is the default when no tools are present. `auto` is the default if tools are present. diff --git a/docusaurus.config.js b/docusaurus.config.js index 799d9a1c..cb28022d 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -402,10 +402,6 @@ const redirects = [ }, //External references - { - from: '/api', - to: '/eigenlayer/reference/apis-and-dashboards' - }, { from: '/developers/slashing-background', to: '/eigenlayer/developers/concepts/slashing/slashing-concept-developers' From eaa3d1b6111b0f2bfd3db773b027f3dfbbaa9e3f Mon Sep 17 00:00:00 2001 From: Madeline Murray Date: Wed, 10 Dec 2025 12:01:42 +1000 Subject: [PATCH 4/6] Updated version --- static/openapi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/openapi.yaml b/static/openapi.yaml index 4e3c6edf..91554a07 100644 --- a/static/openapi.yaml +++ b/static/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.1.0 info: title: EigenAI Chat API - version: 0.0.1 + version: 0.1.0 description: Chat completion API for EigenAI. servers: From e41506ef9252e12af337cd2dd96c008ef69c6188 Mon Sep 17 00:00:00 2001 From: Madeline Murray Date: Wed, 10 Dec 2025 13:31:13 +1000 Subject: [PATCH 5/6] Added disable_auto_reasoning_format --- static/openapi.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/static/openapi.yaml b/static/openapi.yaml index 91554a07..8faa4ec7 100644 --- a/static/openapi.yaml +++ b/static/openapi.yaml @@ -39,6 +39,11 @@ paths: content: type: string + disable_auto_reasoning_format: + type: boolean + description: > + Controls response parsing and separating out of the reasoning from the content of the response. For client calls, this is a custom parameter. Refer to the relevant client SDK documentation for information on how to set this parameter. + max_tokens: type: integer nullable: true From 075bb311caf16fe98aa89f595daefa7eb306b8dd Mon Sep 17 00:00:00 2001 From: Madeline Murray Date: Wed, 10 Dec 2025 13:38:20 +1000 Subject: [PATCH 6/6] review rework --- static/openapi.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/openapi.yaml b/static/openapi.yaml index 8faa4ec7..c371c242 100644 --- a/static/openapi.yaml +++ b/static/openapi.yaml @@ -42,8 +42,8 @@ paths: disable_auto_reasoning_format: type: boolean description: > - Controls response parsing and separating out of the reasoning from the content of the response. For client calls, this is a custom parameter. Refer to the relevant client SDK documentation for information on how to set this parameter. - + Controls response parsing and separating out the reasoning trace from the content of the response. For client calls, this is a custom parameter. For example, in the OpenAI client, it's set in the `extra_body` field. Refer to the relevant client SDK documentation for information on how to set this parameter. + max_tokens: type: integer nullable: true