Architecture

Mesh API

Whatszara uses Mesh API as its single AI router — one endpoint, one API key, 1000+ models.

Overview

Mesh API (meshapi.ai) is a unified API gateway that provides access to 1000+ models from providers including OpenAI, Anthropic, Google, Groq, xAI, Meta, Mistral, DeepSeek, Cohere, and more — all through a single OpenAI-compatible endpoint.

The Mesh API Edition uses a single MeshApiProviderin llm.rs as the sole LLM provider.

1 Mesh API router → 1000+ models available through every feature

How It Works

Single Endpoint

All requests go to POST /v1/chat/completions on the configured Mesh API URL. The router handles provider selection and failover.

Model Selection

Pick any model from the live browser. The model ID is sent as the model field — Mesh API routes it to the correct provider.

BYOK Headers

If a model requires a provider-specific key, set it via x-mesh-* headers. Mesh API forwards the key to the upstream provider.

Model Browser

The Settings tab includes a live model browser that fetches all available models from Mesh API:

List Models

Fetches the flat JSON array from GET /v1/models. Each model entry includes:

  • id — unique model identifier
  • name — human-readable name
  • provider — upstream provider
  • capabilities — chat, vision, tools, etc.
  • pricing — per-token cost
  • context_window — max tokens

Model Details

Per-model details fetched from GET /v1/models/:id:

  • Full capability list
  • Pricing per 1K tokens (input/output)
  • Context window size
  • Provider and model type metadata
  • Displayed in a clean card layout

The first model in the fetched list is auto-selected as the active provider.

BYOK (Bring Your Own Key)

Some Mesh API models require provider-specific API keys. These are sent as HTTP headers on each request:

x-mesh-openai-key: sk-...
x-mesh-anthropic-key: sk-ant-...
x-mesh-groq-key: gsk-...
x-mesh-xai-key: ...
x-mesh-gemini-key: ...

Configure these alongside your Mesh API key in the Settings tab. All keys are persisted to the platform-native credential store via Save Config and restored on startup via Load Config.

Configuration

Endpoint

Enter the Mesh API URL in Settings → Endpoint. Default: https://meshapi.ai. Click Apply to save.

API Key

Your rsk_... key from meshapi.ai. Enter it in the Settings tab alongside optional BYOK headers.

Model Persistence

The selected model and all API keys are persisted via save_model_config /load_model_config in llm.rs. On startup, the last-used model is restored automatically. The config includes: endpoint URL, Mesh API key, selected model ID, and all BYOK headers.

Implementation

The Mesh API integration lives in src-tauri/src/llm.rs:

MeshApiProvider

  • Replaces 6 individual provider structs
  • OpenAI-compatible chat completions endpoint
  • BYOK header injection on every request
  • Model config persistence via keychain
  • Error handling with user-friendly messages

Key Functions

  • list_models() — GET /v1/models
  • get_model_details(id) — GET /v1/models/:id
  • save_model_config() — keychain persist
  • load_model_config() — keychain restore
  • send_conversation() — chat completions