Add Claude + Gemini provider support, rename to LLMock#9
Merged
Conversation
Add handler modules for two new LLM provider APIs, both following the
established pattern from responses.ts: convert inbound request to
ChatCompletionRequest, match fixtures, convert response back to
provider-specific format.
Claude Messages API (/v1/messages):
- Streaming via event: type / data: json SSE format
- Non-streaming JSON responses
- Full message lifecycle: message_start through message_stop
- Tool use with input_json_delta streaming
- msg_ and toolu_ ID prefixes
Google Gemini GenerateContent API:
- /v1beta/models/{model}:generateContent (non-streaming)
- /v1beta/models/{model}:streamGenerateContent (streaming)
- data-only SSE format (no event prefix, no [DONE])
- functionCall/functionResponse round-trips with synthetic IDs
- FUNCTION_CALL finishReason for tool call responses
Also adds generateMessageId() and generateToolUseId() helpers,
server routes for both providers, and comprehensive tests.
Rename the project from @copilotkit/mock-openai to @copilotkit/llmock to reflect multi-provider scope (OpenAI, Anthropic, Google Gemini). - Class: MockOpenAI → LLMock - Files: mock-openai.ts → llmock.ts, mock-openai.test.ts → llmock.test.ts - Package: @copilotkit/mock-openai → @copilotkit/llmock - CLI: "Usage: mock-openai" → "Usage: llmock" - Binary: mock-openai → llmock - All imports, tests, and docs updated - Clean break — no backward-compat alias
commit: |
4 tasks
jpr5
added a commit
that referenced
this pull request
Apr 3, 2026
Add Claude + Gemini provider support, rename to LLMock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /v1/messages) — streaming and non-streaming, tool use withinput_json_delta, full message lifecycle eventsPOST /v1beta/models/{model}:generateContentand:streamGenerateContent) — data-only SSE streaming,functionCall/functionResponseround-trips,FUNCTION_CALLfinish reason@copilotkit/llmock), CLI binary, all imports and tests. Clean break, no backward-compat alias.Both new providers follow the established pattern from
responses.ts: convert inbound request →ChatCompletionRequest→ match fixtures → convert response → provider-specific output. Same fixtures work across all 4 endpoints (completions, responses, messages, gemini).326 tests pass, lint clean, prettier clean.
Test plan
pnpm run test— 326 tests pass (12 test files)pnpm run lint— cleanpnpm run format:check— cleanpnpm run build— cleanMockOpenAIormock-openaireferences remain insrc/--helpshowsUsage: llmock