API Documentation
MORDIEM exposes a full OpenAI-compatible API — chat, embeddings, images, audio, and video. Point any OpenAI-compatible client at https://api.mordiem.com/api/v1 with your MORDIEM API key and you’re good to go.
Requests are routed across upstream providers automatically; endpoint request/response schemas follow the upstream API reference for every model on the exchange.
Quick Start
curl https://api.mordiem.com/api/v1/chat/completions \
-H "Authorization: Bearer mr_sk_..." \
-H "Content-Type: application/json" \
-d '{"model":"llama-3.3-70b","messages":[{"role":"user","content":"Hello!"}]}'
Authentication
Mordiem uses two types of API keys, both passed as Bearer tokens in the Authorization header. Generate keys on the API Keys page.
| Key Type | Prefix | Purpose |
|---|---|---|
| Compute API Key | mr_sk_... | Inference requests (/api/v1/chat/completions, etc.) |
| Account Admin Key | mr_ak_... | Account management (/api/v1/account/*) |
Keys are shown once at creation; store them securely. Admin keys cannot be used for inference and Compute keys cannot access account management endpoints.
Base URL
| Environment | Base URL |
|---|---|
| Web dashboard | https://mordiem.com |
| API (programmatic) | https://api.mordiem.com/api/v1 |
Mordiem-Specific Endpoints
These endpoints are unique to Mordiem and not part of the Venice API.
GET/api/v1/models
Returns all active models on the Morpheus marketplace with Mordiem-specific pricing fields.
Response includes standard OpenAI model fields plus:
| Field | Type | Description |
|---|---|---|
morpheus_model_id | string | On-chain Morpheus model identifier (bytes32) |
mor_wei_per_token | string | Price per token in MOR wei (uint256 decimal string) |
Venice Pass-Through Endpoints
All /api/v1/* paths are forwarded directly to Venice with identical request/response schemas. Mordiem transparently:
- Swaps your API key for an eligible Venice key
- Opens a Morpheus compute session on first use per model
- Meters token usage against your daily MOR credits
- Streams SSE responses through unchanged
Supported endpoint families:
POST/api/v1/chat/completions
Generate chat completions. Supports streaming, multimodal inputs (text, images, audio, video, files), and reasoning models. Metered by input + output tokens.
Venice docs: Chat Completions
POST/api/v1/image/generate
Generate images from text prompts. Supports multiple models, style presets, aspect ratios, and resolution tiers. Also available via the OpenAI-compatible /api/v1/images/generations endpoint.
Venice docs: Image Generation
POST/api/v1/embeddings
Generate vector embeddings for text inputs. Metered by total tokens.
Venice docs: Embeddings
ANY/api/v1/*
All other Venice endpoints (audio, files, fine-tuning, etc.) are forwarded through. Endpoints without token-based pricing in the Morpheus registry are passed through without metering.
Full Venice API reference: docs.venice.ai/api-reference
Account Admin API
These endpoints are authenticated with an Account Admin Key (prefix mr_ak_...). Admin keys grant access to account management but cannot be used for inference. Generate admin keys on the API Keys page.
GET/api/v1/account
Returns a summary of your account: seller earnings, staking rewards, DIEM/MOR balances, compute key count, and daily credit status.
| Field | Description |
|---|---|
sellerEarnings | Total and today's MOR earned from selling compute |
stakingRewards | Accrued staking rewards balance and rate |
stakedDiem | Current staked DIEM balance |
stakedMor | MDM capital MOR principal used for compute allocation. ledgerWei is leftover custodial stake still counted for credit until migrated. |
computeApiKeys | Number of active Compute API keys |
credits | Daily MOR credit allowance, used today, remaining, and refresh time |
GET/api/v1/account/usage
Today's API usage breakdown by Compute API key and by model.
| Field | Description |
|---|---|
byKey[] | Calls, tokens, MOR charged per Compute API key |
byModel[] | Calls, tokens, MOR charged per model |
GET/api/v1/account/keys
List all active (non-revoked) Compute API keys.
POST/api/v1/account/keys
Create a new Compute API key. The plaintext key is returned once in the response.
| Body | Type | Description |
|---|---|---|
label | string (optional) | Human-readable label for the key |
PATCH/api/v1/account/keys/:id
Pause, resume, or revoke a Compute API key.
| Body | Type | Description |
|---|---|---|
action | "pause" | "resume" | "revoke" | Action to perform on the key |
DELETE/api/v1/account/keys/:id
Permanently revoke a Compute API key (same as PATCH with action "revoke").
Metering & Daily Credits
API usage is metered against your daily MOR credits, calculated from MOR you deposited as MDM capital (plus any leftover ledger still pending migration). Credits refresh every day at midnight UTC. Staked MOR is never reduced by API usage. Deposit from Buy Inference or Sell Compute— the legacy treasury and builders subnets are closed.
| Endpoint Family | How Metered |
|---|---|
/chat/completions | (input_tokens × input_price) + (output_tokens × output_price) |
/embeddings | total_tokens × mor_per_token |
/image/generate, /images/* | Per image at model-specific rate |
| Everything else | Forwarded without charge |
Check your daily credit allowance, usage, and remaining credits on the Usage page.
Client Libraries
Since Mordiem is fully OpenAI-compatible, you can use any existing client library by changing the base URL:
Python (openai)
client = OpenAI(
api_key="mr_sk_...",
base_url="https://api.mordiem.com/api/v1",
)
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
JavaScript / TypeScript (openai)
const client = new OpenAI({
apiKey: "mr_sk_...",
baseURL: "https://api.mordiem.com/api/v1",
});
const res = await client.chat.completions.create({
model: "llama-3.3-70b",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(res.choices[0].message.content);
cURL
-H "Authorization: Bearer mr_sk_..." \
-H "Content-Type: application/json" \
-d '{ "model": "llama-3.3-70b", "messages": [{"role": "user", "content": "Hello!"}], "stream": true }'
Errors
| Status | Meaning |
|---|---|
| 401 | Invalid or missing API key |
| 429 | Daily credits exhausted — deposit more MOR or wait until midnight UTC |
| 4xx / 5xx | Upstream Venice error (passed through as-is) |
Mordiem mirrors the full Venice API. For detailed request/response schemas and model capabilities, see the Venice API Reference.