- Sign in with GitHub or Google in the editor.
- Open the API & Usage panel and issue a key (format: lena_sk_…).
- Copy it immediately — only a short display prefix is ever shown again.
Developer resources
Behind the workspace.
Explore the Lena language and Yana structure behind our code analysis platform, its support boundaries, and existing integration contracts.
The API and MCP use the direct-adapter engine. MCP conversion has runtime limitations.
Docs
Developer API guide
Issue a key in the editor, call the HTTP API, or connect your agent over MCP — one key, one shared quota, the same honest implementation-versus-semantic-evidence contract everywhere.
One key, two surfaces: the HTTP API and the MCP server expose the same registered direct-adapter conversion, with the same shared daily quota. Each fragment reports implementation separately from admissible semantic verification; exact-text regression establishes implementation only, and missing implementation is an honest gap.
Step 1
Get an API key
Keys are issued in the editor and shown exactly once — store yours in a secret manager. Rotating or revoking a key takes effect immediately on both the HTTP API and the MCP server.
Step 2
REST quickstart
POST your source to /api/v1/convert with the key in the x-lena-api-key header. The response separates registered implementation from semantic verification: read each fragment, status, and gaps before using text.
The full request/response contract — every status value, error shape, and field — is pinned in the OpenAPI document below. The response carries schemaVersion so future envelope changes are explicit, never silent.
/api/openapi.jsoncurl -X POST https://www.lenacode.com/api/v1/convert \
-H "x-lena-api-key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"sourceLanguage": "python",
"targetLanguage": "javascript",
"code": "def add(a, b):\n return a + b"
}'{
"schemaVersion": "1.1",
"ok": true, // true only for complete conversion
"status": "converted", // or: partial | no-implemented-route | ...
"sourceLanguage": "python",
"targetLanguage": "javascript",
"text": "...", // complete or honest partial assembly
"fragments": [ { "facetKey": "...", "text": "...", "implemented": true,
"semanticVerified": false, "verified": false } ], // verified is a deprecated semantic alias
"gaps": [ { "facetKey": "...", "reason": "...", "message": "..." } ],
"verification": { "inputLaw": "pass", "outputAdapters": "registered-direct-only", ... },
"requestId": "..."
}Read fragments and gaps for assembly completeness: fragments without gaps are complete, fragments with gaps are partial, and no fragments is none. These states do not establish semantic support. Each fragment exposes implemented and semanticVerified separately; the deprecated verified alias mirrors semanticVerified. Current transform receipts have no per-invocation semantic oracle, so both semantic fields fail closed to false. A partial result may have text null when no ordered assembly is available. Partial text keeps ok false, preserves each gap form in place as a target-language comment around its original source, and may not compile or run.
Step 3
Connect over MCP
The MCP server (streamable HTTP) gives agents the same conversion plus discovery tools. It is read/transform only: no tool edits files, applies patches, or executes code — applying results is always the caller’s decision.
Recommended call order: lena_list_languages → lena_check_route → lena_transform. Discovery tools are free; only submitting source code consumes the shared daily quota.
claude mcp add --transport http lena-code https://www.lenacode.com/api/mcp \
--header "Authorization: Bearer YOUR_KEY"{
"mcpServers": {
"lena-code": {
"url": "https://www.lenacode.com/api/mcp",
"headers": { "Authorization": "Bearer YOUR_KEY" }
}
}
}| Tool | Quota | What it does |
|---|---|---|
| lena_list_languages | Free | Canonical language ids, accepted aliases, input verified counts, output implemented counts, and output semantic-verified counts. Call this first — never guess ids. |
| lena_check_route | Free | Pre-flight for a source/target pair: implemented and semantic-verified atomic intersections without spending quota or source tokens. |
| lena_transform | Counts | The conversion itself. Read domain ok, status, each fragment's implemented and semanticVerified fields, gaps, and guidance. Current receipts have no per-invocation semantic oracle, so semanticVerified and verified fail closed to false. Partial text may preserve gap forms as comments and may not compile or run. An unassembled partial can keep text null. |
| lena_transform_batch | Counts | Multiple conversions in one call. Each item consumes quota individually, and any partial item may not compile or run. |
| lena_get_coverage | Free | Aggregate input verified coverage, legacy-inclusive output allocation, and separated output evidence indicators. |
| lena_get_language_coverage | Free | Input verified, output implemented, and output semantic-verified numbers for one language. |
Metering
Quotas & plans
API and MCP conversions draw from one shared daily pool per key. Editor conversions are metered separately. Quotas reset at UTC midnight.
Plans & pricing| Plan | API + MCP / day (shared) | Price |
|---|---|---|
| free | 25 | $0/mo |
| pro | 1,000 | $5/mo |
| max | 5,000 | $15/mo |
Per-request input limit: 256 KB UTF-8; binary content is rejected. Rate limiting applies on top of daily quotas — exceeded requests return 429 with a retry-after header.
Contract
Errors & limits
Errors are JSON with a stable code and a requestId you can quote to support. The same key and quota semantics apply on MCP — tool errors carry the equivalent reason.
- 401
- Missing, malformed, revoked, or rotated key.
- 429
- Rate limit or daily quota exceeded — the body says which, and retry-after says when.
- 400 / 413
- Invalid body, binary content, or input over the 256 KB limit.
- 503
- Entitlement state temporarily unavailable — the API refuses rather than guessing your plan. Retry shortly.
Submitted code is processed in memory for the request only. API and MCP conversions do not send it to model providers. Privacy details
For agents
Machine-readable resources
Agents can learn this surface without scraping HTML: the OpenAPI contract over HTTP, and MCP resources served by the server itself.
- /api/openapi.jsonfull HTTP contract (also served as the MCP resource lena://openapi)
- lena://usage-guideagent-directed guide served by the MCP server
- lena://health-publicpublic health snapshot
- /api/coverage/exposureseparated input verification, output implementation, and output semantic evidence; append /{languageId} for one language
- /llms.txtthis guide’s entry points, in plain text
Support boundaries, refusals and known limits
Before submitting code or applying a result, check the source language, target language and the constructs you need. A language in the selector does not mean every program in that language can be converted.
What is supported
Support is directional. Reading Python and producing JavaScript are separate capabilities; the reverse direction must be checked separately. In the editor, open the support manual beside the plan badge and inspect the selected pair and its language details. API and MCP users can list languages and check a pair before submitting code.
An atomic construct is one small feature, such as a literal, operator, call or declaration. Composition means combining features in a particular position, such as a call inside a declaration. An ordinary program also brings imports, libraries, files and runtime behavior. Success on a construct or a selected combination does not establish support for an arbitrary program.
Input counts cover checked source-language feature cases. Output implementation counts cover available output forms; execution-backed output counts cover separately tested cases. Each fraction uses its own stated unit and denominator. These are snapshots of measured cases, not the percentage of all programs that will work, and input and output percentages must not be blended.
The “Internal roundtrip verified” output count comes from re-reading generated target text and running it in an internal interpreter. It is not execution in every target language’s runtime. Separately displayed native-runtime checks cover only their named examples and environments and do not add to that fraction.
How to read a result
- Complete means the converter assembled the recognized parts without reported gaps. Even ok: true with status: converted does not mean this request was executed or its behavior proved correct. Current fragments report implemented separately from semanticVerified, which remains false for each request; verified is a deprecated alias of that field.
- A partial status means conversion is incomplete; it can contain some fragments or none. Read fragments and gaps even when text is null. When text is present, unconverted source may remain inside target-language comments. That text is not a finished program and must not be applied as-is.
- No output means no converted fragment is available. Inspect status and gaps. An input failure can mean invalid syntax, an incorrect language hint or an unsupported form; it does not prove the original program is invalid in its own language.
- HTTP 200 means a response arrived, not that conversion succeeded. Check the JSON ok and status fields. For MCP batches, also inspect every item’s result.ok, status and gaps; the batch or item wrapper can succeed while conversion fails.
Why a request can stop — and what to do
- Invalid or unreadable input
- E_BAD_REQUEST, E_BINARY or input-law-fail: send nonempty source text, remove NUL bytes, check JSON and specify the source language. Reduce the input to a standalone example.
- Unavailable language or construct
- unsupported-target or no-implemented-route: inspect the selected direction and feature list. Choose an implemented target or rewrite the unsupported part yourself. Changing the language label does not add support.
- Meaning cannot be preserved
- adapter-fail can cover target emission failure or a semantic guard, for example incompatible integer division. Ambiguous forms, such as Rust ! with an unknown operand type, can be refused at input. Supply the relevant type/context or simplify the expression; do not hide the rejected part.
- Only a value or fragment is available
- binding-edge-declaration-not-rendered, render-context-not-wired or unverified-marker-content: inspect the gaps and the required target context. Convert a smaller expression if useful, then implement and test the missing declaration or surrounding code yourself.
- Input too large or length missing
- E_TOO_LARGE / HTTP 413 or E_LENGTH_REQUIRED / HTTP 411: send Content-Length where required and reduce the request. Limits count UTF-8 bytes; a whole request and its source field can have different limits. Split only at meaningful boundaries and retain needed context.
- Time limit reached
- E_TIMEOUT / HTTP 504, or an MCP timeout error: try a smaller example. A timeout is not a completed conversion. Avoid repeatedly submitting the same large input.
- Rate or daily limit reached
- HTTP 429, E_RATE_LIMITED, E_RATE_LIMIT, E_QUOTA_EXCEEDED or E_DAILY_LIMIT: follow Retry-After or the stated reset time. HTTP API and MCP share a daily conversion bucket; batch items count individually. Web editor conversions have a separate daily limit. Failed requests can also consume quota.
- Access cannot be established
- HTTP 401/403, E_UNAUTHORIZED, E_FORBIDDEN or E_CSRF: sign in again, check the API key and use the intended entry point. Restricted tools can require additional access. Do not send a key or session cookie to support.
- A service or required store is unavailable
- HTTP 500/502/503, E_UNAVAILABLE, E_QUOTA_STORAGE_UNAVAILABLE, E_ENTITLEMENT_UNAVAILABLE, E_INTERNAL or a provider error: keep the original code, retry later and report a persistent failure. A quota or entitlement lookup failure is not evidence that access was granted.
Known limits before applying code
- Execution scope
- Measured examples cover finite inputs and observations. They do not establish behavior for arbitrary data, every branch, every runtime version or every language pair. Conversion does not run your request to establish equivalence.
- Target semantics
- Integer division, boolean versus numeric results, overflow, evaluation order and equality can differ by language. Guards reject some unsupported combinations; absence of a refusal does not prove every semantic difference was detected.
- Placement and missing context
- A result can be an expression fragment rather than a file. Where supplied, read fragmentKind and disclosures. Imports, external definitions, framework APIs, build settings and multi-file dependencies still need integration and testing in the target environment.
- Combinations beyond the measured cases
- Nested features, macros, reflection, runtime code generation and platform-specific APIs are not covered by a blanket program guarantee. Individually supported features can still fail when combined.
- Diagnostics and partial output
- Partial comments preserve source for review, not target behavior. Some failures use a general input or adapter error without identifying the exact semantic cause. Missing diagnostics do not establish correctness.
- Tool and AI scope
- MCP returns text and data; it does not execute code or apply repository changes. Optional AI explanation or refinement is a separate operation and is not proof that a conversion is correct. Review the diff and run your own target-language tests before applying any result.
Support and billing
Paid checkout is unavailable. This guide does not announce paid availability, prices, grace periods, refund eligibility, gifts or account transfers.
For a conversion problem, include the source and target languages, a small non-sensitive example, the error/status, expected behavior and request ID if present. Remove credentials and private data before sending. Contact support@lenacode.com.