Skip to content

[codex] Add OpenAI-compatible LLM providers#563

Merged
ralyodio merged 1 commit into
profullstack:masterfrom
jsdavid278-cyber:codex/llm-adapters
Jun 4, 2026
Merged

[codex] Add OpenAI-compatible LLM providers#563
ralyodio merged 1 commit into
profullstack:masterfrom
jsdavid278-cyber:codex/llm-adapters

Conversation

@jsdavid278-cyber
Copy link
Copy Markdown
Contributor

Summary

  • Add a shared OpenAI-compatible agent provider factory for chat completions and model listing.
  • Add Groq, DeepSeek, Mistral, xAI, and Cerebras provider packages using that shared factory.
  • Add focused provider metadata/env tests and pnpm workspace lockfile entries.

Why

This fills the requested OpenAI-compatible LLM adapter set for Groq, DeepSeek, Mistral, xAI, and Cerebras while keeping provider-specific packages small and consistent with existing agent-provider package structure.

Validation

  • Passed: tsc -p packages/agent-providers/shared/tsconfig.json --noEmit
  • Passed: tsc -p packages/agent-providers/groq/tsconfig.json --noEmit
  • Passed: tsc -p packages/agent-providers/deepseek/tsconfig.json --noEmit
  • Passed: tsc -p packages/agent-providers/mistral/tsconfig.json --noEmit
  • Passed: tsc -p packages/agent-providers/xai/tsconfig.json --noEmit
  • Passed: tsc -p packages/agent-providers/cerebras/tsconfig.json --noEmit
  • Note: focused Vitest run could not start locally because Vite/esbuild hit Windows spawn EPERM; TypeScript package checks above passed.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 4, 2026

Greptile Summary

This PR introduces a shared createOpenAICompatibleProvider factory and five new provider packages (Groq, DeepSeek, Mistral, xAI, Cerebras) that use it. All default models were verified against official API documentation and are current and valid.

  • Shared factory (openai-compatible.ts): handles chat completions, model listing, env validation, URL normalization, and structured error-body extraction — well-tested with a dedicated test suite.
  • Five provider packages: each is a thin config wrapper around the shared factory, consistent with the existing openrouter package structure; base URLs and default models confirmed correct.
  • pnpm lockfile: updated with workspace entries for all five new packages.

Confidence Score: 5/5

All five providers are thin wrappers around a well-tested shared factory; no logic errors or API contract violations detected.

The shared factory correctly handles URL normalization, auth headers, error-body extraction, and env validation. All default model IDs were cross-checked against official provider documentation and are confirmed valid. The package structure mirrors the existing openrouter provider. The change is purely additive with no modifications to existing code paths.

No files require special attention.

Important Files Changed

Filename Overview
packages/agent-providers/shared/src/openai-compatible.ts New shared factory for OpenAI-compatible providers; implements chat, listModels, validateEnv, and error detail extraction correctly
packages/agent-providers/shared/src/tests/openai-compatible.test.ts Good coverage of metadata, env validation, chat, listModels, and error body propagation through the factory
packages/agent-providers/groq/src/provider.ts Thin wrapper around shared factory; correct base URL and valid default model (llama-3.3-70b-versatile)
packages/agent-providers/deepseek/src/provider.ts Valid base URL and confirmed current model (deepseek-v4-flash per official DeepSeek API docs as of 2026)
packages/agent-providers/mistral/src/provider.ts Correct base URL and valid alias model (mistral-large-latest)
packages/agent-providers/xai/src/provider.ts Valid base URL and confirmed current model (grok-4.3 released April 2026)
packages/agent-providers/cerebras/src/provider.ts Valid base URL and confirmed model (gpt-oss-120b is a production Cerebras model per inference-docs.cerebras.ai)
packages/agent-providers/cerebras/package.json Consistent with existing openrouter package structure; main points to TS source for workspace resolution, dist for publish

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Caller] --> B[Provider Package\ne.g. groqProvider]
    B --> C[createOpenAICompatibleProvider\nshared factory]
    C --> D{Operation}
    D --> E[chat\nPOST /chat/completions]
    D --> F[listModels\nGET /models]
    D --> G[validateEnv\ncheck API key + URL]
    D --> H[healthcheck\nvalidateEnv only]
    E --> I{res.ok?}
    F --> I
    I -->|Yes| J[parseContent / sort IDs]
    I -->|No| K[readErrorDetail\nres.text → JSON.parse → message]
    K --> L[AgentProviderRequestError\ndisplayName + op + status + message]
    J --> M[Return result]

    subgraph Providers
        P1[groq]
        P2[deepseek]
        P3[mistral]
        P4[xai]
        P5[cerebras]
    end
    Providers --> C
Loading

Reviews (2): Last reviewed commit: "Add OpenAI-compatible LLM providers" | Re-trigger Greptile

Comment thread packages/agent-providers/cerebras/src/provider.ts Outdated
Comment thread packages/payments/coinpay/src/index.ts
Comment thread packages/agent-providers/shared/src/openai-compatible.ts Outdated
@jsdavid278-cyber jsdavid278-cyber force-pushed the codex/llm-adapters branch 2 times, most recently from 314f332 to f512d8c Compare June 4, 2026 05:24
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: git fetch upstream master && git rebase upstream/master.

2 similar comments
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: git fetch upstream master && git rebase upstream/master.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

🤖 Auto-rebase: The branch was rebased successfully locally but could not be pushed to the fork. Please enable 'Allow edits from maintainers' in the PR settings, or rebase manually: git fetch upstream master && git rebase upstream/master.

@ralyodio ralyodio merged commit 6cd904f into profullstack:master Jun 4, 2026
5 checks passed
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.

2 participants