Run SDK
OpenAI-compatible inference (chat completions) and model listingOperations
| Method | Description |
|---|---|
inference | Run inference (optionally streaming via SSE) |
chatCompletions | OpenAI-compatible chat completions |
Generated Reference
Overview
OpenAI-compatible inference (chat completions) and model listingAvailable Operations
- inference - Run inference (optionally streaming via SSE)
- chatCompletions - OpenAI-compatible chat completions
inference
Execute inference through the LucidLayer execution gateway. Supports both streaming (SSE) and non-streaming responses. A cryptographic receipt is generated for each successful inference.Example Usage
Standalone function
The standalone function version of this method:Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | models.InferenceRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.InferenceResult>Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorResponse | 422 | application/json |
| errors.ErrorResponse | 500, 503 | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX | */* |
chatCompletions
x402-gated with dynamic pricing. IfX402_ENABLED=true, requests without
a valid X-Payment-Proof header receive HTTP 402 with payment instructions.
Pricing is resolved per-model from the asset_pricing table.
Example Usage
Standalone function
The standalone function version of this method:Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.LucidChatCompletionsRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.ChatCompletionResponse>Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorResponse | 400 | application/json |
| errors.X402PaymentRequiredError | 402 | application/json |
| errors.ErrorResponse | 500 | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX | */* |
.png?fit=max&auto=format&n=VsjUqn6fLqEhBiuI&q=85&s=8b4c7e6431e9a6af1ef23b77bb4ff5fd)
.png?fit=max&auto=format&n=VsjUqn6fLqEhBiuI&q=85&s=d5651a45e4bfbabc33f74e146af3f94a)