simplified and added note about custom models

This commit is contained in:
David Zhang 2025-02-07 08:43:31 -08:00
parent f3cc28c2de
commit fad3022657
2 changed files with 14 additions and 21 deletions

View File

@ -143,6 +143,15 @@ If you have a paid version of Firecrawl or a local version, feel free to increas
If you have a free version, you may sometime run into rate limit errors, you can reduce the limit (but it will run a lot slower).
### Custom endpoints and models
There are 2 other optional env vars that lets you tweak the endpoint (for other OpenAI compatible APIs like OpenRouter or Gemini) as well as the model string.
```bash
OPENAI_ENDPOINT="custom_endpoint"
OPENAI_MODEL="custom_model"
```
## How It Works
1. **Initial Setup**

View File

@ -14,31 +14,15 @@ const openai = createOpenAI({
} as CustomOpenAIProviderSettings);
const isCustomEndpoint =
process.env.OPENAI_ENDPOINT &&
process.env.OPENAI_ENDPOINT !== 'https://api.openai.com/v1';
process.env.OPENAI_ENDPOINT && process.env.OPENAI_ENDPOINT !== 'https://api.openai.com/v1';
const customModel = process.env.OPENAI_MODEL;
// Models
export const gpt4Model = openai(
isCustomEndpoint && customModel ? customModel : 'gpt-4o',
{
structuredOutputs: true,
},
);
export const gpt4MiniModel = openai(
isCustomEndpoint && customModel ? customModel : 'gpt-4o-mini',
{
structuredOutputs: true,
},
);
export const o3MiniModel = openai(
isCustomEndpoint && customModel ? customModel : 'o3-mini',
{
reasoningEffort: 'medium',
structuredOutputs: true,
},
);
export const o3MiniModel = openai(isCustomEndpoint && customModel ? customModel : 'o3-mini', {
reasoningEffort: 'medium',
structuredOutputs: true,
});
const MinChunkSize = 140;
const encoder = getEncoding('o200k_base');