DLX Documentation

repository·main·Indexed 27 days ago

https://github.com/owo-network/dlx

A self-hosted translation API server written in Go. DLX provides a simple HTTP interface on port 1188 for translation services and can be deployed via Docker, Docker Compose, or as a pre-compiled binary.

Tokens
472
Snippets
3
Records
5
Agent score
44%

What's inside DLX

  1. Run the DLX service

    main
    DLX is a service that runs a web server using the Gin framework. When executed, it initializes configuration via service.InitConfig(), sets the Gin mode to ReleaseMode, and starts a router instance created by service.Router(cfg). The service listens on the IP and Port specified in the configuration.
  2. Translate text via the HTTP API

    main

    DLX exposes a simple HTTP API on port 1188. To perform a translation, send a POST request to the /translate endpoint with a JSON body containing the text, source language, and target language.

    curl -X POST http://localhost:1188/translate \
      -H "Content-Type: application/json" \
      -d '{"text": "Hello, world!", "source_lang": "EN", "target_lang": "ZH"}'
  3. Configure DLX via Docker Compose environment variables

    main

    When running DLX using Docker Compose, you can provide authentication and session credentials using the following environment variables:

    • TOKEN: A security token used for authentication (e.g., helloworld).
    • DL_SESSION: The session identifier required for operation (e.g., xxxxxx).
    services:
      dlx:
        image: ghcr.io/owo-network/dlx:latest
        restart: always
        ports:
          - "1188:1188"
        environment:
          - TOKEN=helloworld
          - DL_SESSION=xxxxxx