Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Crynux Bridge

How to Start a Crynux Bridge Locally

Crynux Bridge is middleware that connects applications to the Crynux Network. It owns the application wallet, signs Relay and blockchain requests, runs the full task lifecycle, and exposes asynchronous Raw Task and Batch Task HTTP APIs. The application sends task parameters and polls for results; it does not sign Relay requests or submit on-chain transactions itself.

Self-hosting Crynux Bridge is an advanced option. For most applications, Crynux AS is easier: it manages Credits, project API keys, and pricing, and it provides OpenAI-compatible LLM and Image APIs as well as an AS-facing Raw Task API. Prefer Crynux AS unless you need to run your own Bridge and control wallet, fees, and task lifecycle directly.

Features

  1. Automatic VSS task validation — When VRF selects multi-node validation for a task, Bridge creates the extra validation members, waits until the group is ready, and submits single-task or group validation to Relay. The application only creates the task and polls for the result; it does not implement validation-group logic.

  2. Repeat tasks for higher success rate and faster completion — Bridge can run multiple concurrent primary submissions for one logical task (task.repeat_num in Bridge config). The first successful result wins. This is Bridge configuration, not an API parameter.

  3. Wallet and Relay fee management — Bridge loads the application wallet and signs Relay and chain operations on its behalf.

  4. Raw Task API and Batch Task API — Create one task or up to 100 tasks per request, poll status (including batch status), and download image PNG or LLM JSON results.

  5. Multi-user support and Role-Based Access Control (RBAC) — API keys with roles, use quotas, and rate limits so multiple clients can share one Bridge instance with controlled access.

Prefer Crynux AS for most applications

Deploying your own Bridge means operating Docker, a database, a funded application wallet / Relay Account, API keys, and Bridge configuration (including optional repeat tasks). That is more complex than using the hosted Crynux AS service.

Use Crynux AS when you want:

  • OpenAI-compatible Chat Completions, Completions, Responses, and Image APIs

  • Credits-based billing and project Cost Level without setting task_fee yourself

  • A managed Raw Task API under /api/<endpoint_token>/v1/inference_tasks

Use a self-hosted Bridge when you need direct control over the wallet, Relay fees, repeat-task settings, or the Bridge Raw / Batch APIs without going through Crynux AS.

For OpenAI-compatible usage, see:

How to Run LLM using Crynux NetworkOpenAI-Compatible Image API

Raw Task API and Batch Task API

Bridge exposes asynchronous task APIs under /v1. Authenticate with Authorization: Bearer <api_key>.

Operation
Method and path

Create one task

POST /v1/inference_tasks

Create up to 100 tasks

POST /v1/inference_tasks/batch

Get status

GET /v1/inference_tasks/<client_task_id>

Batch status

POST /v1/inference_tasks/batch/status

Download image PNG

GET /v1/inference_tasks/<client_task_id>/images/<index>

Download LLM JSON

GET /v1/inference_tasks/<client_task_id>/llm

Create fields

Field
Required
Notes

task_type

Yes

0 Image (SD), 1 LLM

task_args

Yes

JSON string of ImageTaskArgs or GPTTaskArgs

task_fee

Yes

Final task fee in Wei as a decimal string

min_vram

No

Minimum GPU VRAM in GB

required_gpu + required_gpu_vram

No

Exact GPU selection; provide both together

queue_timeout

No

Queue wait budget in seconds for ordinary Image and LLM tasks

Create returns immediately with a client task id and phase queued. Poll until status is success or failed, then download the result.

Task argument schemas are documented in:

Text-to-Image TaskText-to-Text Task

Create, poll, and download

Batch create and batch status

Start a Crynux Bridge Locally

1. Get the Docker Compose files

The Docker Compose files are located in the build folder of the Crynux Bridge project:

Download the folder to the deployment server, or clone the whole project:

2. Application wallet configuration

The application wallet's private key will be loaded from a file in the build folder and stored as Docker secrets. For security, this file can be deleted once the container is created. Ensure to back up the private key, as it will be required again if the container needs to be recreated.

When Crynux Bridge runs tasks, Relay deducts task fees from the wallet's Relay Account balance instead of charging the wallet through on-chain transactions. The wallet is still required for Bridge startup and signing operations, but the wallet itself can have zero token balance as long as its corresponding Relay Account is funded in advance.

To deposit into the Relay Account before starting production traffic:

  1. Open the Crynux Portal.

  2. Connect the same wallet you will use as the Bridge application wallet.

  3. Go to the wallet dashboard and locate the Relay Account section.

  4. Click Deposit, enter the amount, and confirm the on-chain transaction in your wallet.

Create a file named privkey.txt and paste the private key into the file. The private key should be a hex string prefixed with 0x.

3. Database configuration

Crynux Bridge relies on a database to store data. A MySQL instance is configured in the Docker Compose file by default.

If the default configuration meets your needs, no further action is required. If you need to use another database instance, remove the service section of MySQL in the docker-compose.yml file, and modify config/config.yml to use another database instance:

4. Start the Docker container

In the build folder, run the following command to start the containers:

5. API keys and rate limits configuration

Once the Docker container is started, find the correct IP address of the Docker container. It is either 127.0.0.1, or an IP address on your Docker network.

Open the following URL in your web browser:

You should see a webpage like this:

Enter your local Crynux Bridge IP address and port (default is 5028), along with the private key from step 2. Choose the role and set limits as needed. Click "Create Access Token" to generate and display the token on the page.

6. Use the APIs

Use the Raw Task and Batch Task examples above with your Bridge base URL (for example http://127.0.0.1:5028/v1) and the API key from step 5.

API List

The description of the APIs can be accessed as the OpenAPI Specification on the started Crynux Bridge instance. Assume the IP address of the instance is 192.168.1.2, the JSON schema of the specification can be accessed at:

And a human readable documentation can be accessed at:

Last updated