Skip to content

release: v0.3.2#11

Merged
code-crusher merged 1 commit into
mainfrom
release/v0.3.2
Jun 24, 2026
Merged

release: v0.3.2#11
code-crusher merged 1 commit into
mainfrom
release/v0.3.2

Conversation

@code-crusher

Copy link
Copy Markdown
Member

MatterAI inference was hitting api.matterai.so instead of the api2.matterai.so gateway. AxonClient was running the gateway URL through getUrlFromToken, which rehosts any api.matterai.so target onto the control-plane host resolved from the JWT — so every inference request silently went to the wrong backend.

  • src/api/client.ts: use API_GATEWAY_PATH directly
  • CHANGELOG.md: 0.3.2 entry
  • package.json: bump to 0.3.2

Tagging the merge as v0.3.2 triggers the release workflow.

Fix MatterAI inference hitting api.matterai.so instead of the
api2.matterai.so gateway. AxonClient was running the gateway URL
through getUrlFromToken, which rehosts any api.matterai.so target
onto the control-plane host resolved from the JWT.

- src/api/client.ts: use API_GATEWAY_PATH directly
- CHANGELOG.md: 0.3.2 entry
- package.json: bump to 0.3.2
@matterai-app

matterai-app Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Code Quality new feature

Summary By MatterAI MatterAI logo

🔄 What Changed

Refactored the AxonClient to utilize the OpenAI SDK for API interactions. This includes a complete rewrite of the streaming logic in createMessage to support reasoning tokens (via <think> tags and specific metadata fields), enhanced tool call filtering, and a more robust usage/cost tracking system. The package version was bumped to v0.3.2.

🔍 Impact of the Change

Improves compatibility with OpenAI-style gateways and provides first-class support for reasoning-capable models. The change ensures accurate token usage reporting and cost calculation, especially for "Bring Your Own Key" (BYOK) scenarios, while making the client more maintainable by leveraging standard SDK patterns.

📁 Total Files Changed

Click to Expand
File ChangeLog
Version Bump package.json Updated version to 0.3.2.
Client Refactor src/api/client.ts Migrated to OpenAI SDK, added reasoning token parsing, and improved cost tracking.

🧪 Test Added/Recommended

Recommended

  • Unit Tests: Validate the regex/string logic for extracting <think> blocks from streaming content.
  • Integration Tests: Mock the OpenAI stream to ensure usage and native_tool_calls are yielded correctly at the end of the stream.
  • Edge Case Testing: Verify getTotalCost behavior when is_byok is true vs false.

🔒 Security Vulnerabilities

No direct vulnerabilities detected. Ensure that the token passed to AxonClientOptions is always treated as a sensitive secret and never logged. 🛡️

⏳ Estimated code review effort

MEDIUM (~18 minutes)

Tip

Quality Recommendations

  1. Implement explicit timeout handling for the OpenAI client to prevent hanging requests.

  2. Add a check to ensure model.maxOutputTokens is defined before assigning to max_tokens.

  3. Refactor the <think> tag parsing into a dedicated utility function for better testability.

♫ Tanka Poem

Logic flows like light,
Reasoning caught in the stream,
Tokens counted true.
Version climbs to higher ground,
Axon's path is clear and bright. 🧪

Sequence Diagram

sequenceDiagram
    participant Caller as LLM Consumer
    participant AC as AxonClient
    participant OAI as OpenAI SDK
    participant GW as API Gateway

    Caller->>AC: createMessage(systemPrompt, messages, tools)
    AC->>AC: getModel(modelId)
    AC->>AC: requestHeaders()
    AC->>OAI: chat.completions.create(requestOptions)
    OAI->>GW: POST /chat/completions (stream: true)
    GW-->>OAI: Stream of Chunks

    loop For each chunk
        OAI-->>AC: chunk data
        alt Error in chunk
            AC-->>Caller: throw Error
        else Content/Reasoning
            AC->>AC: Parse <think> tags / reasoning fields
            AC-->>Caller: yield {type: "text" | "reasoning"}
        else Tool Calls
            AC->>AC: Filter & Map tool_calls
            AC-->>Caller: yield {type: "native_tool_calls"}
        end
    end

    AC->>AC: getTotalCost(lastUsage)
    AC-->>Caller: yield {type: "usage", ...}
Loading

@code-crusher code-crusher merged commit 52970ce into main Jun 24, 2026
1 check passed
@code-crusher code-crusher deleted the release/v0.3.2 branch June 24, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant