{"id":26618404,"url":"https://github.com/bewinxed/slimspec","last_synced_at":"2025-07-25T13:07:25.806Z","repository":{"id":279746364,"uuid":"939810189","full_name":"Bewinxed/slimspec","owner":"Bewinxed","description":"Compact LLM format to compress API spec","archived":false,"fork":false,"pushed_at":"2025-03-20T22:44:28.000Z","size":3197,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T23:29:09.410Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bewinxed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-27T06:27:27.000Z","updated_at":"2025-03-20T22:44:31.000Z","dependencies_parsed_at":"2025-02-27T09:10:25.876Z","dependency_job_id":"7494fc35-585c-4dae-b27e-8503004f23d5","html_url":"https://github.com/Bewinxed/slimspec","commit_stats":null,"previous_names":["bewinxed/slimspec"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bewinxed%2Fslimspec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bewinxed%2Fslimspec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bewinxed%2Fslimspec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bewinxed%2Fslimspec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bewinxed","download_url":"https://codeload.github.com/Bewinxed/slimspec/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245238406,"owners_count":20582873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-24T08:38:20.802Z","updated_at":"2025-03-24T08:38:21.360Z","avatar_url":"https://github.com/Bewinxed.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![slimspec banner waifu](banner.png)\n\n```bash\n  /$$$$$$  /$$ /$$                /$$$$$$                               \n /$$__  $$| $$|__/               /$$__  $$                              \n| $$  \\__/| $$ /$$ /$$$$$$/$$$$ | $$  \\__/  /$$$$$$   /$$$$$$   /$$$$$$$\n|  $$$$$$ | $$| $$| $$_  $$_  $$|  $$$$$$  /$$__  $$ /$$__  $$ /$$_____/\n \\____  $$| $$| $$| $$ \\ $$ \\ $$ \\____  $$| $$  \\ $$| $$$$$$$$| $$      \n /$$  \\ $$| $$| $$| $$ | $$ | $$ /$$  \\ $$| $$  | $$| $$_____/| $$      \n|  $$$$$$/| $$| $$| $$ | $$ | $$|  $$$$$$/| $$$$$$$/|  $$$$$$$|  $$$$$$$\n \\______/ |__/|__/|__/ |__/ |__/ \\______/ | $$____/  \\_______/ \\_______/\n                                          | $$                          \n                                          | $$                          \n                                          |__/            \n```                                                        \n# SlimSpec : Towards Zero-Shot, API Spec Compression \u0026 Decompression\nSlimSpec is a token-optimized format for representing API specifications with semantic precision. Designed for Zero-Shot LLM context window efficiency.\n\nAt the current iteration, It achieves 66% less tokens than traditional RAML.\n\n## Evaluations\n\n3 Tests were done based on 3 examples:\n1 - Simple CRUD API\n2 - Complex E-commerce API\n3 - Nested and recursive structures\n\n**Compression Test**\n[compression](https://app.promptfoo.dev/eval/f:61513ea9-b9bf-4d98-8ad9-4fb83c3db224/)\nAll popular LLMs appear to be able to compress SlimSpec to a similar token count.\n\n**Decompression Test**\n[decompression](https://app.promptfoo.dev/eval/f:5291008f-7f31-4bd3-8b16-cd462bbcab43/)\nSonnet \u003e Gemini \u003e Gpt-4o \u003e Deepseek.\n\nRubric was tested with Zero-Shot decompression with NO CONTEXT WHATSOEVER.\n\n## Features\n\n- 60-70% token reduction compared to standard API specifications\n- Complete semantic preservation for lossless conversion\n- Support for complex type systems, inheritance, and validation rules\n- Preserves exact structure of request/response bodies\n- Maintains precision for date/time types, formats, and constraints\n\n## Installation\n```bash\n# Install globally\nbun install -g slimspec\n\n# Or run with bunx\nbunx slimspec\n```\n\n## Usage\n\n```bash\n# Compress all files in current directory\nslimspec c .\n\n# Compress specific file\nslimspec c ./api-spec.raml\n\n# Compress with specific model\nslimspec c . --model openai:gpt-4o\n\n# Compress with custom prompt\nslimspec c . --prompt ./custom-prompt.txt\n\n# Compress to custom output directory\nslimspec c . --output ./compressed-specs\n```\n```bash\n# Decompress all .apaic files in current directory\nslimspec d .\n\n# Decompress specific file\nslimspec d ./api-spec.apaic\n\n# Decompress with specific model\nslimspec d . --model openai:gpt-4o\n\n# Decompress with custom prompt\nslimspec d . --prompt ./custom-decompress-prompt.txt\n\n# By default, fileps are saved in the same directory as the input file\n# To save in a custom output directory:\nslimspec d . --output ./decompressed-specs\n```\n\n## Syntax Reference\n\n### Metadata\n```\n@meta{title:API Name,version:v1,baseUri:uri,mediaType:a/json}\n```\n\n### Type Definitions\n```\nT:TypeName{field1:s!,field2:i?,nested:{prop:s!}}\nT:Child:Parent{additionalField:s!}\n```\n\n### Error Definitions\n```\nE:ErrorType{code:i!,message:s!,details:s?}\n```\n\n### Traits \u0026 Security\n```\n@trait:pagination{limit:i?=20,offset:i?=0}\n@security:oauth2{tokenUri:s!,scopes:s[]}\n```\n\n### Endpoints\n```\nGET/resources|{@trait:pagination}|{200(a/json):*Resource[],404:*Error}\nPOST/resources|{field1:s!,field2:i?}@originalInline|{201:*Resource,400:{message:s!}}\nPUT/resources/{id:s!}|{*Resource}|{200:*Resource,404}\nPATCH/resources/{id}|{field1:s?}|{200:*Resource,404}\nDELETE/resources/{id}||{204,404}\n```\n\n### Type System\n- `s` - string\n- `i` - integer\n- `n` - number\n- `b` - boolean\n- `d(date)` - date-only\n- `d(datetime)` - datetime\n- `type[]` - array\n- `e(val1|val2)` - enum\n- `!` - required\n- `?` - optional\n- `?=default` - optional with default\n\n### Formats \u0026 Constraints\n- `s(uuid)` - UUID format\n- `s(email)` - Email format\n- `s(uri)` - URI format\n- `s(3,100)` - Min/max length\n- `i\u003e=0` - Minimum value\n- `s~regex` - Pattern matching\n\n## Example\n\n### RAML\n```raml\ntypes:\n  User:\n    properties:\n      id: string\n      email:\n        type: string\n        format: email\n        required: true\n      createdAt: datetime\n/users:\n  get:\n    responses:\n      200:\n        body:\n          application/json:\n            type: array\n            items: User\n```\n\n### SlimSpec\n```\n@meta{mediaType:application/json}\nT:User{id:s?,email:s(email)!,createdAt:d(datetime)?}\nGET/users||{200(a/json):*User[]}\n```\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbewinxed%2Fslimspec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbewinxed%2Fslimspec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbewinxed%2Fslimspec/lists"}