Integrate via React
SnippetAI is a React package designed to simplify generating code samples directly from OpenAPI specifications, enabling developers to rapidly prototype and integrate APIs into their applications.
Installation
To install SnippetAI in a React project, install it using the package manager of choice:
Usage
After installation, import and utilize SnippetAI in React components. An active publishing token is required. Generate one in the settings page for the organization.
import { SnippetAI } from "@speakeasy-api/snippet-ai-react";
 
function MyComponent() {
  return <SnippetAI codeLang="typescript" publishingToken="PUBLISHING_TOKEN" />;
}
 
export default MyComponent;Supported Languages
SnippetAI currently supports code generation for the following languages:
Props
The SnippetAI component accepts the following props:
Language Selection
If a codeLang prop is not provided, a dropdown will be displayed to select the target language for the generated snippets.

Last updated on