Groq Provider
Updated 22 days ago • September 11, 2026
@kortyx/groq is the Groq provider package for Kortyx.
It gives you two entry points:
groq: a batteries-included default provider selectorcreateGroq(...): an explicit factory for custom setup
1. Install the package
2. What the package exports
What each export is for:
groq: default provider selector for the fastest startcreateGroq(...): custom provider instance with explicit settingsMODELS: built-in Groq model ids exposed by the packagePROVIDER_ID: the provider id string, currently"groq"
3. Basic usage in the same file
groq is a provider selector, which means:
- it is callable:
groq("llama-3.3-70b-versatile") - it also exposes provider metadata:
groq.id,groq.models
Good to know: The built-in model list gives autocomplete, but arbitrary Groq-compatible model ids are accepted as strings.
4. Shared app bootstrap usage
If you want one shared import path across your app, re-export groq from a bootstrap file such as src/lib/providers.ts.
Then import it from that file where you actually use it:
5. Advanced usage with explicit settings
Use createGroq(...) when you want app-owned configuration instead of the default environment-based setup.
Use the factory when you need to:
- pass
apiKeyexplicitly - use a custom
baseUrl - provide a custom
fetch
6. Credentials and first-use behavior
The default groq export resolves credentials on first use, not at import time.
Supported environment variables:
GROQ_API_KEYKORTYX_GROQ_API_KEY
If neither variable is set and you did not pass apiKey to createGroq(...), the provider throws a configuration error the first time a Groq model is actually used.
7. Create model refs for workflow and node params
You can also attach default model options to the ref itself:
Those become default options for later useReason(...) calls unless you override them at call time.
8. Use the model with useReason(...)
Good to know: Provider setup is not done on
createAgent(...). Model selection happens where you calluseReason(...)by passing a model ref.
9. Supported normalized call options
Groq currently maps these generic Kortyx options:
temperaturestreamingmaxOutputTokensstopSequencesabortSignalreasoning.effortreasoning.maxTokensresponseFormat.typeresponseFormat.schema
Current Groq provider options:
providerOptions.groq.reasoningFormatproviderOptions.groq.reasoningEffortproviderOptions.groq.serviceTierproviderOptions.groq.structuredOutputsproviderOptions.groq.strictJsonSchema
Current mapping details:
responseFormat.type: "json"maps to Groq JSON moderesponseFormat.schemamaps to Groq JSON schema output unlessstructuredOutputsisfalse- generic reasoning effort maps to Groq
none,low,medium, orhigh temperaturedefaults to0.7when you do not set it
Current warning-backed gaps:
- Groq does not expose a generic reasoning token budget through this provider
- unsupported generic reasoning effort values are reported in
result.warnings - unknown
providerOptionskeys are ignored and reported inresult.warnings
10. Normalized metadata you get back
Groq returns the normalized Kortyx result fields when the API provides them:
usagefinishReasonproviderMetadatawarningsraw
Groq-specific metadata currently includes fields such as:
providerIdmodelIdresponseIdresponseModelcreatedusagecachedTokensreasoningTokens
Use providerMetadata when you need debugging or observability details without coupling your app code to the raw provider payload shape.
Supported scope
@kortyx/groq currently supports text generation through Groq chat completions via useReason(...), including streaming and non-streaming invocation.
It does not currently expose Groq transcription, browser search, embeddings, image generation, file APIs, or provider-hosted tools. Check result.warnings when you rely on advanced generic options and want to verify how Groq handled them.
Available built-in Groq model ids
llama-3.1-8b-instantllama-3.3-70b-versatileopenai/gpt-oss-120bopenai/gpt-oss-20bqwen/qwen3-32b
Next steps
- See Hooks for
useReason(...)behavior and structured output - See Provider API for the shared normalized provider contract
Reasoning, tools, and structured output
Use a model supporting the requested combination, such as openai/gpt-oss-120b for reasoning and schema output. GPT-OSS cannot disable reasoning. Unsupported settings fail explicitly; no model or reasoning fallback is applied.
Groq does not currently support native schema output together with tools or streaming. When you provide only outputSchema, useReason runs tool rounds and reuses an answer that passes the original local validator, with a compatibility warning. This avoids an extra model call; two tool rounds plus a valid answer fit the default three steps. If validation fails, it makes a separate schema-only final request using the same model and reasoning settings. An explicit responseFormat.schema (including a model default) always requires that native finalization, even when the draft is valid. The extra request counts toward toolExecution.maxSteps, execution model-pass limits, usage and Studio telemetry; allow four steps for two tool rounds when finalization is needed. Approval/resume and cancellation cover finalization too. Schema-only responses are buffered even when stream: true.
Direct provider requests combining native schemas and tools fail with guidance. An explicit providerOptions.groq.structuredOutputs: false retains JSON mode plus local validation; Kortyx does not silently choose that weaker mode. reasoningFormat: "raw" cannot be combined with tools or JSON output.