@foodtales/knowledge
v0.5.0
Published
Official TypeScript/JavaScript SDK for the Food Tales Knowledge API
Maintainers
Readme
@foodtales/knowledge
Official TypeScript / JavaScript SDK for the Food Tales Knowledge API.
Install
npm install @foodtales/knowledge
# or
pnpm add @foodtales/knowledge
# or
yarn add @foodtales/knowledgeRequires Node.js 18+ (native fetch).
Quickstart
import { FoodTalesClient, FoodTalesError } from "@foodtales/knowledge";
const ft = new FoodTalesClient({
apiKey: process.env.FOODTALES_API_KEY!,
// baseUrl: "https://knowledge.foodtales.ai", // default
});
try {
const { data, credits } = await ft.search({
q: "biryani",
limit: 5,
mode: "lexical",
});
console.log(data, credits);
} catch (err) {
if (err instanceof FoodTalesError) {
console.error(err.status, err.code, err.message);
}
throw err;
}Methods
| Method | Endpoint |
| --- | --- |
| search | GET /v1/search (dish search) |
| getDish | GET /v1/dishes/{ref} |
| dishRelationships | GET /v1/dishes/{ref}/relationships |
| dishIngredients | GET /v1/dishes/{ref}/ingredients |
| dishRecipes | GET /v1/dishes/{ref}/recipes |
| getDishPage | GET /v1/dishes/{ref}/page (Phase 2 dish knowledge page) |
| createMealProfile / generateMealPlan / optimizeMealPlan / mealShoppingList | Phase 3–4 meal planning (/v1/meal/*) |
| similarDishes | GET /v1/similar/dishes/{ref} |
| similarRecipes | GET /v1/similar/recipes/{ref} |
| searchIngredients | GET /v1/ingredients |
| getIngredient | GET /v1/ingredients/{id} |
| ingredientRecipes | GET /v1/ingredients/{id}/recipes |
| coverage | GET /v1/coverage/dishes |
| searchRecipes | GET /v1/recipes/search (Phase 1 cook search) |
| recipesByIngredients | POST /v1/recipes/by-ingredients |
| scaleRecipe | POST /v1/recipes/{ref}/scale |
| getRecipeDetail | GET /v1/recipes/{ref}/detail |
| ingredientSubstitutions | GET /v1/ingredients/{id}/substitutions |
| trust / browse / siblings | public demo endpoints (no key) |
Auth header: X-Api-Key. Credit headers are parsed onto response.credits.
Docs
- Website: foodtales.ai/docs/sdks
- Knowledge API: knowledge.foodtales.ai
- OpenAPI: knowledge.foodtales.ai/openapi.json
Develop (contributors)
npm install
npm run build
npm testFrom a local clone of this monorepo:
npm install ./sdk/typescript