# spring-ai-example **Repository Path**: fix-bugs/spring-ai-example ## Basic Information - **Project Name**: spring-ai-example - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-19 - **Last Updated**: 2026-01-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # spring ai 第三方模型调用示例 ## 文字 > 参考 https://docs.bigmodel.cn/cn/guide/models/free/glm-4.6v-flash ```java @Bean public ChatClient zhipuChatClient(OpenAiChatModel chatModel, OpenAiApi openAiApi) { OpenAiApi customAiApi = openAiApi.mutate() .apiKey(llmProp.getZhipu().getApiKey()) .baseUrl(llmProp.getZhipu().getApiBase()) .completionsPath(llmProp.getZhipu().getCompletionsPath()) .build(); OpenAiChatModel customChatModel = chatModel.mutate() .openAiApi(customAiApi) .defaultOptions( OpenAiChatOptions.builder() .model(llmProp.getZhipu().getModel()) .temperature(llmProp.getZhipu().getTemperature()) .build() ).build(); return ChatClient.builder(customChatModel).build(); } @RequestMapping("/chat") public Flux chat(@RequestParam String prompt) { try { return zhipuChatClient.prompt() .user(prompt) .stream() .content(); } catch (Exception e) { log.error("Error processing request: " + e.getMessage(), e); return Flux.just("Sorry, something went wrong. msg: " + e.getMessage()); } } ``` ![img](imgs/zhipu_text.png) ## 图片 > 参考 https://docs.bigmodel.cn/api-reference/%E6%A8%A1%E5%9E%8B-api/%E5%9B%BE%E5%83%8F%E7%94%9F%E6%88%90 ```bash curl --request POST \ --url https://open.bigmodel.cn/api/paas/v4/images/generations \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "model": "glm-image", "prompt": "一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云.", "size": "1280x1280" } ' ``` ![img](imgs/zhipu_gen_img.png) ## 智谱免费大模型 https://docs.bigmodel.cn/cn/guide/models/free