CHIMERA API

The CHIMERA API powers the game engine and neural network agent inference system. It supports game state management, environment stepping, and ONNX-based policy inference.


Request Format

All API requests use base64-encoded JSON.

Example:


# raw JSON
{"dealer": 3}

# encoded
eyJkZWFsZXIiOiAzfQ==
    

Responses are also base64-encoded JSON.


Endpoints

1. Start Game

POST /api/start-game

Initializes a new betting game.


Request:
{ "dealer": 2 }

Response:
(base64 encoded game state)
    

2. Get Observation

POST /api/get-obs

Returns the current observation from either:


Request:
Current environment state (base64 encoded)

Response (before base64 encoding):
{
    "hand": [...],
    "legal_actions": [...],
    ...
}
    

3. Play Action

POST /api/play-action

Advances the environment by applying a selected action. Handles both betting and main game transitions.


Request:
Current environment state (base64 encoded)

Response:
Updated environment state (base64 encoded)
    

4. Chimera Agent Action

POST /api/chimera-action

Queries the trained ONNX policy network to select an action.

Pipeline:


Observation → Feature Builder → ONNX Model → Action → Environment
    

Internally, inference is performed using ONNX Runtime for low-latency execution.


Request:
Current environment state (base64 encoded)

Response (before base64 encoding):
[action index or indices]
    

5. Declare Trump

POST /api/declare-trump

Finalizes trump selection during the betting phase and advances the game state.


Request:
{ "declared_trump": 1 }
within the betting environment context

Response:
Updated environment state (base64 encoded)
    

System Overview

The API acts as a bridge between:

Two separate models are used: